//
// CTLOG_new_from_base64 from 0xa8eda0 to 0xa8ef3c (412 bytes)
//
// 2 xrefs:
// > sub_9EFBE0 @ 0x9efc5c
// > ??> @ 0x79ebc
//
// 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:56 +0000
//
int __fastcall CTLOG_new_from_base64(int **a1, char *a2, int a3)
{
size_t v6; // r0
size_t v7; // r9
void *v9; // r0
void *v10; // r8
int v11; // r0
int v12; // r4
int *v13; // r6
unsigned __int8 *v14; // [sp+Ch] [bp-8h] BYREF
v6 = strlen(a2);
v7 = v6;
if ( !v6 )
{
LABEL_2:
if ( a1 )
{
LABEL_3:
ERR_put_error(50, 118, 110, (int)"crypto/ct/ct_b64.c", 137);
return 0;
}
goto LABEL_13;
}
v9 = CRYPTO_malloc((void *)(3 * (v6 >> 2)), (int)"crypto/ct/ct_b64.c", 36);
v10 = v9;
if ( !v9 )
{
ERR_put_error(50, 124, 65, (int)"crypto/ct/ct_b64.c", 38);
LABEL_15:
CRYPTO_free(v10, (int)"crypto/ct/ct_b64.c", 51);
goto LABEL_2;
}
v11 = EVP_DecodeBlock(v9, a2, v7);
if ( v11 < 0 )
{
ERR_put_error(50, 124, 108, (int)"crypto/ct/ct_b64.c", 44);
goto LABEL_15;
}
if ( !a1 )
{
LABEL_13:
ERR_put_error(50, 118, 7, (int)"crypto/ct/ct_b64.c", 132);
return 0;
}
if ( !v11 )
goto LABEL_3;
v14 = (unsigned __int8 *)v10;
v12 = d2i_PUBKEY(nullptr, &v14, v11);
CRYPTO_free(v10, (int)"crypto/ct/ct_b64.c", 143);
if ( v12 )
{
v13 = CTLOG_new(v12, a3);
*a1 = v13;
if ( v13 )
{
return 1;
}
else
{
EVP_PKEY_free(v12);
return 0;
}
}
else
{
ERR_put_error(50, 118, 110, (int)"crypto/ct/ct_b64.c", 145);
return 0;
}
}