//
// ENGINE_add from 0x7f7ab8 to 0x7f7ca0 (488 bytes)
//
// 4 xrefs:
// > sub_8B3090 @ 0x8b35b0
// > engine_load_dynamic_int @ 0x8b39ec
// > engine_load_openssl_int @ 0x8b42d8
// > ??> @ 0x6251c
//
// 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
//
int __fastcall ENGINE_add(int a1)
{
int v2; // r4
const char *v3; // r5
int v4; // r0
unsigned int v5; // r3
unsigned int v6; // r0
int v7; // r3
int v8; // r4
if ( a1 )
{
if ( *(_DWORD *)a1 && *(_DWORD *)(a1 + 4) )
{
CRYPTO_THREAD_write_lock(global_engine_lock);
v2 = dword_AD2E84;
if ( dword_AD2E84 )
{
v3 = *(const char **)a1;
do
{
v4 = strcmp(*(const char **)v2, v3);
v2 = *(_DWORD *)(v2 + 96);
v5 = v2;
if ( v2 )
v5 = 1;
v6 = v4 == 0;
}
while ( v5 > v6 );
if ( v6 )
{
ERR_put_error(38, 120, 103, "crypto/engine/eng_list.c", 68);
goto LABEL_13;
}
v7 = dword_AD2E88;
if ( !dword_AD2E88 || *(_DWORD *)(dword_AD2E88 + 96) )
{
ERR_put_error(38, 120, 110, "crypto/engine/eng_list.c", 86);
LABEL_13:
ERR_put_error(38, 105, 110, "crypto/engine/eng_list.c", 228);
v8 = 0;
LABEL_14:
CRYPTO_THREAD_unlock(global_engine_lock);
return v8;
}
*(_DWORD *)(dword_AD2E88 + 96) = a1;
*(_DWORD *)(a1 + 92) = v7;
}
else
{
if ( dword_AD2E88 )
{
ERR_put_error(38, 120, 110, "crypto/engine/eng_list.c", 74);
goto LABEL_13;
}
*(_DWORD *)(a1 + 92) = 0;
dword_AD2E84 = a1;
engine_cleanup_add_last((int)sub_7F7E18);
}
v8 = 1;
++*(_DWORD *)(a1 + 80);
dword_AD2E88 = a1;
*(_DWORD *)(a1 + 96) = 0;
goto LABEL_14;
}
ERR_put_error(38, 105, 108, "crypto/engine/eng_list.c", 223);
return 0;
}
else
{
ERR_put_error(38, 105, 67, "crypto/engine/eng_list.c", 219);
return 0;
}
}