//
// EVP_PKEY_CTX_new_id from 0xa1bf18 to 0xa1c064 (332 bytes)
//
// 8 xrefs:
// > ssl_generate_pkey_curve @ 0x9a3cc0
// > ssl_generate_pkey_curve @ 0x9a3d50
// > tls_process_key_exchange @ 0x9b7f68
// > sub_9CEC08 @ 0x9cec38
// > tls1_final_finish_mac @ 0x9cf734
// > tls1_generate_master_secret @ 0x9cf91c
// > EVP_PKEY_new_mac_key @ 0xa1b92c
// > ??> @ 0x748fc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:07:53 +0000
//
int *__fastcall EVP_PKEY_CTX_new_id(int a1, _DWORD *a2)
{
int *result; // r0
int pkey_meth_engine; // r5
int pkey_meth; // r6
int v6; // r4
int (*v7)(void); // r3
bool v8; // cc
if ( a1 == -1 )
return nullptr;
pkey_meth_engine = (int)a2;
if ( a2 )
{
if ( !ENGINE_init(a2) )
{
ERR_put_error(6, 157, 38, (int)"crypto/evp/pmeth_lib.c", 97);
return nullptr;
}
goto LABEL_5;
}
pkey_meth_engine = ENGINE_get_pkey_meth_engine(a1);
if ( pkey_meth_engine )
{
LABEL_5:
pkey_meth = ENGINE_get_pkey_meth(pkey_meth_engine, a1);
goto LABEL_6;
}
pkey_meth = EVP_PKEY_meth_find(a1);
LABEL_6:
if ( pkey_meth )
{
result = (int *)CRYPTO_zalloc(40, "crypto/evp/pmeth_lib.c", 119);
v6 = (int)result;
if ( result )
{
v7 = *(int (**)(void))(pkey_meth + 8);
result[1] = pkey_meth_engine;
*result = pkey_meth;
result[4] = 0;
result[2] = 0;
if ( v7 )
{
v8 = v7() <= 0;
result = (int *)v6;
if ( v8 )
{
EVP_PKEY_CTX_free(v6);
return nullptr;
}
}
}
else
{
ENGINE_finish(pkey_meth_engine);
ERR_put_error(6, 157, 65, (int)"crypto/evp/pmeth_lib.c", 124);
return nullptr;
}
}
else
{
ERR_put_error(6, 157, 156, (int)"crypto/evp/pmeth_lib.c", 115);
return nullptr;
}
return result;
}