//
// X509_OBJECT_retrieve_match from 0x1066278 to 0x1066398 (288 bytes)
//
// 3 xrefs:
// > X509_STORE_add_cert @ 0x10663e0
// > X509_STORE_add_crl @ 0x10664e8
// > ??> @ 0xc26e0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:16:53 +0000
//
__int64 __fastcall X509_OBJECT_retrieve_match(unsigned int *a1, __int64 a2)
{
int v4; // w19
__int64 v5; // x20
int v6; // w2
int v7; // w0
v4 = OPENSSL_sk_find((__int64)a1, a2);
if ( v4 == -1 )
return 0;
if ( (unsigned int)(*(_DWORD *)a2 - 1) <= 1 )
{
if ( v4 < (int)OPENSSL_sk_num(a1) )
{
while ( 1 )
{
v5 = OPENSSL_sk_value((__int64)a1, v4);
v6 = *(_DWORD *)v5;
if ( *(_DWORD *)v5 != *(_DWORD *)a2 )
return 0;
if ( v6 == 1 )
{
v7 = X509_subject_name_cmp(*(_QWORD *)(v5 + 8), *(_QWORD *)(a2 + 8));
}
else
{
if ( v6 != 2 )
goto LABEL_10;
v7 = X509_CRL_cmp(*(_QWORD *)(v5 + 8), *(_QWORD *)(a2 + 8));
}
if ( v7 )
return 0;
v6 = *(_DWORD *)a2;
LABEL_10:
if ( v6 == 1 )
{
if ( !(unsigned int)X509_cmp(*(_QWORD *)(v5 + 8), *(_QWORD *)(a2 + 8)) )
return v5;
}
else if ( v6 != 2 || !(unsigned int)X509_CRL_match(*(_QWORD *)(v5 + 8), *(_QWORD *)(a2 + 8)) )
{
return v5;
}
if ( ++v4 >= (int)OPENSSL_sk_num(a1) )
return 0;
}
}
return 0;
}
return OPENSSL_sk_value((__int64)a1, v4);
}