//
// CTLOG_new_from_base64 from 0xe24914 to 0xe24aa0 (396 bytes)
//
// 2 xrefs:
// > sub_D82AB0 @ 0xd82b34
// > ??> @ 0x7c068
//
// 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
//
__int64 __fastcall CTLOG_new_from_base64(
__int64 **a1,
char *a2,
__int64 a3,
int a4,
int a5,
int a6,
int a7,
int a8,
char a9)
{
size_t v12; // x0
unsigned int v13; // w20
__int64 result; // x0
void *v15; // x0
void *v16; // x22
int v17; // w0
__int64 v18; // x20
__int64 *v19; // x21
char *v20; // [xsp+58h] [xbp+58h] BYREF
v12 = strlen(a2);
v13 = v12;
if ( !v12 )
{
LABEL_2:
if ( a1 )
{
LABEL_3:
ERR_put_error(50, 118, 110, (__int64)"crypto/ct/ct_b64.c", 137);
return 0;
}
LABEL_13:
ERR_put_error(50, 118, 7, (__int64)"crypto/ct/ct_b64.c", 132);
return 0;
}
v15 = CRYPTO_malloc((void *)(int)(3 * (v12 >> 2)), (__int64)"crypto/ct/ct_b64.c", 36);
v16 = v15;
if ( !v15 )
{
ERR_put_error(50, 124, 65, (__int64)"crypto/ct/ct_b64.c", 38);
LABEL_15:
CRYPTO_free(v16, (__int64)"crypto/ct/ct_b64.c", 51);
goto LABEL_2;
}
v17 = EVP_DecodeBlock(v15, a2, v13);
if ( v17 < 0 )
{
ERR_put_error(50, 124, 108, (__int64)"crypto/ct/ct_b64.c", 44);
goto LABEL_15;
}
if ( !a1 )
goto LABEL_13;
if ( !v17 )
goto LABEL_3;
v20 = (char *)v16;
v18 = d2i_PUBKEY(nullptr, &v20, v17);
CRYPTO_free(v16, (__int64)"crypto/ct/ct_b64.c", 143);
if ( v18 )
{
v19 = CTLOG_new(v18, a3);
*a1 = v19;
result = 1;
if ( !v19 )
{
EVP_PKEY_free(v18);
return 0;
}
}
else
{
ERR_put_error(50, 118, 110, (__int64)"crypto/ct/ct_b64.c", 145);
return 0;
}
return result;
}