//
// EVP_PKEY_paramgen from 0x806a04 to 0x806b28 (292 bytes)
//
// 2 xrefs:
// > tls_process_key_exchange @ 0x7a33b0
// > ??> @ 0x5d20c
//
// 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 EVP_PKEY_paramgen(_DWORD *a1, int *a2)
{
int (__fastcall *v3)(_DWORD *); // r3
int result; // r0
int v6; // r4
_DWORD *v7; // r1
if ( !a1 || !*a1 || (v3 = *(int (__fastcall **)(_DWORD *))(*a1 + 24)) == nullptr )
{
ERR_put_error(6, 148, 150, (int)"crypto/evp/pmeth_gn.c", 40);
return -2;
}
if ( a1[4] != 2 )
{
ERR_put_error(6, 148, 151, (int)"crypto/evp/pmeth_gn.c", 45);
return -1;
}
if ( !a2 )
return -1;
if ( *a2 )
{
result = v3(a1);
}
else
{
v7 = EVP_PKEY_new();
*a2 = (int)v7;
if ( !v7 )
{
ERR_put_error(6, 148, 65, (int)"crypto/evp/pmeth_gn.c", 56);
return -1;
}
result = (*(int (__fastcall **)(_DWORD *))(*a1 + 24))(a1);
}
v6 = result;
if ( result <= 0 )
{
EVP_PKEY_free(*a2);
*a2 = 0;
return v6;
}
return result;
}