//
// X509_cmp from 0x83e7b8 to 0x83e84c (148 bytes)
//
// 8 xrefs:
// > ssl_cert_select_current @ 0x7914d8
// > X509_OBJECT_retrieve_match @ 0x83ffb4
// > sub_841E08 @ 0x841e6c
// > sub_8426AC @ 0x84282c
// > sub_843DE0 @ 0x844244
// > sub_8462B8 @ 0x846664
// > CMS_add0_cert @ 0x8758e8
// > ??> @ 0x5b23c
//
// 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 X509_cmp(int a1, int a2)
{
int v4; // r3
int result; // r0
signed int v6; // r2
signed int v7; // r3
X509_check_purpose(a1, -1, 0);
X509_check_purpose(a2, -1, 0);
v4 = memcmp((const void *)(a1 + 160), (const void *)(a2 + 160), 0x14u);
if ( v4 )
return v4;
result = *(_DWORD *)(a1 + 68);
if ( result )
return v4;
if ( !*(_DWORD *)(a2 + 68) )
{
v6 = *(_DWORD *)(a1 + 64);
v7 = *(_DWORD *)(a2 + 64);
if ( v6 < v7 )
{
return -1;
}
else if ( v6 <= v7 )
{
return memcmp(*(const void **)(a1 + 60), *(const void **)(a2 + 60), v6);
}
else
{
return 1;
}
}
return result;
}