//
// ENGINE_load_private_key from 0xd9e0ec to 0xd9e208 (284 bytes)
//
// 2 xrefs:
// > sub_BB78D0 @ 0xbb8aa0
// > ??> @ 0xc4d40
//
// 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 ENGINE_load_private_key(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v4; // x19
__int64 (__fastcall *v5)(__int64, __int64, __int64, __int64); // x5
v4 = a1;
if ( a1 )
{
CRYPTO_THREAD_write_lock(global_engine_lock);
if ( *(_DWORD *)(v4 + 160) )
{
CRYPTO_THREAD_unlock(global_engine_lock);
v5 = *(__int64 (__fastcall **)(__int64, __int64, __int64, __int64))(v4 + 120);
if ( v5 )
{
v4 = v5(v4, a2, a3, a4);
if ( !v4 )
ERR_put_error(38, 150, 128, "crypto/engine/eng_pkey.c", 78);
}
else
{
v4 = 0;
ERR_put_error(38, 150, 125, "crypto/engine/eng_pkey.c", 72);
}
}
else
{
v4 = 0;
CRYPTO_THREAD_unlock(global_engine_lock);
ERR_put_error(38, 150, 117, "crypto/engine/eng_pkey.c", 66);
}
}
else
{
ERR_put_error(38, 150, 67, "crypto/engine/eng_pkey.c", 60);
}
return v4;
}