//
// EVP_PKEY_keygen from 0xdadb00 to 0xdadbec (236 bytes)
//
// 5 xrefs:
// > ssl_generate_pkey @ 0xd38764
// > ssl_generate_pkey_curve @ 0xd38820
// > EVP_PKEY_new_mac_key @ 0xdadca8
// > cms_RecipientInfo_kari_init @ 0xe1f3cc
// > ??> @ 0x52db8
//
// 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_keygen(_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 + 56)) == nullptr )
{
v7 = -2;
ERR_put_error(6, 146, 150, (__int64)"crypto/evp/pmeth_gn.c", 91);
return v7;
}
if ( a1[8] != 4 )
{
v7 = -1;
ERR_put_error(6, 146, 151, (__int64)"crypto/evp/pmeth_gn.c", 95);
return v7;
}
if ( !a2 )
return (unsigned int)-1;
if ( *a2 )
{
v6 = v5(a1);
goto LABEL_8;
}
v9 = EVP_PKEY_new();
*a2 = (__int64)v9;
if ( !v9 )
return (unsigned int)-1;
v6 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 56LL))(a1);
LABEL_8:
v7 = v6;
if ( v6 > 0 )
return v7;
EVP_PKEY_free(*a2);
*a2 = 0;
return v7;
}