//
// ASN1_GENERALIZEDTIME_adj from 0xe08f74 to 0xe090fc (392 bytes)
//
// 5 xrefs:
// > ASN1_TIME_adj @ 0xd67848
// > X509_time_adj_ex @ 0xdea9d8
// > ASN1_GENERALIZEDTIME_set @ 0xe09104
// > SCT_print @ 0xe7baf8
// > ??> @ 0xc2730
//
// 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, __int64 a4)
{
struct tm *v7; // x19
int *v8; // x20
void *v9; // x21
time_t v11[2]; // [xsp+58h] [xbp+48h] BYREF
struct tm v12; // [xsp+68h] [xbp+58h] BYREF
v11[0] = a2;
if ( a1 )
{
v7 = OPENSSL_gmtime(v11, &v12);
if ( v7 )
{
v8 = a1;
goto LABEL_4;
}
return nullptr;
}
v8 = (int *)ASN1_GENERALIZEDTIME_new();
if ( !v8 )
return nullptr;
v7 = OPENSSL_gmtime(v11, &v12);
if ( !v7 )
goto LABEL_13;
LABEL_4:
if ( !a3 && !a4 || (unsigned int)OPENSSL_gmtime_adj(&v7->tm_sec, a3, a4) )
{
v9 = *((void **)v8 + 1);
if ( !v9 || (unsigned __int64)*v8 <= 0x13 )
{
v9 = CRYPTO_malloc(&dword_14, (__int64)"crypto/asn1/a_gentm.c", 194);
if ( !v9 )
{
ERR_put_error(13, 216, 65, (__int64)"crypto/asn1/a_gentm.c", 196);
if ( a1 )
return nullptr;
goto LABEL_13;
}
CRYPTO_free(*((void **)v8 + 1), (__int64)"crypto/asn1/a_gentm.c", 199);
*((_QWORD *)v8 + 1) = v9;
}
BIO_snprintf(
v9,
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);
*v8 = strlen((const char *)v9);
v8[1] = 24;
return v8;
}
if ( !a1 )
{
LABEL_13:
ASN1_GENERALIZEDTIME_free((__int64)v8);
return nullptr;
}
return nullptr;
}