//
// sub_841E08 from 0x841e08 to 0x841ecc (196 bytes)
//
// 6 xrefs:
// > X509_STORE_CTX_init @ 0x845dd4
// > X509_STORE_CTX_init @ 0x845ddc
// > X509_STORE_CTX_init @ 0x845f20
// > X509_STORE_CTX_init @ 0x845f28
// > ??> @ 0x846108
// > ??> @ 0x846134
//
// 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_841E08(int a1, int a2, int a3)
{
int result; // r0
signed int v7; // r4
int v8; // r0
int v9; // r0
unsigned int v10; // r1
if ( a2 == a3 )
{
X509_check_purpose(a2, -1, 0);
return (*(_DWORD *)(a2 + 112) & 0x2000) != 0;
}
else if ( X509_check_issued(a3, a2) )
{
return 0;
}
else
{
X509_check_purpose(a2, -1, 0);
if ( (*(_DWORD *)(a2 + 112) & 0x2000) == 0 || (result = OPENSSL_sk_num(*(_DWORD *)(a1 + 80)), result != 1) )
{
v7 = 0;
while ( 1 )
{
v9 = OPENSSL_sk_num(*(_DWORD *)(a1 + 80));
v10 = v7;
if ( v7++ >= v9 )
break;
v8 = OPENSSL_sk_value(*(_DWORD **)(a1 + 80), v10);
if ( a3 == v8 || !X509_cmp(v8, a3) )
return 0;
}
return 1;
}
}
return result;
}