//
// tls_post_process_client_hello from 0xfcf82c to 0xfcfaa4 (632 bytes)
//
// 2 xrefs:
// > ossl_statem_server_post_process_message @ 0xfd1918
// > ??> @ 0x9ce68
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:28 +0000
//
__int64 __fastcall tls_post_process_client_hello(__int64 a1, int a2)
{
int v4; // w0
__int64 v5; // x0
int v6; // w0
__int64 v7; // x1
__int64 (__fastcall *v8)(__int64, _QWORD); // x2
int v9; // w0
__int64 ciphers; // x0
__int64 v11; // x0
__int64 (__fastcall *v12)(__int64, bool); // x2
__int64 v13; // x19
unsigned int v14; // w2
__int64 v15; // [xsp+28h] [xbp+28h]
int v16; // [xsp+3Ch] [xbp+3Ch] BYREF
v16 = 40;
if ( a2 != 3 )
{
if ( a2 != 4 )
{
LABEL_3:
*(_DWORD *)(a1 + 788) = 2;
return 1;
}
goto LABEL_8;
}
if ( *(_DWORD *)(a1 + 176) )
{
*(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL) = *(_QWORD *)(*(_QWORD *)(a1 + 376) + 216LL);
LABEL_6:
v4 = *(_DWORD *)(a1 + 392);
if ( (v4 & 1) != 0 || (unsigned int)ssl3_digest_cached_records(a1, v4 & 1) )
{
if ( *(int *)a1 <= 767 || (unsigned int)ssl_check_clienthello_tlsext_late(a1, &v16) )
{
LABEL_8:
v5 = *(_QWORD *)(a1 + 144);
v16 = 112;
if ( (*(_DWORD *)(*(_QWORD *)(v5 + 552) + 20LL) & 0x20) == 0 || !*(_QWORD *)(a1 + 800) )
goto LABEL_3;
if ( *(_QWORD *)(a1 + 824) )
{
v6 = SSL_srp_server_param_with_username(a1, &v16);
if ( v6 < 0 )
{
*(_DWORD *)(a1 + 40) = 4;
return 4;
}
if ( !v6 )
goto LABEL_3;
}
else
{
v16 = 115;
}
if ( v16 == 115 )
ERR_put_error(20, 378, 223, "ssl/statem/statem_srvr.c", 1488);
else
ERR_put_error(20, 378, 226, "ssl/statem/statem_srvr.c", 1485);
v14 = v16;
goto LABEL_26;
}
ERR_put_error(20, 378, 226, "ssl/statem/statem_srvr.c", 1461);
v14 = v16;
}
else
{
v14 = 80;
v16 = 80;
}
LABEL_26:
ssl3_send_alert(a1, 2, v14);
ossl_statem_set_error(a1);
return 0;
}
v7 = *(_QWORD *)(a1 + 328);
v8 = *(__int64 (__fastcall **)(__int64, _QWORD))(v7 + 376);
if ( !v8 )
{
LABEL_17:
v15 = *(_QWORD *)(*(_QWORD *)(a1 + 376) + 232LL);
ciphers = SSL_get_ciphers(a1);
v11 = ssl3_choose_cipher(a1, v15, ciphers);
if ( !v11 )
{
ERR_put_error(20, 378, 193, "ssl/statem/statem_srvr.c", 1422);
v14 = v16;
goto LABEL_26;
}
v12 = *(__int64 (__fastcall **)(__int64, bool))(a1 + 920);
*(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL) = v11;
if ( v12 )
{
v13 = *(_QWORD *)(a1 + 376);
*(_DWORD *)(v13 + 144) = v12(a1, (*(_DWORD *)(v11 + 20) & 6) != 0);
}
if ( *(_DWORD *)(*(_QWORD *)(a1 + 376) + 144LL) )
*(_DWORD *)(a1 + 644) = 0;
goto LABEL_6;
}
v9 = v8(a1, *(_QWORD *)(v7 + 384));
if ( !v9 )
{
v16 = 80;
ERR_put_error(20, 378, 377, "ssl/statem/statem_srvr.c", 1408);
v14 = 80;
goto LABEL_26;
}
if ( v9 >= 0 )
{
*(_DWORD *)(a1 + 40) = 1;
goto LABEL_17;
}
*(_DWORD *)(a1 + 40) = 4;
return 3;
}