//
// sub_83F3E8 from 0x83f3e8 to 0x83f4dc (244 bytes)
//
// 4 xrefs:
// > X509_OBJECT_idx_by_subject @ 0x83faac
// > X509_STORE_CTX_get1_certs @ 0x83fc3c
// > X509_STORE_CTX_get1_certs @ 0x83fd50
// > X509_STORE_CTX_get1_crls @ 0x83fdfc
//
// 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_83F3E8(_DWORD *a1, int a2, int a3, _DWORD *a4)
{
int v6; // r0
_BOOL4 v7; // r3
int v8; // r7
signed int i; // r4
int v10; // r0
int *v11; // r0
int v12; // r2
int v14; // [sp+4h] [bp-150h] BYREF
char *v15; // [sp+8h] [bp-14Ch]
char v16; // [sp+Ch] [bp-148h] BYREF
int v17; // [sp+18h] [bp-13Ch]
char v18; // [sp+94h] [bp-C0h] BYREF
int v19; // [sp+BCh] [bp-98h]
v14 = a2;
if ( a2 == 1 )
{
v19 = a3;
v15 = &v18;
}
else
{
if ( a2 != 2 )
return -1;
v17 = a3;
v15 = &v16;
}
v6 = OPENSSL_sk_find((int)a1, (int)&v14);
v7 = v6 >= 0;
if ( !a4 )
v7 = 0;
v8 = v6;
if ( v7 )
{
*a4 = 1;
for ( i = v6 + 1; ; ++i )
{
if ( i >= OPENSSL_sk_num((int)a1) )
return v8;
v11 = (int *)OPENSSL_sk_value(a1, i);
v12 = *v11;
if ( *v11 != v14 )
return v8;
if ( v12 == 1 )
{
v10 = X509_subject_name_cmp(v11[1], (int)v15);
}
else
{
if ( v12 != 2 )
goto LABEL_11;
v10 = X509_CRL_cmp(v11[1], (int)v15);
}
if ( v10 )
return v8;
LABEL_11:
++*a4;
}
}
return v8;
}