//
// X509_OBJECT_retrieve_match from 0x83fee4 to 0x83ffd8 (244 bytes)
//
// 3 xrefs:
// > X509_STORE_add_cert @ 0x84001c
// > X509_STORE_add_crl @ 0x840120
// > ??> @ 0x670ac
//
// 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 X509_OBJECT_retrieve_match(_DWORD *a1, int *a2)
{
signed int v4; // r4
int v5; // r0
int v6; // r3
_DWORD *v7; // r0
_DWORD *v8; // r5
v4 = OPENSSL_sk_find((int)a1, (int)a2);
if ( v4 != -1 )
{
if ( (unsigned int)(*a2 - 1) > 1 )
return OPENSSL_sk_value(a1, v4);
while ( 1 )
{
if ( v4 >= OPENSSL_sk_num((int)a1) )
return 0;
v7 = (_DWORD *)OPENSSL_sk_value(a1, v4);
v6 = *v7;
v8 = v7;
if ( *v7 != *a2 )
return 0;
if ( v6 == 1 )
{
v5 = X509_subject_name_cmp(v7[1], a2[1]);
}
else
{
if ( v6 != 2 )
goto LABEL_9;
v5 = X509_CRL_cmp(v7[1], a2[1]);
}
if ( v5 )
return 0;
v6 = *a2;
LABEL_9:
if ( v6 == 1 )
{
if ( !X509_cmp(v8[1], a2[1]) )
return (int)v8;
}
else if ( v6 != 2 || !X509_CRL_match(v8[1], a2[1]) )
{
return (int)v8;
}
++v4;
}
}
return 0;
}