//
// sub_10687F4 from 0x10687f4 to 0x10689c4 (464 bytes)
//
// 2 xrefs:
// > sub_106A0CC @ 0x106ad54
// > X509_verify_cert @ 0x106b458
//
// 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:55 +0000
//
bool __fastcall sub_10687F4(__int64 a1)
{
__int64 *v1; // x20
__int64 v2; // x21
unsigned int *v4; // x0
int v5; // w22
void *v6; // x0
int v7; // w19
int v8; // w1
void *v9; // x0
void *v10; // x1
__int64 v11; // x1
__int64 v13; // x1
unsigned int (__fastcall *v14)(_QWORD, __int64); // x2
__int64 v15; // x1
unsigned int (__fastcall *v16)(_QWORD, __int64); // x2
__int64 v17; // x1
unsigned int (__fastcall *v18)(_QWORD, __int64); // x2
v1 = *(__int64 **)(a1 + 32);
v2 = *(_QWORD *)(a1 + 8);
v4 = (unsigned int *)v1[7];
if ( v4 )
{
v5 = OPENSSL_sk_num(v4);
v6 = (void *)v1[9];
if ( v6 )
{
CRYPTO_free(v6, (__int64)"crypto/x509/x509_vfy.c", 686);
v1[9] = 0;
}
v7 = 0;
if ( v5 > 0 )
{
while ( 1 )
{
v8 = v7++;
v9 = (void *)OPENSSL_sk_value(v1[7], v8);
if ( (int)X509_check_host(v2, v9) > 0 )
break;
if ( v7 == v5 )
goto LABEL_17;
}
}
else if ( v5 )
{
LABEL_17:
v15 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(a1 + 172) = 0;
if ( !v15 )
v15 = OPENSSL_sk_value(*(_QWORD *)(a1 + 152), 0);
*(_QWORD *)(a1 + 184) = v15;
v16 = *(unsigned int (__fastcall **)(_QWORD, __int64))(a1 + 56);
*(_DWORD *)(a1 + 176) = 62;
if ( !v16(0, a1) )
return 0;
}
}
v10 = (void *)v1[10];
if ( !v10 || (int)X509_check_email(v2, v10) > 0 )
goto LABEL_10;
v17 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(a1 + 172) = 0;
if ( !v17 )
v17 = OPENSSL_sk_value(*(_QWORD *)(a1 + 152), 0);
*(_QWORD *)(a1 + 184) = v17;
v18 = *(unsigned int (__fastcall **)(_QWORD, __int64))(a1 + 56);
*(_DWORD *)(a1 + 176) = 63;
if ( !v18(0, a1) )
return 0;
LABEL_10:
v11 = v1[12];
if ( !v11 || (int)X509_check_ip(v2, v11, v1[13], 0) > 0 )
return 1;
v13 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(a1 + 172) = 0;
if ( !v13 )
v13 = OPENSSL_sk_value(*(_QWORD *)(a1 + 152), 0);
v14 = *(unsigned int (__fastcall **)(_QWORD, __int64))(a1 + 56);
*(_QWORD *)(a1 + 184) = v13;
*(_DWORD *)(a1 + 176) = 64;
return v14(0, a1) != 0;
}