//
// ASN1_GENERALIZEDTIME_adj from 0x860f64 to 0x8610e0 (380 bytes)
//
// 5 xrefs:
// > ASN1_TIME_adj @ 0x7c1078
// > X509_time_adj_ex @ 0x8429d4
// > ASN1_GENERALIZEDTIME_set @ 0x8610f0
// > SCT_print @ 0x8cfe38
// > ??> @ 0x5e3fc
//
// 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 ASN1_GENERALIZEDTIME_adj(int a1, time_t a2, int a3, int a4)
{
struct tm *v7; // r4
int v8; // r5
bool v9; // zf
void *v10; // r6
size_t v11; // r0
time_t v13[2]; // [sp+1Ch] [bp-34h] BYREF
struct tm v14; // [sp+24h] [bp-2Ch] BYREF
v13[0] = a2;
if ( a1 )
{
v7 = OPENSSL_gmtime(v13, &v14);
if ( !v7 )
return 0;
v8 = a1;
goto LABEL_5;
}
v8 = ASN1_GENERALIZEDTIME_new();
if ( v8 )
{
v7 = OPENSSL_gmtime(v13, &v14);
if ( !v7 )
{
LABEL_16:
ASN1_GENERALIZEDTIME_free(v8);
return 0;
}
LABEL_5:
v9 = a4 == 0;
if ( !a4 )
v9 = a3 == 0;
if ( !v9 && !OPENSSL_gmtime_adj(&v7->tm_sec, a3, a4) )
{
LABEL_19:
if ( a1 )
return 0;
goto LABEL_16;
}
v10 = *(void **)(v8 + 8);
if ( !v10 || *(_DWORD *)v8 <= 0x13u )
{
v10 = CRYPTO_malloc(&dword_14, (int)"crypto/asn1/a_gentm.c", 194);
if ( !v10 )
{
ERR_put_error(13, 216, 65, (int)"crypto/asn1/a_gentm.c", 196);
goto LABEL_19;
}
CRYPTO_free(*(void **)(v8 + 8), (int)"crypto/asn1/a_gentm.c", 199);
*(_DWORD *)(v8 + 8) = v10;
}
BIO_snprintf(
v10,
0x14u,
"%04d%02d%02d%02d%02d%02dZ",
v7->tm_year + 1900,
v7->tm_mon + 1,
v7->tm_mday,
v7->tm_hour,
v7->tm_min,
v7->tm_sec);
v11 = strlen((const char *)v10);
*(_DWORD *)(v8 + 4) = 24;
*(_DWORD *)v8 = v11;
return v8;
}
return 0;
}