//
// tls_post_process_client_hello from 0x9be624 to 0x9be8d0 (684 bytes)
//
// 2 xrefs:
// > ossl_statem_server_post_process_message @ 0x9c0984
// > ??> @ 0x76fbc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:03 +0000
//
int __fastcall tls_post_process_client_hello(int *a1, int a2)
{
int v4; // r3
int v5; // r0
int (*v6)(void); // r3
int v7; // r0
int v8; // r4
int ciphers; // r0
int v10; // r0
int (__fastcall *v11)(int *, bool); // r3
int v12; // r4
int v13; // r2
_DWORD v14[2]; // [sp+Ch] [bp-8h] BYREF
v14[0] = 40;
if ( a2 != 3 )
{
if ( a2 != 4 )
{
LABEL_3:
a1[121] = 2;
return 1;
}
goto LABEL_8;
}
if ( a1[30] )
{
*(_DWORD *)(a1[26] + 528) = *(_DWORD *)(a1[60] + 172);
}
else
{
v6 = *(int (**)(void))(a1[50] + 192);
if ( v6 )
{
v7 = v6();
if ( !v7 )
{
v14[0] = 80;
ERR_put_error(20, 378, 377, "ssl/statem/statem_srvr.c", 1408);
v13 = 80;
goto LABEL_29;
}
if ( v7 < 0 )
{
a1[5] = 4;
return 3;
}
a1[5] = 1;
}
v8 = *(_DWORD *)(a1[60] + 180);
ciphers = SSL_get_ciphers((int)a1);
v10 = ssl3_choose_cipher(a1, v8, ciphers);
if ( !v10 )
{
ERR_put_error(20, 378, 193, "ssl/statem/statem_srvr.c", 1422);
v13 = v14[0];
goto LABEL_29;
}
v11 = (int (__fastcall *)(int *, bool))a1[138];
*(_DWORD *)(a1[26] + 528) = v10;
if ( v11 )
{
v12 = a1[60];
*(_DWORD *)(v12 + 136) = v11(a1, (*(_DWORD *)(v10 + 12) & 6) != 0);
}
if ( *(_DWORD *)(a1[60] + 136) )
a1[101] = 0;
}
if ( (a1[62] & 1) != 0 || ssl3_digest_cached_records(a1, 0) )
{
if ( *a1 < 768 || ssl_check_clienthello_tlsext_late(a1, v14) )
{
LABEL_8:
v4 = *(_DWORD *)(a1[26] + 528);
v14[0] = 112;
if ( (*(_DWORD *)(v4 + 12) & 0x20) == 0 || !a1[123] )
goto LABEL_3;
if ( a1[126] )
{
v5 = SSL_srp_server_param_with_username(a1, v14);
if ( v5 < 0 )
{
a1[5] = 4;
return 4;
}
if ( !v5 )
goto LABEL_3;
}
else
{
v14[0] = 115;
}
if ( v14[0] == 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);
v13 = v14[0];
goto LABEL_29;
}
ERR_put_error(20, 378, 226, "ssl/statem/statem_srvr.c", 1461);
v13 = v14[0];
}
else
{
v13 = 80;
v14[0] = 80;
}
LABEL_29:
ssl3_send_alert(a1, 2, v13);
ossl_statem_set_error((int)a1);
return 0;
}