//
// EVP_PKEY_paramgen from 0xdad960 to 0xdada70 (272 bytes)
//
// 2 xrefs:
// > tls_process_key_exchange @ 0xd4b62c
// > ??> @ 0x2ab88
//
// 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 EVP_PKEY_paramgen(_DWORD *a1, __int64 *a2)
{
__int64 v4; // x0
__int64 (__fastcall *v5)(_DWORD *); // x2
int v6; // w0
unsigned int v7; // w19
_DWORD *v9; // x0
if ( !a1 || (v4 = *(_QWORD *)a1) == 0 || (v5 = *(__int64 (__fastcall **)(_DWORD *))(v4 + 40)) == nullptr )
{
v7 = -2;
ERR_put_error(6, 148, 150, (__int64)"crypto/evp/pmeth_gn.c", 40);
return v7;
}
if ( a1[8] != 2 )
{
v7 = -1;
ERR_put_error(6, 148, 151, (__int64)"crypto/evp/pmeth_gn.c", 45);
return v7;
}
if ( !a2 )
return (unsigned int)-1;
if ( *a2 )
{
v6 = v5(a1);
}
else
{
v9 = EVP_PKEY_new();
*a2 = (__int64)v9;
if ( !v9 )
{
v7 = -1;
ERR_put_error(6, 148, 65, (__int64)"crypto/evp/pmeth_gn.c", 56);
return v7;
}
v6 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 40LL))(a1);
}
v7 = v6;
if ( v6 > 0 )
return v7;
EVP_PKEY_free(*a2);
*a2 = 0;
return v7;
}