//
// EVP_PKEY_CTX_new_id from 0x102c548 to 0x102c690 (328 bytes)
//
// 8 xrefs:
// > ssl_generate_pkey_curve @ 0xfb6b28
// > ssl_generate_pkey_curve @ 0xfb6bb4
// > tls_process_key_exchange @ 0xfc9938
// > sub_FDECD4 @ 0xfded28
// > tls1_final_finish_mac @ 0xfdf77c
// > tls1_generate_master_secret @ 0xfdf950
// > EVP_PKEY_new_mac_key @ 0x102bfc4
// > ??> @ 0xec4d0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:16:17 +0000
//
__int64 __fastcall EVP_PKEY_CTX_new_id(unsigned int a1, __int64 a2)
{
__int64 pkey_meth_engine; // x20
__int64 pkey_meth; // x21
__int64 result; // x0
__int64 v6; // x19
int (*v7)(void); // x1
bool v8; // cc
pkey_meth_engine = a2;
if ( a1 == -1 )
return 0;
if ( a2 )
{
if ( !(unsigned int)ENGINE_init(a2) )
{
ERR_put_error(6, 157, 38, (__int64)"crypto/evp/pmeth_lib.c", 97);
return 0;
}
goto LABEL_4;
}
pkey_meth_engine = ENGINE_get_pkey_meth_engine(a1);
if ( pkey_meth_engine )
{
LABEL_4:
pkey_meth = ENGINE_get_pkey_meth(pkey_meth_engine, a1);
goto LABEL_5;
}
pkey_meth = EVP_PKEY_meth_find(a1);
LABEL_5:
if ( pkey_meth )
{
result = CRYPTO_zalloc(80, "crypto/evp/pmeth_lib.c", 119);
v6 = result;
if ( result )
{
v7 = *(int (**)(void))(pkey_meth + 8);
*(_QWORD *)(result + 8) = pkey_meth_engine;
*(_QWORD *)result = pkey_meth;
*(_DWORD *)(result + 32) = 0;
*(_QWORD *)(result + 16) = 0;
if ( v7 )
{
v8 = v7() <= 0;
result = v6;
if ( v8 )
{
EVP_PKEY_CTX_free(v6);
return 0;
}
}
}
else
{
ENGINE_finish(pkey_meth_engine);
ERR_put_error(6, 157, 65, (__int64)"crypto/evp/pmeth_lib.c", 124);
return 0;
}
}
else
{
ERR_put_error(6, 157, 156, (__int64)"crypto/evp/pmeth_lib.c", 115);
return 0;
}
return result;
}