//
// sub_A685DC from 0xa685dc to 0xa68964 (904 bytes)
//
// 2 xrefs:
// > X509V3_EXT_nconf @ 0xa68ac8
// > X509V3_EXT_nconf_nid @ 0xa68ca4
//
// 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:08:37 +0000
//
const char ***__fastcall sub_A685DC(int a1, int a2, unsigned int a3, int a4, _BYTE *a5)
{
_DWORD *nid; // r0
_DWORD *v10; // r6
int section; // r7
size_t *v12; // r8
unsigned __int8 *v13; // r2
void *v14; // r7
_DWORD *v15; // r5
const char ***v16; // r4
unsigned __int8 *v17; // r1
char *v19; // r0
int (*v20)(void); // r3
void *v21; // r0
int (*v22)(void); // r7
char *v23; // r0
void *v24; // [sp+8h] [bp-Ch] BYREF
void *v25; // [sp+Ch] [bp-8h] BYREF
if ( a3 )
{
nid = (_DWORD *)X509V3_EXT_get_nid(a3);
v10 = nid;
if ( nid )
{
if ( nid[10] )
{
if ( *a5 == 64 )
section = NCONF_get_section(a1, (int)(a5 + 1));
else
section = X509V3_parse_list(a5);
if ( section && OPENSSL_sk_num(section) > 0 )
{
v12 = (size_t *)((int (__fastcall *)(_DWORD *, int, int))v10[10])(v10, a2, section);
if ( *a5 != 64 )
OPENSSL_sk_pop_free(section, (void (__fastcall *)(int))X509V3_conf_free);
if ( v12 )
{
LABEL_11:
v13 = (unsigned __int8 *)v10[2];
v24 = nullptr;
if ( v13 )
{
v14 = (void *)ASN1_item_i2d(v12, (int *)&v24, v13);
if ( (int)v14 < 0 )
goto LABEL_31;
}
else
{
v14 = (void *)((int (__fastcall *)(size_t *, _DWORD))v10[6])(v12, 0);
v21 = CRYPTO_malloc(v14, (int)"crypto/x509v3/v3_conf.c", 149);
v24 = v21;
if ( !v21 )
{
v15 = nullptr;
goto LABEL_32;
}
v25 = v21;
((void (__fastcall *)(size_t *, void **))v10[6])(v12, &v25);
}
v15 = (_DWORD *)ASN1_OCTET_STRING_new();
if ( v15 )
{
v15[2] = v24;
v24 = nullptr;
*v15 = v14;
v16 = X509_EXTENSION_create_by_NID(nullptr, a3, a4, v15);
if ( v16 )
{
ASN1_OCTET_STRING_free((int)v15);
LABEL_16:
v17 = (unsigned __int8 *)v10[2];
if ( v17 )
{
ASN1_item_free(v12, v17);
return v16;
}
((void (__fastcall *)(size_t *))v10[4])(v12);
return v16;
}
LABEL_32:
ERR_put_error(34, 135, 65, (int)"crypto/x509v3/v3_conf.c", 168);
CRYPTO_free(v24, (int)"crypto/x509v3/v3_conf.c", 169);
ASN1_OCTET_STRING_free((int)v15);
v16 = nullptr;
goto LABEL_16;
}
LABEL_31:
v15 = nullptr;
goto LABEL_32;
}
return nullptr;
}
ERR_put_error(34, 151, 105, (int)"crypto/x509v3/v3_conf.c", 93);
v19 = OBJ_nid2sn(a3);
ERR_add_error_data(4, "name=", v19, ",section=", a5);
if ( *a5 != 64 )
{
OPENSSL_sk_pop_free(section, (void (__fastcall *)(int))X509V3_conf_free);
return nullptr;
}
}
else
{
v20 = (int (*)(void))nid[8];
if ( v20 )
{
v12 = (size_t *)v20();
if ( v12 )
goto LABEL_11;
}
else
{
v22 = (int (*)(void))nid[12];
if ( !v22 )
{
ERR_put_error(34, 151, 103, (int)"crypto/x509v3/v3_conf.c", 117);
v23 = OBJ_nid2sn(a3);
v16 = nullptr;
ERR_add_error_data(2, "name=", v23);
return v16;
}
if ( *(_DWORD *)(a2 + 24) && *(_DWORD *)(a2 + 20) )
{
v12 = (size_t *)v22();
if ( v12 )
goto LABEL_11;
}
else
{
ERR_put_error(34, 151, 136, (int)"crypto/x509v3/v3_conf.c", 110);
}
}
}
return nullptr;
}
v16 = nullptr;
ERR_put_error(34, 151, 129, (int)"crypto/x509v3/v3_conf.c", 82);
return v16;
}
ERR_put_error(34, 151, 130, (int)"crypto/x509v3/v3_conf.c", 78);
return nullptr;
}