//
// sub_A69710 from 0xa69710 to 0xa6a200 (2800 bytes)
//
// 1 xrefs:
// > ??> @ 0xd18418
//
// 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:38 +0000
//
int *__fastcall sub_A69710(int a1, int a2, int a3)
{
signed int i; // r10
char **v5; // r4
_DWORD *v6; // r0
_DWORD *v7; // r11
int v8; // r0
_DWORD *v9; // r5
char *v10; // r4
signed int v11; // r7
char **v12; // r0
int v13; // r0
const char *v14; // r5
_DWORD *v15; // r4
_DWORD *v16; // r5
char **v17; // r0
signed int *v18; // r6
const char *v19; // r4
size_t v20; // r0
_DWORD *v21; // r10
signed int v22; // r6
_DWORD *v23; // r9
_DWORD *v24; // r4
char **v25; // r0
signed int ***v26; // r0
signed int ***v27; // r10
signed int **v28; // r0
signed int *v29; // r5
const char *v30; // r4
int v31; // r3
size_t v32; // r0
int v33; // r0
const char *v34; // r4
_DWORD *v35; // r8
signed int **v36; // r4
int v37; // r0
_DWORD *v38; // r5
int *v39; // r8
signed int v40; // r4
int v41; // r0
int v42; // r1
int v43; // r0
unsigned int v44; // r1
signed int *v46; // r4
size_t v47; // r0
signed int **v48; // r0
signed int **v49; // r3
int *v50; // r0
_DWORD *section; // [sp+10h] [bp-4Ch]
_DWORD *v53; // [sp+14h] [bp-48h]
int v54; // [sp+1Ch] [bp-40h]
_DWORD *v56; // [sp+3Ch] [bp-20h]
int *v57; // [sp+40h] [bp-1Ch]
signed int v58; // [sp+54h] [bp-8h]
v57 = OPENSSL_sk_new_null();
if ( !v57 )
{
ERR_put_error(34, 130, 65, (int)"crypto/x509v3/v3_cpols.c", 98);
return nullptr;
}
v53 = (_DWORD *)X509V3_parse_list(a3);
if ( !v53 )
{
ERR_put_error(34, 130, 34, (int)"crypto/x509v3/v3_cpols.c", 103);
goto LABEL_34;
}
v54 = 0;
for ( i = 0; ; ++i )
{
if ( i >= OPENSSL_sk_num((int)v53) )
{
OPENSSL_sk_pop_free((int)v53, (void (__fastcall *)(int))X509V3_conf_free);
return v57;
}
v8 = OPENSSL_sk_value(v53, i);
v9 = (_DWORD *)v8;
if ( *(_DWORD *)(v8 + 8) || (v10 = *(char **)(v8 + 4)) == nullptr )
{
ERR_put_error(34, 130, 134, (int)"crypto/x509v3/v3_cpols.c", 111);
ERR_add_error_data(6, "section:", *v9, ",name:", v9[1], ",value:", v9[2]);
goto LABEL_34;
}
if ( !strcmp(*(const char **)(v8 + 4), "ia5org") )
{
v54 = 1;
continue;
}
if ( *v10 == 64 )
break;
v5 = OBJ_txt2obj(v10, 0);
if ( !v5 )
{
ERR_put_error(34, 130, 110, (int)"crypto/x509v3/v3_cpols.c", 135);
ERR_add_error_data(6, "section:", *v9, ",name:", v9[1], ",value:", v9[2]);
goto LABEL_34;
}
v6 = POLICYINFO_new();
v7 = v6;
if ( !v6 )
{
ERR_put_error(34, 130, 65, (int)"crypto/x509v3/v3_cpols.c", 141);
ASN1_OBJECT_free(v5);
goto LABEL_34;
}
*v6 = v5;
LABEL_8:
if ( !OPENSSL_sk_push(v57, (int)v7) )
{
POLICYINFO_free(v7);
ERR_put_error(34, 130, 65, (int)"crypto/x509v3/v3_cpols.c", 149);
goto LABEL_34;
}
}
section = (_DWORD *)X509V3_get_section(a2);
if ( section )
{
v7 = POLICYINFO_new();
if ( v7 )
{
v11 = 0;
v58 = i;
while ( v11 < OPENSSL_sk_num((int)section) )
{
v13 = OPENSSL_sk_value(section, v11);
v14 = *(const char **)(v13 + 4);
v15 = (_DWORD *)v13;
if ( !strcmp(v14, "policyIdentifier") )
{
v12 = OBJ_txt2obj((char *)v15[2], 0);
if ( !v12 )
{
ERR_put_error(34, 131, 110, (int)"crypto/x509v3/v3_cpols.c", 177);
v21 = v7;
ERR_add_error_data(6, "section:", *v15, ",name:", v15[1], ",value:", v15[2]);
goto LABEL_33;
}
*v7 = v12;
}
else if ( name_cmp((int)v14, "CPS") )
{
v22 = name_cmp(v15[1], "userNotice");
if ( v22 )
{
ERR_put_error(34, 131, 138, (int)"crypto/x509v3/v3_cpols.c", 223);
v21 = v7;
ERR_add_error_data(6, "section:", *v15, ",name:", v15[1], ",value:", v15[2]);
goto LABEL_33;
}
if ( *(_BYTE *)v15[2] != 64 )
{
ERR_put_error(34, 131, 137, (int)"crypto/x509v3/v3_cpols.c", 203);
v21 = v7;
ERR_add_error_data(6, "section:", *v15, ",name:", v15[1], ",value:", v15[2]);
goto LABEL_33;
}
v23 = (_DWORD *)X509V3_get_section(a2);
if ( !v23 )
{
ERR_put_error(34, 131, 135, (int)"crypto/x509v3/v3_cpols.c", 209);
v21 = v7;
ERR_add_error_data(6, "section:", *v15, ",name:", v15[1], ",value:", v15[2]);
goto LABEL_33;
}
v24 = POLICYQUALINFO_new();
v56 = v24;
if ( !v24 )
goto LABEL_88;
v25 = OBJ_nid2obj(0xA5u);
*v24 = v25;
if ( !v25 )
{
v21 = v7;
ERR_put_error(34, 132, 68, (int)"crypto/x509v3/v3_cpols.c", 256);
LABEL_65:
POLICYQUALINFO_free(v56);
X509V3_section_free(a2, (int)v23);
goto LABEL_33;
}
v26 = (signed int ***)USERNOTICE_new();
v27 = v26;
if ( !v26 )
{
LABEL_88:
v21 = v7;
LABEL_64:
ERR_put_error(34, 132, 65, (int)"crypto/x509v3/v3_cpols.c", 322);
goto LABEL_65;
}
v24[1] = v26;
while ( v22 < OPENSSL_sk_num((int)v23) )
{
v33 = OPENSSL_sk_value(v23, v22);
v34 = *(const char **)(v33 + 4);
v35 = (_DWORD *)v33;
if ( !strcmp(v34, "explicitText") )
{
v46 = (signed int *)ASN1_VISIBLESTRING_new();
v27[1] = (signed int **)v46;
if ( !v46 )
goto LABEL_63;
v47 = strlen((const char *)v35[2]);
if ( !ASN1_STRING_set(v46, (const char *)v35[2], v47) )
goto LABEL_63;
}
else
{
if ( strcmp(v34, "organization") )
{
if ( !strcmp(v34, "noticeNumbers") )
{
v36 = *v27;
if ( *v27 )
{
v37 = X509V3_parse_list(v35[2]);
v38 = (_DWORD *)v37;
if ( v37 )
goto LABEL_55;
goto LABEL_71;
}
v48 = (signed int **)NOTICEREF_new();
v36 = v48;
if ( !v48 )
{
LABEL_63:
v21 = v7;
goto LABEL_64;
}
*v27 = v48;
v37 = X509V3_parse_list(v35[2]);
v38 = (_DWORD *)v37;
if ( !v37 )
goto LABEL_71;
LABEL_55:
if ( !OPENSSL_sk_num(v37) )
{
LABEL_71:
v21 = v7;
ERR_put_error(34, 132, 141, (int)"crypto/x509v3/v3_cpols.c", 296);
ERR_add_error_data(6, "section:", *v35, ",name:", v35[1], ",value:", v35[2]);
OPENSSL_sk_pop_free((int)v38, (void (__fastcall *)(int))X509V3_conf_free);
goto LABEL_65;
}
v39 = v36[1];
v40 = 0;
do
{
v43 = OPENSSL_sk_num((int)v38);
v44 = v40;
if ( v40++ >= v43 )
{
OPENSSL_sk_pop_free((int)v38, (void (__fastcall *)(int))X509V3_conf_free);
goto LABEL_48;
}
v41 = OPENSSL_sk_value(v38, v44);
v42 = s2i_ASN1_INTEGER(0, *(_DWORD *)(v41 + 4));
if ( !v42 )
{
v21 = v7;
ERR_put_error(34, 133, 140, (int)"crypto/x509v3/v3_cpols.c", 339);
goto LABEL_67;
}
}
while ( OPENSSL_sk_push(v39, v42) );
v21 = v7;
ERR_put_error(34, 133, 65, (int)"crypto/x509v3/v3_cpols.c", 348);
LABEL_67:
OPENSSL_sk_pop_free((int)v39, (void (__fastcall *)(int))ASN1_STRING_free);
OPENSSL_sk_pop_free((int)v38, (void (__fastcall *)(int))X509V3_conf_free);
}
else
{
v21 = v7;
ERR_put_error(34, 132, 138, (int)"crypto/x509v3/v3_cpols.c", 306);
ERR_add_error_data(6, "section:", *v35, ",name:", v35[1], ",value:", v35[2]);
}
goto LABEL_65;
}
v28 = *v27;
if ( !*v27 )
{
v28 = (signed int **)NOTICEREF_new();
if ( !v28 )
goto LABEL_63;
*v27 = v28;
}
v29 = *v28;
v30 = (const char *)v35[2];
if ( v54 )
v31 = 22;
else
v31 = 26;
v29[1] = v31;
v32 = strlen(v30);
if ( !ASN1_STRING_set(v29, v30, v32) )
goto LABEL_63;
}
LABEL_48:
++v22;
}
v49 = *v27;
if ( *v27 && (!v49[1] || !*v49) )
{
v21 = v7;
ERR_put_error(34, 132, 142, (int)"crypto/x509v3/v3_cpols.c", 315);
goto LABEL_65;
}
X509V3_section_free(a2, (int)v23);
v50 = (int *)v7[1];
if ( !v50 )
{
v50 = OPENSSL_sk_new_null();
v7[1] = v50;
}
if ( !OPENSSL_sk_push(v50, (int)v56) )
goto LABEL_32;
}
else
{
if ( !v7[1] )
v7[1] = OPENSSL_sk_new_null();
v16 = POLICYQUALINFO_new();
if ( !v16 || !OPENSSL_sk_push((int *)v7[1], (int)v16) )
goto LABEL_32;
v17 = OBJ_nid2obj(0xA4u);
*v16 = v17;
if ( !v17 )
{
v21 = v7;
ERR_put_error(34, 131, 68, (int)"crypto/x509v3/v3_cpols.c", 191);
goto LABEL_33;
}
v18 = (signed int *)ASN1_IA5STRING_new();
v16[1] = v18;
if ( !v18 )
goto LABEL_32;
v19 = (const char *)v15[2];
v20 = strlen(v19);
if ( !ASN1_STRING_set(v18, v19, v20) )
goto LABEL_32;
}
++v11;
}
i = v58;
if ( *v7 )
{
X509V3_section_free(a2, (int)section);
goto LABEL_8;
}
v21 = v7;
ERR_put_error(34, 131, 139, (int)"crypto/x509v3/v3_cpols.c", 230);
}
else
{
LABEL_32:
v21 = v7;
ERR_put_error(34, 131, 65, (int)"crypto/x509v3/v3_cpols.c", 237);
}
LABEL_33:
POLICYINFO_free(v21);
X509V3_section_free(a2, (int)section);
}
else
{
ERR_put_error(34, 130, 135, (int)"crypto/x509v3/v3_cpols.c", 123);
ERR_add_error_data(6, "section:", *v9, ",name:", v9[1], ",value:", v9[2]);
}
LABEL_34:
OPENSSL_sk_pop_free((int)v53, (void (__fastcall *)(int))X509V3_conf_free);
OPENSSL_sk_pop_free((int)v57, (void (__fastcall *)(int))POLICYINFO_free);
return nullptr;
}