//
// sub_A56858 from 0xa56858 to 0xa568fc (164 bytes)
//
// 3 xrefs:
// > X509_STORE_CTX_set0_trusted_stack @ 0xa5a748
// > X509_STORE_CTX_set0_trusted_stack @ 0xa5a750
// > ??> @ 0xa5a768
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:08:26 +0000
//
int *__fastcall sub_A56858(int a1, int a2)
{
signed int v2; // r4
int *v5; // r7
int v6; // r0
unsigned int v7; // r1
int v9; // r6
int subject_name; // r0
v2 = 0;
v5 = nullptr;
while ( 1 )
{
do
{
v6 = OPENSSL_sk_num(*(_DWORD *)(a1 + 20));
v7 = v2;
if ( v2++ >= v6 )
return v5;
v9 = OPENSSL_sk_value(*(_DWORD **)(a1 + 20), v7);
subject_name = X509_get_subject_name(v9);
}
while ( X509_NAME_cmp(a2, subject_name) );
if ( !v5 )
{
v5 = OPENSSL_sk_new_null();
if ( !v5 )
break;
}
if ( !OPENSSL_sk_push(v5, v9) )
break;
X509_up_ref(v9);
}
OPENSSL_sk_pop_free((int)v5, (void (__fastcall *)(int))X509_free);
return nullptr;
}