//
// X509_check_ca from 0xa6fe38 to 0xa6fee8 (176 bytes)
//
// 2 xrefs:
// > sub_A589E0 @ 0xa58fcc
// > ??> @ 0x8101c
//
// 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:41 +0000
//
int __fastcall X509_check_ca(int a1)
{
unsigned int v1; // r3
int result; // r0
v1 = *(_DWORD *)(a1 + 112);
if ( (v1 & 0x100) == 0 )
{
CRYPTO_THREAD_write_lock(*(pthread_rwlock_t **)(a1 + 184));
if ( (*(_DWORD *)(a1 + 112) & 0x100) == 0 )
sub_A6F754(a1);
CRYPTO_THREAD_unlock(*(pthread_rwlock_t **)(a1 + 184));
v1 = *(_DWORD *)(a1 + 112);
}
result = v1 & 2;
if ( (v1 & 2) != 0 && (*(_DWORD *)(a1 + 116) & 4) == 0 )
return 0;
if ( (v1 & 1) != 0 )
return (v1 >> 4) & 1;
if ( (v1 & 0x2040) == 0x2040 )
return 3;
if ( (v1 & 2) != 0 )
return 4;
if ( (v1 & 8) != 0 )
{
result = *(_DWORD *)(a1 + 124) & 7;
if ( result )
return 5;
}
return result;
}