//
// sub_7F85C8 from 0x7f85c8 to 0x7f866c (164 bytes)
//
// 3 xrefs:
// > ENGINE_pkey_asn1_find_str @ 0x7f8a04
// > ENGINE_pkey_asn1_find_str @ 0x7f8a10
// > ??> @ 0x7f8a8c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall sub_7F85C8(int result, int a2, int a3, int a4)
{
int v4; // r4
int v6; // r9
int v8; // r0
int v9; // r1
bool v10; // cc
int v11; // r11
int v12; // r7
size_t v13; // r2
int v14; // [sp+4h] [bp-8h] BYREF
v4 = *(_DWORD *)(a4 + 4);
if ( !v4 )
{
v6 = result;
while ( 1 )
{
v8 = OPENSSL_sk_num(a2);
v9 = v4;
v10 = v4 < v8;
result = a2;
if ( !v10 )
break;
++v4;
v11 = OPENSSL_sk_value(a2, v9);
(*(void (__fastcall **)(int, int *, _DWORD, int))(v11 + 40))(v11, &v14, 0, v6);
v12 = v14;
v13 = strlen(*(const char **)(v14 + 12));
if ( v13 == *(_DWORD *)(a4 + 12) )
{
result = strncasecmp(*(const char **)(v14 + 12), *(const char **)(a4 + 8), v13);
if ( !result )
{
*(_DWORD *)a4 = v11;
*(_DWORD *)(a4 + 4) = v12;
return result;
}
}
}
}
return result;
}