//
// DSO_load from 0x9f81ec to 0x9f84c0 (724 bytes)
//
// 5 xrefs:
// > CONF_modules_load @ 0x9ef044
// > DSO_dsobyaddr @ 0x9f8770
// > sub_AC8090 @ 0xac82c4
// > sub_AC8090 @ 0xac84ec
// > ??> @ 0x79d6c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:33 +0000
//
int *__fastcall DSO_load(int *a1, int a2, int a3, int a4)
{
int *v4; // r5
int v6; // r4
int (__fastcall *v8)(int *); // r3
int v10; // r0
int v11; // r0
int v12; // r0
int (__fastcall *v13)(int *); // r3
v4 = a1;
if ( a1 )
{
v6 = 0;
LABEL_4:
if ( v4[7] )
{
ERR_put_error(37, 112, 110, "crypto/dso/dso_lib.c", 139);
goto LABEL_6;
}
if ( !a2 )
goto LABEL_26;
if ( !DSO_set_filename((int)v4, a2) )
{
ERR_put_error(37, 112, 112, "crypto/dso/dso_lib.c", 148);
goto LABEL_6;
}
if ( v4[7] )
{
v8 = *(int (__fastcall **)(int *))(*v4 + 4);
if ( v8 )
{
if ( v8(v4) )
return v4;
ERR_put_error(37, 112, 103, "crypto/dso/dso_lib.c", 161);
}
else
{
ERR_put_error(37, 112, 108, "crypto/dso/dso_lib.c", 157);
}
}
else
{
LABEL_26:
ERR_put_error(37, 112, 111, "crypto/dso/dso_lib.c", 153);
}
LABEL_6:
if ( !v6 )
return nullptr;
LABEL_24:
DSO_free(v4);
return nullptr;
}
if ( !dword_D340F8 )
dword_D340F8 = DSO_METHOD_openssl();
v10 = CRYPTO_zalloc(40, "crypto/dso/dso_lib.c", 26);
v4 = (int *)v10;
if ( v10 )
{
v11 = OPENSSL_sk_new_null(v10);
v4[1] = v11;
if ( v11 )
{
*v4 = dword_D340F8;
v4[2] = 1;
v12 = CRYPTO_THREAD_lock_new(v11);
v4[9] = v12;
if ( v12 )
{
v13 = *(int (__fastcall **)(int *))(*v4 + 28);
if ( !v13 || v13(v4) )
{
if ( DSO_ctrl(v4, 2, a4) < 0 )
{
ERR_put_error(37, 112, 100, "crypto/dso/dso_lib.c", 132);
goto LABEL_24;
}
v6 = 1;
goto LABEL_4;
}
DSO_free(v4);
}
else
{
ERR_put_error(37, 113, 65, "crypto/dso/dso_lib.c", 42);
OPENSSL_sk_free(v4[1]);
CRYPTO_free(v4, "crypto/dso/dso_lib.c", 44);
}
}
else
{
ERR_put_error(37, 113, 65, "crypto/dso/dso_lib.c", 34);
CRYPTO_free(v4, "crypto/dso/dso_lib.c", 35);
}
}
else
{
ERR_put_error(37, 113, 65, "crypto/dso/dso_lib.c", 28);
}
ERR_put_error(37, 112, 65, "crypto/dso/dso_lib.c", 126);
return nullptr;
}