//
// ENGINE_by_id from 0x101c0c0 to 0x101c3a4 (740 bytes)
//
// 5 xrefs:
// > sub_E2EF6C @ 0xe2ef9c
// > sub_101A2D4 @ 0x101a4cc
// > sub_101A2D4 @ 0x101a584
// > ENGINE_by_id @ 0x101c1a8
// > ??> @ 0xf0448
//
// 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_by_id(const char *a1)
{
__int64 v2; // x19
__int64 v3; // x21
char *v5; // x21
__int64 v6; // x0
__int64 v7; // x19
__int64 v8; // x0
const char *v9; // x15
__int64 v10; // x14
__int64 v11; // x13
__int64 v12; // x12
__int64 v13; // x11
__int64 v14; // x10
__int64 v15; // x9
__int64 v16; // x8
__int64 v17; // x7
__int64 v18; // x6
__int64 v19; // x5
__int64 v20; // x4
__int64 v21; // x3
__int64 v22; // x2
__int64 v23; // x0
if ( !a1 )
{
v3 = 0;
ERR_put_error(38, 106, 67, "crypto/engine/eng_list.c", 287);
return v3;
}
if ( (unsigned int)CRYPTO_THREAD_run_once(&engine_lock_init, do_engine_lock_init_ossl_)
&& do_engine_lock_init_ossl_ret_ )
{
CRYPTO_THREAD_write_lock(global_engine_lock);
v2 = qword_1566400;
if ( !qword_1566400 )
{
LABEL_12:
CRYPTO_THREAD_unlock(global_engine_lock);
if ( !strcmp(a1, "dynamic") )
goto LABEL_25;
v5 = getenv("OPENSSL_ENGINES");
if ( !v5 )
v5 = "/Users/james/Project/cocos2d-x-3rd-party-libs-src/contrib/install-android/arm64/lib/engines-1.1";
v6 = ENGINE_by_id("dynamic");
v7 = v6;
if ( !v6 )
{
LABEL_25:
v7 = 0;
LABEL_21:
ENGINE_free(v7);
ERR_put_error(38, 106, 116, "crypto/engine/eng_list.c", 339);
ERR_add_error_data(2, "id=", a1);
return 0;
}
if ( !(unsigned int)ENGINE_ctrl_cmd_string(v6, "ID", a1, 0) )
goto LABEL_21;
if ( !(unsigned int)ENGINE_ctrl_cmd_string(v7, "DIR_LOAD", &byte_120A098, 0) )
goto LABEL_21;
if ( !(unsigned int)ENGINE_ctrl_cmd_string(v7, "DIR_ADD", v5, 0) )
goto LABEL_21;
if ( !(unsigned int)ENGINE_ctrl_cmd_string(v7, "LIST_ADD", "1", 0) )
goto LABEL_21;
v3 = v7;
if ( !(unsigned int)ENGINE_ctrl_cmd_string(v7, "LOAD", nullptr, 0) )
goto LABEL_21;
return v3;
}
while ( strcmp(a1, *(const char **)v2) )
{
v2 = *(_QWORD *)(v2 + 184);
if ( !v2 )
goto LABEL_12;
}
v3 = v2;
if ( (*(_DWORD *)(v2 + 152) & 4) != 0 )
{
v3 = ENGINE_new();
if ( !v3 )
goto LABEL_12;
v8 = *(_QWORD *)(v2 + 128);
v9 = *(const char **)v2;
v10 = *(_QWORD *)(v2 + 8);
v11 = *(_QWORD *)(v2 + 16);
v12 = *(_QWORD *)(v2 + 24);
v13 = *(_QWORD *)(v2 + 32);
v14 = *(_QWORD *)(v2 + 40);
v15 = *(_QWORD *)(v2 + 48);
v16 = *(_QWORD *)(v2 + 56);
v17 = *(_QWORD *)(v2 + 64);
v18 = *(_QWORD *)(v2 + 72);
v19 = *(_QWORD *)(v2 + 88);
v20 = *(_QWORD *)(v2 + 96);
v21 = *(_QWORD *)(v2 + 104);
v22 = *(_QWORD *)(v2 + 112);
*(_QWORD *)(v3 + 120) = *(_QWORD *)(v2 + 120);
*(_QWORD *)(v3 + 128) = v8;
*(_QWORD *)v3 = v9;
v23 = *(_QWORD *)(v2 + 144);
*(_QWORD *)(v3 + 8) = v10;
*(_QWORD *)(v3 + 16) = v11;
*(_QWORD *)(v3 + 24) = v12;
*(_QWORD *)(v3 + 32) = v13;
*(_QWORD *)(v3 + 40) = v14;
*(_QWORD *)(v3 + 48) = v15;
*(_QWORD *)(v3 + 56) = v16;
*(_QWORD *)(v3 + 64) = v17;
*(_QWORD *)(v3 + 72) = v18;
*(_QWORD *)(v3 + 88) = v19;
*(_QWORD *)(v3 + 96) = v20;
*(_QWORD *)(v3 + 104) = v21;
*(_QWORD *)(v3 + 112) = v22;
*(_QWORD *)(v3 + 144) = v23;
*(_DWORD *)(v3 + 152) = *(_DWORD *)(v2 + 152);
}
else
{
++*(_DWORD *)(v2 + 156);
}
CRYPTO_THREAD_unlock(global_engine_lock);
return v3;
}
ERR_put_error(38, 106, 65, "crypto/engine/eng_list.c", 291);
return 0;
}