//
// CONF_modules_load from 0x9eeea0 to 0x9ef44c (1452 bytes)
//
// 2 xrefs:
// > CONF_modules_load_file @ 0x9ef8fc
// > ??> @ 0x79d5c
//
// 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:28 +0000
//
int __fastcall CONF_modules_load(int a1, char *a2, char a3)
{
int string; // r1
int section; // r0
int v6; // r10
int v7; // r6
int v8; // r0
const char *v9; // r5
char *v10; // r0
size_t v11; // r7
int v12; // r8
int v13; // r4
int v14; // r0
int v15; // r1
int v18; // r8
int v19; // r0
int v20; // r7
int v21; // r0
int *v22; // r0
int v23; // r0
int *v24; // r0
int *v25; // r7
int v26; // r0
int v27; // r3
bool v28; // zf
int v29; // r12
int (__fastcall *v30)(int *, int); // r3
int v31; // r0
int v32; // r12
void (__fastcall *v33)(int *); // r3
int v34; // r4
int v35; // [sp+0h] [bp-78h]
const char *v36; // [sp+4h] [bp-74h]
_BYTE *v37; // [sp+8h] [bp-70h]
int v38; // [sp+10h] [bp-68h]
int v39; // [sp+14h] [bp-64h]
int v40; // [sp+18h] [bp-60h]
int v41; // [sp+1Ch] [bp-5Ch]
int v42; // [sp+20h] [bp-58h]
int v43; // [sp+20h] [bp-58h]
int v44; // [sp+20h] [bp-58h]
int v46; // [sp+38h] [bp-40h]
int v47; // [sp+3Ch] [bp-3Ch]
_BYTE v48[56]; // [sp+40h] [bp-38h] BYREF
if ( !a1 )
return 1;
if ( !a2 )
{
LABEL_53:
string = NCONF_get_string(a1, 0, "openssl_conf");
if ( string )
goto LABEL_4;
LABEL_54:
ERR_clear_error(0);
return 1;
}
string = NCONF_get_string(a1, 0, a2);
if ( !string )
{
if ( (a3 & 0x20) == 0 )
goto LABEL_54;
goto LABEL_53;
}
LABEL_4:
section = NCONF_get_section(a1, string);
v6 = section;
if ( section )
{
v40 = a3 & 8;
v39 = a3 & 4;
v41 = a3 & 1;
v7 = 0;
if ( OPENSSL_sk_num(section) > 0 )
{
while ( 2 )
{
v8 = OPENSSL_sk_value(v6, v7);
v9 = *(const char **)(v8 + 4);
v38 = *(_DWORD *)(v8 + 8);
v10 = strrchr(v9, 46);
if ( v10 )
v11 = v10 - v9;
else
v11 = strlen(v9);
v12 = 0;
while ( 1 )
{
v14 = OPENSSL_sk_num(dword_D340C0);
v15 = v12;
if ( v12++ >= v14 )
break;
v13 = OPENSSL_sk_value(dword_D340C0, v15);
if ( !strncmp(*(const char **)(v13 + 4), v9, v11) )
goto LABEL_25;
}
if ( v40 )
goto LABEL_12;
v18 = NCONF_get_string(a1, v38, "path");
if ( !v18 )
{
ERR_clear_error(0);
v18 = (int)v9;
}
v19 = DSO_load(0, v18, 0, 0, v35, v36, v37);
v20 = v19;
v42 = v19;
if ( v19 )
{
v46 = DSO_bind_func(v19, "OPENSSL_init");
if ( v46 )
{
v21 = DSO_bind_func(v20, "OPENSSL_finish");
v47 = v21;
if ( dword_D340C0 || (dword_D340C0 = OPENSSL_sk_new_null(v21)) != 0 )
{
v22 = (int *)CRYPTO_zalloc(24, "crypto/conf/conf_mod.c", 234);
v13 = (int)v22;
if ( v22 )
{
*v22 = v42;
v23 = CRYPTO_strdup(v9, "crypto/conf/conf_mod.c", 239);
*(_DWORD *)(v13 + 8) = v46;
*(_DWORD *)(v13 + 12) = v47;
*(_DWORD *)(v13 + 4) = v23;
if ( v23 )
{
if ( OPENSSL_sk_push(dword_D340C0, v13) )
{
LABEL_25:
v24 = (int *)CRYPTO_malloc(20, "crypto/conf/conf_mod.c", 293);
v25 = v24;
if ( !v24 )
{
LABEL_44:
if ( v39 )
goto LABEL_14;
ERR_put_error(14, 118, 109, "crypto/conf/conf_mod.c", 173);
BIO_snprintf(v48, 0xDu, "%-8d", -1);
v35 = v38;
v36 = ", retcode=";
v37 = v48;
ERR_add_error_data(6, "module=", v9);
if ( !v41 )
return -1;
LABEL_15:
if ( ++v7 < OPENSSL_sk_num(v6) )
continue;
return 1;
}
*v24 = v13;
v24[1] = CRYPTO_strdup(v9, "crypto/conf/conf_mod.c", 298);
v26 = CRYPTO_strdup(v38, "crypto/conf/conf_mod.c", 299);
v27 = v25[1];
v25[4] = 0;
v28 = v27 == 0;
if ( v27 )
v28 = v26 == 0;
v29 = v28;
v25[2] = v26;
if ( v28 )
{
LABEL_43:
CRYPTO_free(v27, "crypto/conf/conf_mod.c", 339);
CRYPTO_free(
v25[2],
"crypto/conf/conf_mod.c",
(int (__fastcall *)(_DWORD, _DWORD))"/system/bin/linker");
CRYPTO_free(v25, "crypto/conf/conf_mod.c", 341);
goto LABEL_44;
}
v30 = *(int (__fastcall **)(int *, int))(v13 + 8);
if ( v30 )
{
if ( v30(v25, a1) <= 0 )
{
v33 = *(void (__fastcall **)(int *))(v13 + 12);
if ( !v33 )
{
LABEL_42:
v27 = v25[1];
goto LABEL_43;
}
LABEL_49:
v33(v25);
goto LABEL_42;
}
v29 = 1;
}
v31 = dword_D340C4;
if ( dword_D340C4 || (v44 = v29, v31 = OPENSSL_sk_new_null(0), v29 = v44, (dword_D340C4 = v31) != 0) )
{
v43 = v29;
if ( OPENSSL_sk_push(v31, v25) )
{
++*(_DWORD *)(v13 + 16);
goto LABEL_15;
}
ERR_put_error(14, 115, 65, "crypto/conf/conf_mod.c", 323);
v32 = v43;
}
else
{
ERR_put_error(14, 115, 65, "crypto/conf/conf_mod.c", 317);
v32 = v44;
}
v33 = *(void (__fastcall **)(int *))(v13 + 12);
if ( !v33 )
v32 = 0;
if ( !v32 )
goto LABEL_42;
goto LABEL_49;
}
CRYPTO_free(*(_DWORD *)(v13 + 4), "crypto/conf/conf_mod.c", 248);
CRYPTO_free(v13, "crypto/conf/conf_mod.c", 249);
}
else
{
CRYPTO_free(v13, "crypto/conf/conf_mod.c", 243);
}
}
}
v34 = 0;
}
else
{
v34 = 112;
}
}
else
{
v34 = 110;
}
break;
}
DSO_free(v42);
ERR_put_error(14, 117, v34, "crypto/conf/conf_mod.c", 220);
v35 = v18;
ERR_add_error_data(4, "module=", v9);
LABEL_12:
if ( !v39 )
{
ERR_put_error(14, 118, 113, "crypto/conf/conf_mod.c", 162);
ERR_add_error_data(2, "module=", v9);
}
LABEL_14:
if ( v41 )
goto LABEL_15;
return -1;
}
return 1;
}
return 0;
}