//
// srp_generate_server_master_secret from 0xd5c838 to 0xd5c934 (252 bytes)
//
// 2 xrefs:
// > tls_process_client_key_exchange @ 0xd53284
// > ??> @ 0x536b8
//
// 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 srp_generate_server_master_secret(_QWORD *a1)
{
__int64 v2; // x21
__int64 v3; // x0
__int64 v4; // x22
int v5; // w0
bool v6; // nf
int v7; // w1
int v8; // w0
size_t v9; // x20
const void *v10; // x23
unsigned int master_secret; // w19
if ( (unsigned int)SRP_Verify_A_mod_N(a1[108], a1[104]) && (v2 = SRP_Calc_u(a1[108], a1[107], a1[104])) != 0 )
{
v3 = SRP_Calc_server_key(a1[108], a1[111], v2, a1[110], a1[104]);
v4 = v3;
if ( !v3 )
goto LABEL_10;
v5 = BN_num_bits(v3);
v7 = v5 + 7;
v6 = v5 + 7 < 0;
v8 = v5 + 14;
if ( !v6 )
v8 = v7;
v9 = v8 >> 3;
v10 = (const void *)CRYPTO_malloc(v9, "ssl/tls_srp.c", 299);
if ( v10 )
{
BN_bn2bin(v4);
master_secret = ssl_generate_master_secret((__int64)a1, v10, v9, 1);
}
else
{
LABEL_10:
master_secret = -1;
}
}
else
{
v2 = 0;
master_secret = -1;
v4 = 0;
}
BN_clear_free(v4);
BN_clear_free(v2);
return master_secret;
}