//
// o2i_SCT from 0x1001524 to 0x10017b8 (660 bytes)
//
// 2 xrefs:
// > o2i_SCT_LIST @ 0x1001b84
// > ??> @ 0x71a40
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:15:54 +0000
//
__int64 __fastcall o2i_SCT(__int64 *a1, _BYTE **a2, unsigned __int64 a3)
{
__int64 v6; // x19
_BYTE *v7; // x2
int v8; // w0
unsigned __int64 v9; // x20
__int64 v10; // x0
unsigned __int8 *v11; // x4
_BYTE *v12; // x6
unsigned __int64 v13; // x0
unsigned __int64 v14; // x0
unsigned __int64 v15; // x0
unsigned __int64 v16; // x0
unsigned __int64 v17; // x0
unsigned __int64 v18; // x0
unsigned __int64 v19; // x0
int v20; // w5
unsigned __int64 v21; // x21
__int64 v22; // x0
unsigned __int64 v23; // x20
int v24; // w0
__int64 v26; // x0
_BYTE *v27; // x0
_BYTE *v28; // [xsp+58h] [xbp+58h] BYREF
if ( a3 - 1 > 0xFFFE )
{
ERR_put_error(50, 110, 104, "crypto/ct/ct_oct.c", 76);
SCT_free(0);
return 0;
}
v6 = SCT_new();
if ( v6 )
{
v28 = *a2;
v7 = v28;
v8 = (unsigned __int8)*v28;
*(_DWORD *)v6 = v8;
if ( v8 )
{
v26 = CRYPTO_memdup(v7, a3, "crypto/ct/ct_oct.c", 135);
*(_QWORD *)(v6 + 8) = v26;
if ( v26 )
{
v27 = v28;
*(_QWORD *)(v6 + 16) = a3;
*a2 = &v27[a3];
if ( a1 )
goto LABEL_12;
return v6;
}
goto LABEL_17;
}
if ( a3 <= 0x2A )
{
ERR_put_error(50, 110, 104, "crypto/ct/ct_oct.c", 99);
}
else
{
v28 = v7 + 1;
v9 = a3 - 43;
v10 = CRYPTO_memdup(v7 + 1, 32, "crypto/ct/ct_oct.c", 104);
*(_QWORD *)(v6 + 24) = v10;
if ( v10 )
{
v11 = v28;
*(_QWORD *)(v6 + 32) = 32;
v12 = v11 + 42;
v28 = v11 + 42;
v13 = (unsigned __int64)v11[32] << 56;
*(_QWORD *)(v6 + 40) = v13;
v14 = v13 | ((unsigned __int64)v11[33] << 48);
*(_QWORD *)(v6 + 40) = v14;
v15 = v14 | ((unsigned __int64)v11[34] << 40);
*(_QWORD *)(v6 + 40) = v15;
v16 = v15 | ((unsigned __int64)v11[35] << 32);
*(_QWORD *)(v6 + 40) = v16;
v17 = v16 | ((unsigned __int64)v11[36] << 24);
*(_QWORD *)(v6 + 40) = v17;
v18 = v17 | ((unsigned __int64)v11[37] << 16);
*(_QWORD *)(v6 + 40) = v18;
v19 = v18 | ((unsigned __int64)v11[38] << 8);
*(_QWORD *)(v6 + 40) = v19;
*(_QWORD *)(v6 + 40) = v19 | v11[39];
v20 = v11[40];
v21 = v11[41] | (unsigned int)(v20 << 8);
if ( v9 < v21 )
{
ERR_put_error(50, 110, 104, "crypto/ct/ct_oct.c", 114);
}
else
{
if ( !(v11[41] | (v20 << 8)) )
{
LABEL_10:
v23 = v9 - v21;
*(_QWORD *)(v6 + 56) = v21;
v28 = &v12[v21];
v24 = o2i_SCT_signature(v6, &v28, v23);
if ( v24 > 0 )
{
*a2 = &v28[v23 - v24];
if ( a1 )
{
LABEL_12:
SCT_free(*a1);
*a1 = v6;
return v6;
}
return v6;
}
ERR_put_error(50, 110, 104, "crypto/ct/ct_oct.c", 128);
goto LABEL_17;
}
v22 = CRYPTO_memdup(v11 + 42, v11[41] | (unsigned int)(v20 << 8), "crypto/ct/ct_oct.c", 118);
*(_QWORD *)(v6 + 48) = v22;
if ( v22 )
{
v12 = v28;
goto LABEL_10;
}
}
}
}
}
LABEL_17:
SCT_free(v6);
return 0;
}