//
// o2i_SCT_LIST from 0xd83770 to 0xd83980 (528 bytes)
//
// 3 xrefs:
// > SSL_get0_peer_scts @ 0xd4313c
// > d2i_SCT_LIST @ 0xd83bf8
// > ??> @ 0x652e0
//
// 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 o2i_SCT_LIST(__int64 *a1, unsigned __int8 **a2, __int64 a3)
{
unsigned __int64 v3; // x21
unsigned __int8 *v7; // x1
unsigned __int8 *v8; // x2
int v9; // w0
__int64 v10; // x0
__int64 v11; // x22
__int64 v12; // x0
unsigned __int64 v13; // x5
int v14; // w3
int v15; // w0
unsigned __int64 v16; // x3
unsigned __int64 v17; // x19
__int64 v18; // x21
int v19; // w0
int v20; // w3
int v21; // w1
v3 = a3 - 2;
if ( (unsigned __int64)(a3 - 2) > 0xFFFD )
{
ERR_put_error(50, 111, 105, "crypto/ct/ct_oct.c", 269);
return 0;
}
v7 = *a2;
v8 = v7 + 2;
v9 = *v7;
LODWORD(v7) = v7[1];
*a2 = v8;
v10 = (unsigned int)v7 | (v9 << 8);
if ( v3 != (unsigned __int16)v10 )
{
ERR_put_error(50, 111, 105, "crypto/ct/ct_oct.c", 275);
return 0;
}
if ( !a1 || (v11 = *a1) == 0 )
{
v11 = OPENSSL_sk_new_null(v10);
if ( !v11 )
return 0;
if ( !v3 )
{
LABEL_24:
if ( !a1 )
return v11;
goto LABEL_25;
}
LABEL_9:
if ( v3 <= 1 )
{
LABEL_27:
ERR_put_error(50, 111, 105, "crypto/ct/ct_oct.c", 296);
}
else
{
v13 = a3 - 4;
v14 = **a2;
v15 = (*a2)[1];
*a2 += 2;
v16 = v15 | (unsigned int)(v14 << 8);
if ( v16 <= a3 - 4 )
{
while ( v16 )
{
v17 = v13 - v16;
v18 = o2i_SCT(nullptr, a2, v16);
if ( !v18 )
goto LABEL_18;
v19 = OPENSSL_sk_push(v11, v18);
v13 = v17 - 2;
if ( !v19 )
{
SCT_free(v18);
goto LABEL_18;
}
if ( !v17 )
goto LABEL_24;
if ( v17 == 1 )
goto LABEL_27;
v20 = **a2;
v21 = (*a2)[1];
*a2 += 2;
v16 = v21 | (unsigned int)(v20 << 8);
if ( v16 > v13 )
break;
}
}
ERR_put_error(50, 111, 105, "crypto/ct/ct_oct.c", 303);
}
LABEL_18:
if ( !a1 || !*a1 )
SCT_LIST_free(v11);
return 0;
}
while ( 1 )
{
v12 = OPENSSL_sk_pop(v11);
if ( !v12 )
break;
SCT_free(v12);
}
if ( v3 )
goto LABEL_9;
LABEL_25:
if ( *a1 )
return v11;
*a1 = v11;
return v11;
}