//
// X509_cmp_time from 0xa575fc to 0xa5790c (784 bytes)
//
// 13 xrefs:
// > OCSP_check_validity @ 0xa32b90
// > OCSP_check_validity @ 0xa32bd4
// > OCSP_check_validity @ 0xa32c24
// > x509_check_cert_time @ 0xa57948
// > x509_check_cert_time @ 0xa579b0
// > X509_cmp_current_time @ 0xa57d4c
// > sub_A57D50 @ 0xa57e68
// > sub_A57D50 @ 0xa580a8
// > sub_A57D50 @ 0xa58324
// > sub_A57D50 @ 0xa58574
// > sub_A5AEB8 @ 0xa5af28
// > sub_A5AEB8 @ 0xa5af6c
// > ??> @ 0x7e33c
//
// 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:26 +0000
//
int __fastcall X509_cmp_time(int *a1, unsigned int a2)
{
int v4; // r5
int v5; // r6
int result; // r0
unsigned __int8 *v7; // r6
int v8; // r5
char *v9; // r1
int v10; // r2
int v11; // r3
_BYTE *v12; // r3
unsigned __int8 *v13; // r0
_BOOL4 v14; // r2
int v15; // r2
_BOOL4 v16; // r5
unsigned int v17; // r3
unsigned int v18; // r1
int v19; // r2
int v20; // r3
size_t v21[4]; // [sp+0h] [bp-40h] BYREF
char v22[12]; // [sp+10h] [bp-30h] BYREF
char v23; // [sp+1Ch] [bp-24h] BYREF
char v24[24]; // [sp+28h] [bp-18h] BYREF
v4 = *a1;
v5 = a1[2];
if ( a1[1] == 23 )
{
if ( (unsigned int)(v4 - 11) > 6 )
return 0;
memcpy(v22, (const void *)a1[2], 0xAu);
v7 = (unsigned __int8 *)(v5 + 10);
v8 = v4 - 10;
v9 = &v22[10];
}
else
{
if ( (unsigned int)(v4 - 13) > 0xA )
return 0;
memcpy(v22, (const void *)a1[2], sizeof(v22));
v7 = (unsigned __int8 *)(v5 + 12);
v8 = v4 - 12;
v9 = &v23;
}
v10 = *v7;
v11 = ((v10 - 43) & 0xFD) == 0;
if ( v10 == 90 )
v11 = 1;
if ( v11 )
{
*v9 = 48;
v12 = v9 + 2;
v9[1] = 48;
goto LABEL_25;
}
if ( v8 == 1 )
return 0;
*v9 = v10;
v9[1] = v7[1];
if ( v8 == 2 )
return 0;
if ( v7[2] != 46 )
{
v12 = v9 + 2;
v7 += 2;
v8 -= 2;
LABEL_25:
*v12 = 90;
v12[1] = 0;
goto LABEL_26;
}
v8 -= 3;
if ( !v8 )
return 0;
if ( (unsigned int)v7[3] - 48 > 9 )
{
v9[3] = 0;
v7 += 3;
v9[2] = 90;
}
else
{
v13 = v7 + 4;
do
{
v14 = ++v11 <= 2 && --v8 != 0;
v7 = v13;
if ( !v14 )
break;
++v13;
}
while ( (unsigned int)*v7 - 48 <= 9 );
v9[2] = 90;
v9[3] = 0;
if ( !v8 )
return 0;
}
LABEL_26:
v15 = *v7;
if ( v15 == 90 )
{
if ( v8 != 1 )
return 0;
v18 = 0;
}
else
{
v16 = v8 != 5 || ((v15 - 43) & 0xFD) != 0;
if ( v16
|| (unsigned __int8)(v7[1] - 48) > 9u
|| (unsigned __int8)(v7[2] - 48) > 9u
|| (unsigned __int8)(v7[3] - 48) > 9u
|| (unsigned __int8)(v7[4] - 48) > 9u )
{
return 0;
}
v17 = __clz(v15 - 45);
v18 = 60 * ((-(v17 >> 5) ^ (v7[4] - 48 + 10 * (v7[3] - 48) + 60 * (v7[2] - 48 + 10 * (v7[1] - 48)))) + (v17 >> 5));
}
v21[1] = a1[1];
v21[3] = 0;
v21[0] = 24;
v21[2] = (size_t)v24;
if ( !X509_time_adj(v21, v18, a2) )
return 0;
if ( a1[1] == 23 )
{
v19 = (unsigned __int8)v22[1] - 48 + 10 * ((unsigned __int8)v22[0] - 48);
v20 = (unsigned __int8)v24[1] - 48 + 10 * ((unsigned __int8)v24[0] - 48);
if ( v19 <= 49 )
v19 += 100;
if ( v20 <= 49 )
v20 += 100;
if ( v19 < v20 )
return -1;
if ( v19 > v20 )
return 1;
}
result = strcmp(v22, v24);
if ( !result )
return -1;
return result;
}