//
// ssl_check_clienthello_tlsext_late from 0x7af4e4 to 0x7af65c (376 bytes)
//
// 2 xrefs:
// > tls_post_process_client_hello @ 0x7a9c08
// > ??> @ 0x5d55c
//
// 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 ssl_check_clienthello_tlsext_late(unsigned int a1, _DWORD *a2)
{
int v2; // r3
_DWORD *v5; // r2
int server_send_pkey; // r0
int v7; // r3
int v8; // r1
int v9; // r0
int (__fastcall *v10)(unsigned int, int *, unsigned __int8 *, int, _DWORD, _DWORD); // r12
int v11; // r1
int v12; // r3
int v14; // r5
int v15; // r0
_DWORD *v16; // r3
int v17; // r2
unsigned __int8 v18; // [sp+Bh] [bp-9h] BYREF
int v19; // [sp+Ch] [bp-8h] BYREF
v2 = *(_DWORD *)(a1 + 356);
*(_DWORD *)(a1 + 384) = 0;
v5 = *(_DWORD **)(a1 + 276);
if ( v2 == -1 || !v5 || !v5[93] )
goto LABEL_9;
server_send_pkey = ssl_get_server_send_pkey(a1);
if ( !server_send_pkey )
goto LABEL_8;
v7 = *(_DWORD *)(a1 + 276);
v8 = *(_DWORD *)(v7 + 376);
**(_DWORD **)(a1 + 200) = server_send_pkey;
v9 = (*(int (__fastcall **)(unsigned int, int))(v7 + 372))(a1, v8);
if ( v9 )
{
if ( v9 != 3 )
{
*a2 = 80;
return 0;
}
*(_DWORD *)(a1 + 384) = 0;
goto LABEL_8;
}
if ( !*(_DWORD *)(a1 + 396) )
{
LABEL_8:
v5 = *(_DWORD **)(a1 + 276);
goto LABEL_9;
}
*(_DWORD *)(a1 + 384) = 1;
v5 = *(_DWORD **)(a1 + 276);
LABEL_9:
v10 = (int (__fastcall *)(unsigned int, int *, unsigned __int8 *, int, _DWORD, _DWORD))v5[117];
v19 = 0;
v18 = 0;
if ( v10 )
{
v11 = *(_DWORD *)(a1 + 104);
v12 = *(_DWORD *)(v11 + 848);
if ( v12 )
{
if ( v10(a1, &v19, &v18, v12, *(_DWORD *)(v11 + 852), v5[118]) )
{
*a2 = 120;
return 0;
}
CRYPTO_free(*(_DWORD *)(*(_DWORD *)(a1 + 104) + 840), "ssl/t1_lib.c", 1837);
v14 = *(_DWORD *)(a1 + 104);
v15 = CRYPTO_memdup(v19, v18, "ssl/t1_lib.c", 1838);
v16 = *(_DWORD **)(a1 + 104);
*(_DWORD *)(v14 + 840) = v15;
if ( !v16[210] )
{
*a2 = 80;
return 0;
}
v17 = v18;
v16[209] = 0;
v16[211] = v17;
}
}
return 1;
}