//
// o2i_SCT_signature from 0x7db59c to 0x7db6d8 (316 bytes)
//
// 3 xrefs:
// > o2i_SCT @ 0x7db860
// > SCT_new_from_base64 @ 0x879ec0
// > ??> @ 0x604bc
//
// 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 o2i_SCT_signature(int a1, _BYTE **a2, unsigned int a3)
{
_BYTE *v5; // r7
_BYTE *v7; // r8
int v8; // r3
unsigned int v9; // r4
unsigned int v10; // r5
int v11; // r0
bool v12; // zf
int result; // r0
if ( *(_DWORD *)a1 )
{
ERR_put_error(50, 112, 103, "crypto/ct/ct_oct.c", 31);
return -1;
}
else if ( a3 <= 4 )
{
ERR_put_error(50, 112, 107, "crypto/ct/ct_oct.c", 42);
return -1;
}
else
{
v5 = *a2;
*(_BYTE *)(a1 + 40) = **a2;
*(_BYTE *)(a1 + 41) = v5[1];
if ( SCT_get_signature_nid() )
{
v7 = v5 + 4;
v8 = (unsigned __int8)v5[3];
v9 = *a2 - (v5 + 4) + a3;
v10 = v8 | ((unsigned __int8)v5[2] << 8);
if ( v10 > v9 )
{
ERR_put_error(50, 112, 107, "crypto/ct/ct_oct.c", 58);
return -1;
}
else
{
v11 = SCT_set1_signature(a1, v5 + 4, v8 | ((unsigned __int8)v5[2] << 8));
v12 = v11 == 1;
if ( v11 == 1 )
{
v7 += v10;
result = a3 - (v9 - v10);
}
else
{
result = -1;
}
if ( v12 )
*a2 = v7;
}
}
else
{
ERR_put_error(50, 112, 107, "crypto/ct/ct_oct.c", 51);
return -1;
}
}
return result;
}