//
// i2o_SCT_LIST from 0x7dbf48 to 0x7dc120 (472 bytes)
//
// 3 xrefs:
// > i2o_SCT_LIST @ 0x7dc09c
// > i2d_SCT_LIST @ 0x7dc1cc
// > ??> @ 0x6055c
//
// 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 i2o_SCT_LIST(int a1, int *a2)
{
int v2; // r10
int *v3; // r9
int v5; // r1
unsigned int v6; // r7
int v7; // r4
int v8; // r0
int v9; // r1
char *v11; // r5
int v12; // r0
int v13; // r0
int v15; // r0
int v16; // r0
bool v17; // zf
int v18; // r0
int v19; // r0
int v20; // r0
char *v21; // [sp+Ch] [bp-4h] BYREF
v2 = 0;
v3 = a2;
v21 = nullptr;
if ( a2 )
{
v5 = *a2;
if ( !*v3 )
{
v19 = i2o_SCT_LIST();
if ( v19 == -1 )
{
ERR_put_error(50, 108, 105, "crypto/ct/ct_oct.c", 335);
return -1;
}
v20 = CRYPTO_malloc(v19, "crypto/ct/ct_oct.c", 338);
*v3 = v20;
if ( !v20 )
{
ERR_put_error(50, 108, 65, "crypto/ct/ct_oct.c", 339);
return -1;
}
v5 = v20;
v2 = 1;
}
v6 = 2;
v7 = 0;
v21 = (char *)(v5 + 2);
while ( 1 )
{
v8 = OPENSSL_sk_num(a1);
v9 = v7;
if ( v7++ >= v8 )
break;
v11 = v21;
v21 += 2;
v12 = OPENSSL_sk_value(a1, v9);
v13 = i2o_SCT(v12, (void **)&v21);
v6 += v13 + 2;
if ( v13 == -1 )
goto LABEL_8;
*v11 = BYTE1(v13);
v11[1] = v13;
}
if ( v6 < 0x10000 )
{
v21 = (char *)*v3;
*v21 = (unsigned __int16)(v6 - 2) >> 8;
v21[1] = v6 - 2;
if ( !v2 )
*v3 += v6;
return v6;
}
LABEL_8:
if ( !v2 )
return -1;
CRYPTO_free(*v3, "crypto/ct/ct_oct.c", 375);
*v3 = 0;
return -1;
}
else
{
v6 = 2;
while ( (int)v3 < OPENSSL_sk_num(a1) )
{
v15 = OPENSSL_sk_value(a1, v3);
v16 = i2o_SCT(v15, nullptr);
v17 = v16 == -1;
v18 = v16 + 2;
if ( v17 )
return -1;
v6 += v18;
v3 = (int *)((char *)v3 + 1);
}
if ( v6 >= 0x10000 )
return -1;
return v6;
}
}