//
// sub_D55110 from 0xd55110 to 0xd552f4 (484 bytes)
//
// 2 xrefs:
// > ssl_parse_serverhello_tlsext @ 0xd56da8
// > sub_D59610 @ 0xd59764
//
// 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 sub_D55110(unsigned __int8 **a1)
{
unsigned __int64 v1; // x19
size_t v2; // x20
unsigned __int8 *v4; // x3
unsigned __int64 v5; // x4
unsigned __int64 v6; // x2
int *v7; // x21
unsigned __int8 *v9; // x4
unsigned __int64 v10; // x2
unsigned __int64 v11; // x3
unsigned __int64 v12; // x5
unsigned __int64 v13; // x0
bool v14; // cf
int v15; // w3
unsigned __int64 v16; // x3
int v17; // w2
__int64 v18; // x0
int v19; // w1
bool v20; // zf
v1 = (unsigned __int64)a1[1];
v2 = 0;
v4 = *a1;
if ( v1 )
{
do
{
v5 = v1 - 4;
if ( v1 <= 3 || (++v2, v6 = v4[3] | (v4[2] << 8), v4 += v6 + 4, v5 < v6) )
{
LODWORD(v1) = 0;
v7 = nullptr;
LABEL_5:
CRYPTO_free(v7, "ssl/t1_lib.c", 1010);
return (unsigned int)v1;
}
v1 = v5 - v6;
}
while ( v5 != v6 );
if ( v2 > 1 )
{
v7 = (int *)CRYPTO_malloc(4 * v2, "ssl/t1_lib.c", 980);
if ( v7 )
{
v9 = *a1;
v10 = v1;
v11 = (unsigned __int64)a1[1];
do
{
v12 = v11 - 2;
v13 = v11 - 4;
if ( v11 <= 1
|| (v14 = v11 != 2, v15 = *v9 << 8, v7[v10] = v15, v7[v10] = v15 | v9[1], v12 == 1 || !v14)
|| (v16 = v9[3] | (v9[2] << 8), v13 < v16) )
{
LODWORD(v1) = 0;
ERR_put_error(20, 341, 68, "ssl/t1_lib.c", 993);
goto LABEL_5;
}
++v10;
v9 += v16 + 4;
v11 = v13 - v16;
}
while ( v10 != v2 );
if ( v11 )
{
LODWORD(v1) = 0;
ERR_put_error(20, 341, 68, "ssl/t1_lib.c", 999);
}
else
{
qsort(v7, v2, 4u, (int (*)(const void *, const void *))sub_D54DA0);
v17 = *v7;
v18 = 1;
while ( 1 )
{
v19 = v7[v18++];
v20 = v19 == v17;
v17 = v19;
if ( v20 )
break;
if ( v18 == v2 )
{
LODWORD(v1) = 1;
goto LABEL_5;
}
}
LODWORD(v1) = 0;
}
}
else
{
ERR_put_error(20, 341, 65, "ssl/t1_lib.c", 982);
}
goto LABEL_5;
}
}
return 1;
}