//
// ssl_parse_serverhello_renegotiate_ext from 0xd5bf38 to 0xd5c17c (580 bytes)
//
// 2 xrefs:
// > ssl_parse_serverhello_tlsext @ 0xd57184
// > ??> @ 0x69390
//
// 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 ssl_parse_serverhello_renegotiate_ext(__int64 a1, unsigned __int8 **a2, _DWORD *a3)
{
__int64 v3; // x21
int v6; // w3
unsigned __int8 *v7; // x5
unsigned int v8; // w19
unsigned __int8 *v10; // x5
unsigned __int8 *v11; // x0
int v12; // w2
unsigned __int64 v13; // x22
unsigned __int8 *v14; // x24
unsigned __int8 *v15; // x22
unsigned __int64 v16; // x1
v3 = *(_QWORD *)(a1 + 144);
v6 = *(unsigned __int8 *)(v3 + 896) + *(unsigned __int8 *)(v3 + 961);
if ( v6 )
{
if ( !*(_BYTE *)(v3 + 896) )
OPENSSL_die((int)"assertion failed: !expected_len || s->s3->previous_client_finished_len");
if ( !*(_BYTE *)(v3 + 961) )
OPENSSL_die((int)"assertion failed: !expected_len || s->s3->previous_server_finished_len");
}
v7 = a2[1];
if ( !v7 )
{
v8 = 0;
ERR_put_error(20, 301, 336, "ssl/t1_reneg.c", 124);
*a3 = 47;
return v8;
}
v10 = v7 - 1;
v11 = *a2 + 1;
v12 = **a2;
*a2 = v11;
a2[1] = v10;
if ( (unsigned __int8 *)(unsigned __int8)v12 == v10 )
{
if ( v6 == v12 )
{
v13 = *(unsigned __int8 *)(v3 + 896);
if ( (unsigned __int8)v12 >= v13
&& (v14 = &v11[v13],
v15 = (unsigned __int8 *)((unsigned __int8)v12 - v13),
*a2 = v14,
a2[1] = v15,
!memcmp(v11, (const void *)(v3 + 832), *(unsigned __int8 *)(v3 + 896))) )
{
v16 = *(unsigned __int8 *)(v3 + 961);
if ( v16 <= (unsigned __int64)v15 )
{
*a2 = &v14[v16];
a2[1] = &v15[-v16];
if ( !memcmp(v14, (const void *)(v3 + 897), *(unsigned __int8 *)(v3 + 961)) )
{
*(_DWORD *)(v3 + 964) = 1;
return 1;
}
}
ERR_put_error(20, 301, 337, "ssl/t1_reneg.c", 158);
*a3 = 47;
return 0;
}
else
{
ERR_put_error(20, 301, 337, "ssl/t1_reneg.c", 149);
*a3 = 40;
return 0;
}
}
else
{
ERR_put_error(20, 301, 337, "ssl/t1_reneg.c", 140);
*a3 = 40;
return 0;
}
}
else
{
ERR_put_error(20, 301, 336, "ssl/t1_reneg.c", 132);
*a3 = 47;
return 0;
}
}