//
// SRP_create_verifier_BN from 0x83817c to 0x8382e0 (356 bytes)
//
// 3 xrefs:
// > SSL_set_srp_server_param_pw @ 0x7b593c
// > SRP_create_verifier @ 0x838408
// > ??> @ 0x5db1c
//
// 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 SRP_create_verifier_BN(const char *a1, const char *a2, int **a3, int *a4, int a5, int a6)
{
int v10; // r0
bool v11; // zf
int v12; // r6
bool v13; // zf
int *v14; // r4
int *v15; // r3
int *v16; // r9
int v17; // r7
bool v19; // zf
int v20; // r3
int v21; // r0
_BYTE v22[2500]; // [sp+Ch] [bp-9C4h] BYREF
v10 = BN_CTX_new(a1);
v11 = a2 == nullptr;
if ( a2 )
v11 = a1 == nullptr;
v12 = v10;
if ( v11 )
goto LABEL_8;
v13 = a4 == nullptr;
if ( a4 )
v13 = a3 == nullptr;
if ( v13 )
{
LABEL_8:
if ( !a3 )
{
v16 = nullptr;
v17 = 0;
goto LABEL_12;
}
v14 = nullptr;
v15 = *a3;
v16 = nullptr;
v17 = 0;
goto LABEL_10;
}
v14 = nullptr;
v19 = a6 == 0;
if ( a6 )
v19 = a5 == 0;
v20 = v19;
if ( !v10 )
v20 |= 1u;
if ( v20 )
goto LABEL_30;
v14 = *a3;
if ( !*a3 )
{
if ( RAND_bytes((int)v22, 20) > 0 )
{
v14 = BN_bin2bn(v22, 20, nullptr);
goto LABEL_22;
}
LABEL_30:
v15 = *a3;
v16 = nullptr;
v17 = 0;
goto LABEL_10;
}
LABEL_22:
v16 = SRP_Calc_x(v14, a1, a2);
v21 = BN_new();
v17 = v21;
*a4 = v21;
if ( v21 )
{
v17 = BN_mod_exp(v21, a6, v16, a5, v12);
if ( v17 )
{
*a3 = v14;
v15 = v14;
v17 = 1;
goto LABEL_10;
}
BN_clear_free((_BYTE *)*a4);
}
v15 = *a3;
LABEL_10:
if ( v14 != v15 )
BN_clear_free(v14);
LABEL_12:
BN_clear_free(v16);
BN_CTX_free(v12);
return v17;
}