//
// ENGINE_by_id from 0x7f7e48 to 0x7f8138 (752 bytes)
//
// 5 xrefs:
// > sub_6449AC @ 0x6449b6
// > sub_7F5E14 @ 0x7f5ff4
// > sub_7F5E14 @ 0x7f6174
// > ENGINE_by_id @ 0x7f7f40
// > ??> @ 0x554cc
//
// 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
//
_DWORD *__fastcall ENGINE_by_id(const char *a1)
{
int v2; // r4
_DWORD *v3; // r6
char *v5; // r4
_DWORD *v6; // r0
int v7; // r0
int v8; // r1
int v9; // r2
int v10; // r3
int v11; // r12
int v12; // r11
int v13; // r10
int v14; // r9
int v15; // r8
int v16; // r5
int v17; // lr
int v18; // r12
int v19; // r0
int v20; // r1
int v21; // r2
int v22; // r3
if ( a1 )
{
if ( 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 = dword_AD2E84;
if ( !dword_AD2E84 )
{
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/armv7/lib/engines-1.1";
v6 = (_DWORD *)ENGINE_by_id("dynamic");
v3 = v6;
if ( !v6 )
{
LABEL_25:
v3 = nullptr;
LABEL_21:
ENGINE_free((int)v3);
ERR_put_error(38, 106, 116, "crypto/engine/eng_list.c", 339);
ERR_add_error_data(2, "id=", a1);
return nullptr;
}
if ( !ENGINE_ctrl_cmd_string(v6, "ID", a1, 0)
|| !ENGINE_ctrl_cmd_string(v3, "DIR_LOAD", "2", 0)
|| !ENGINE_ctrl_cmd_string(v3, "DIR_ADD", v5, 0)
|| !ENGINE_ctrl_cmd_string(v3, "LIST_ADD", "1", 0)
|| !ENGINE_ctrl_cmd_string(v3, "LOAD", nullptr, 0) )
{
goto LABEL_21;
}
return v3;
}
while ( strcmp(a1, *(const char **)v2) )
{
v2 = *(_DWORD *)(v2 + 96);
if ( !v2 )
goto LABEL_12;
}
v3 = (_DWORD *)v2;
if ( (*(_DWORD *)(v2 + 76) & 4) != 0 )
{
v3 = (_DWORD *)ENGINE_new();
if ( !v3 )
goto LABEL_12;
v7 = *(_DWORD *)(v2 + 8);
v8 = *(_DWORD *)(v2 + 12);
v9 = *(_DWORD *)(v2 + 16);
v10 = *(_DWORD *)(v2 + 20);
v11 = *(_DWORD *)(v2 + 4);
v12 = *(_DWORD *)(v2 + 24);
v13 = *(_DWORD *)(v2 + 28);
v14 = *(_DWORD *)(v2 + 32);
v15 = *(_DWORD *)(v2 + 36);
v16 = *(_DWORD *)(v2 + 44);
*v3 = *(_DWORD *)v2;
v17 = *(_DWORD *)(v2 + 48);
v3[1] = v11;
v18 = *(_DWORD *)(v2 + 52);
v3[2] = v7;
v19 = *(_DWORD *)(v2 + 56);
v3[3] = v8;
v20 = *(_DWORD *)(v2 + 60);
v3[4] = v9;
v21 = *(_DWORD *)(v2 + 64);
v3[5] = v10;
v22 = *(_DWORD *)(v2 + 72);
v3[6] = v12;
v3[7] = v13;
v3[8] = v14;
v3[9] = v15;
v3[11] = v16;
v3[12] = v17;
v3[13] = v18;
v3[14] = v19;
v3[15] = v20;
v3[16] = v21;
v3[18] = v22;
v3[19] = *(_DWORD *)(v2 + 76);
}
else
{
++*(_DWORD *)(v2 + 80);
}
CRYPTO_THREAD_unlock(global_engine_lock);
return v3;
}
ERR_put_error(38, 106, 65, "crypto/engine/eng_list.c", 291);
return nullptr;
}
else
{
ERR_put_error(38, 106, 67, "crypto/engine/eng_list.c", 287);
return nullptr;
}
}