//
// X509_cmp from 0x1064984 to 0x1064a24 (160 bytes)
//
// 8 xrefs:
// > ssl_cert_select_current @ 0xfb89fc
// > X509_OBJECT_retrieve_match @ 0x1066364
// > sub_1068120 @ 0x1068198
// > sub_10689C4 @ 0x1068b54
// > sub_106A0CC @ 0x106a7d8
// > sub_106C1C4 @ 0x106c55c
// > CMS_add0_cert @ 0x109e50c
// > ??> @ 0x60d78
//
// 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:52 +0000
//
__int64 __fastcall X509_cmp(__int64 a1, __int64 a2)
{
unsigned int v4; // w0
unsigned int v5; // w1
signed __int64 v6; // x2
signed __int64 v7; // x0
X509_check_purpose(a1, 0xFFFFFFFFLL, 0);
X509_check_purpose(a2, 0xFFFFFFFFLL, 0);
v4 = memcmp((const void *)(a1 + 288), (const void *)(a2 + 288), 0x14u);
if ( v4 )
return v4;
v5 = *(_DWORD *)(a1 + 128);
if ( v5 )
{
return v4;
}
else if ( !*(_DWORD *)(a2 + 128) )
{
v6 = *(_QWORD *)(a1 + 120);
v7 = *(_QWORD *)(a2 + 120);
if ( v6 < v7 )
{
return (unsigned int)-1;
}
else
{
if ( v6 <= v7 )
return memcmp(*(const void **)(a1 + 112), *(const void **)(a2 + 112), v6);
return 1;
}
}
return v5;
}