//
// X509_check_ca from 0x107fd14 to 0x107fde8 (212 bytes)
//
// 2 xrefs:
// > sub_106A0CC @ 0x106a394
// > ??> @ 0x100e58
//
// 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:17:09 +0000
//
__int64 __fastcall X509_check_ca(__int64 a1)
{
unsigned __int64 v2; // x1
__int64 result; // x0
if ( (*(_DWORD *)(a1 + 208) & 0x100) == 0 )
{
CRYPTO_THREAD_write_lock(*(pthread_rwlock_t **)(a1 + 320));
if ( (*(_DWORD *)(a1 + 208) & 0x100) == 0 )
sub_107F63C(a1);
CRYPTO_THREAD_unlock(*(pthread_rwlock_t **)(a1 + 320));
if ( (*(_QWORD *)(a1 + 208) & 0x400000002LL) != 2 )
goto LABEL_3;
return 0;
}
if ( (*(_QWORD *)(a1 + 208) & 0x400000002LL) == 2 )
return 0;
LABEL_3:
v2 = *(unsigned int *)(a1 + 208);
if ( (v2 & 1) != 0 )
return (v2 >> 4) & 1;
result = 3;
if ( (*(_DWORD *)(a1 + 208) & 0x2040) != 0x2040 )
{
result = 4;
if ( (v2 & 2) == 0 )
{
result = 0;
if ( (v2 & 8) != 0 )
{
if ( (*(_DWORD *)(a1 + 220) & 7) != 0 )
return 5;
else
return 0;
}
}
}
return result;
}