//
// CTLOG_new from 0x7db3f8 to 0x7db510 (280 bytes)
//
// 2 xrefs:
// > CTLOG_new_from_base64 @ 0x87a274
// > ??> @ 0x6044c
//
// 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 CTLOG_new(int a1, int a2)
{
int *v4; // r4
int v5; // r0
int v6; // r0
int *result; // r0
int v8; // [sp+Ch] [bp-8h] BYREF
v4 = (int *)CRYPTO_zalloc(40, "crypto/ct/ct_log.c", 237);
if ( !v4 )
{
ERR_put_error(50, 117, 65, "crypto/ct/ct_log.c", 240);
return nullptr;
}
v5 = CRYPTO_strdup(a2, "crypto/ct/ct_log.c", 244);
*v4 = v5;
if ( !v5 )
{
ERR_put_error(50, 117, 65, "crypto/ct/ct_log.c", 246);
goto LABEL_7;
}
v8 = 0;
v6 = i2d_PUBKEY(a1, &v8);
if ( v6 <= 0 )
{
ERR_put_error(50, 125, 113, "crypto/ct/ct_log.c", 81);
CRYPTO_free(v8, "crypto/ct/ct_log.c", 88);
LABEL_7:
CTLOG_free(v4);
return nullptr;
}
SHA256(v8, v6, v4 + 1);
CRYPTO_free(v8, "crypto/ct/ct_log.c", 88);
result = v4;
v4[9] = a1;
return result;
}