//
// ENGINE_load_private_key from 0x101c44c to 0x101c568 (284 bytes)
//
// 2 xrefs:
// > sub_E2DA90 @ 0xe2ec60
// > ??> @ 0x100228
//
// 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:08 +0000
//
__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;
}