//
// sub_A6D080 from 0xa6d080 to 0xa6d8b4 (2100 bytes)
//
// 2 xrefs:
// > sub_A6D99C @ 0xa6d9ec
// > sub_A6D99C @ 0xa6da74
//
// 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:40 +0000
//
int __fastcall sub_A6D080(_DWORD *a1, char ***a2, _DWORD *a3, int *a4)
{
const char *v4; // r7
_DWORD *v10; // r8
const char *v11; // r7
int v12; // r9
void *v13; // r8
void *v14; // r0
int v15; // lr
size_t v16; // r12
char **v17; // r0
size_t v18; // r12
void *v19; // r1
void *v20; // r0
void *v21; // r0
int v22; // r3
int v23; // r1
int v24; // r1
size_t v25; // r3
_DWORD *v26; // r8
int v27; // r0
size_t v28; // r11
void *v29; // r0
int v30; // r3
int v31; // r1
size_t v32; // r12
int v33; // r0
int v34; // r3
int v35; // [sp+14h] [bp-808h]
size_t v36[513]; // [sp+18h] [bp-804h] BYREF
v4 = (const char *)a1[1];
if ( !strcmp(v4, "language") )
{
if ( *a2 )
{
ERR_put_error(34, 150, 155, (int)"crypto/x509v3/v3_pci.c", 90);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
return 0;
}
v17 = OBJ_txt2obj((char *)a1[2], 0);
*a2 = v17;
if ( !v17 )
{
ERR_put_error(34, 150, 110, (int)"crypto/x509v3/v3_pci.c", 96);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
return 0;
}
return 1;
}
if ( !strcmp(v4, "pathlen") )
{
if ( *a3 )
{
ERR_put_error(34, 150, 157, (int)"crypto/x509v3/v3_pci.c", 103);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
return 0;
}
if ( !X509V3_get_value_int(a1, a3) )
{
ERR_put_error(34, 150, 156, (int)"crypto/x509v3/v3_pci.c", 109);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
return 0;
}
}
else if ( !strcmp(v4, "policy") )
{
v10 = (_DWORD *)*a4;
if ( *a4 )
{
v35 = 0;
}
else
{
v33 = ASN1_OCTET_STRING_new();
if ( v33 )
v34 = 1;
v10 = (_DWORD *)v33;
*a4 = v33;
if ( !v33 )
{
ERR_put_error(34, 150, 65, (int)"crypto/x509v3/v3_pci.c", 119);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
return 0;
}
v35 = v34;
}
v11 = (const char *)a1[2];
if ( !strncmp(v11, "hex:", 4u) )
{
v13 = (void *)OPENSSL_hexstr2buf(v11 + 4, v36);
if ( v13 )
{
v14 = CRYPTO_realloc(
*(void **)(*a4 + 8),
(void *)(*(_DWORD *)*a4 + v36[0] + 1),
(int)"crypto/x509v3/v3_pci.c",
135);
if ( v14 )
{
*(_DWORD *)(*a4 + 8) = v14;
memcpy((void *)(*(_DWORD *)(*a4 + 8) + *(_DWORD *)*a4), v13, v36[0]);
v15 = *(_DWORD *)(*a4 + 8);
v16 = *(_DWORD *)*a4 + v36[0];
*(_DWORD *)*a4 = v16;
*(_BYTE *)(v15 + v16) = 0;
CRYPTO_free(v13, (int)"crypto/x509v3/v3_pci.c", 155);
return 1;
}
CRYPTO_free(v13, (int)"crypto/x509v3/v3_pci.c", 143);
CRYPTO_free(*(void **)(*a4 + 8), (int)"crypto/x509v3/v3_pci.c", 148);
*(_DWORD *)(*a4 + 8) = 0;
*(_DWORD *)*a4 = 0;
ERR_put_error(34, 150, 65, (int)"crypto/x509v3/v3_pci.c", 151);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
}
else
{
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
}
}
else
{
v12 = strncmp(v11, "file:", 5u);
if ( v12 )
{
if ( !strncmp(v11, "text:", 5u) )
{
v18 = strlen(v11 + 5);
v19 = (void *)(v18 + *v10 + 1);
v20 = (void *)v10[2];
v36[0] = v18;
v21 = CRYPTO_realloc(v20, v19, (int)"crypto/x509v3/v3_pci.c", 199);
v22 = *a4;
if ( v21 )
{
v23 = a1[2];
*(_DWORD *)(v22 + 8) = v21;
memcpy((void *)(*(_DWORD *)(*a4 + 8) + *(_DWORD *)*a4), (const void *)(v23 + 5), v36[0]);
v24 = *(_DWORD *)(*a4 + 8);
v25 = *(_DWORD *)*a4 + v36[0];
*(_DWORD *)*a4 = v25;
*(_BYTE *)(v24 + v25) = 0;
return 1;
}
CRYPTO_free(*(void **)(v22 + 8), (int)"crypto/x509v3/v3_pci.c", 211);
*(_DWORD *)(*a4 + 8) = 0;
*(_DWORD *)*a4 = 0;
ERR_put_error(34, 150, 65, (int)"crypto/x509v3/v3_pci.c", 214);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
}
else
{
ERR_put_error(34, 150, 152, (int)"crypto/x509v3/v3_pci.c", 220);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
}
}
else
{
v26 = BIO_new_file(v11 + 5, "r");
if ( v26 )
{
do
{
while ( 1 )
{
v27 = BIO_read((int)v26, (int)v36, 2048);
v28 = v27;
if ( v27 <= 0 )
break;
v29 = CRYPTO_realloc(
*(void **)(*a4 + 8),
(void *)(v27 + *(_DWORD *)*a4 + 1),
(int)"crypto/x509v3/v3_pci.c",
171);
v30 = *a4;
v12 = (int)v29;
if ( !v29 )
{
CRYPTO_free(*(void **)(v30 + 8), (int)"crypto/x509v3/v3_pci.c", 174);
*(_DWORD *)(*a4 + 8) = 0;
*(_DWORD *)*a4 = 0;
ERR_put_error(34, 150, 65, (int)"crypto/x509v3/v3_pci.c", 178);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
BIO_free_all((int)v26);
goto LABEL_16;
}
*(_DWORD *)(v30 + 8) = v29;
memcpy((void *)(*(_DWORD *)(*a4 + 8) + *(_DWORD *)*a4), v36, v28);
v31 = *(_DWORD *)(*a4 + 8);
v32 = v28 + *(_DWORD *)*a4;
*(_DWORD *)*a4 = v32;
*(_BYTE *)(v31 + v32) = 0;
}
if ( v27 )
{
BIO_free_all((int)v26);
ERR_put_error(34, 150, 32, (int)"crypto/x509v3/v3_pci.c", 192);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
goto LABEL_16;
}
}
while ( BIO_test_flags((int)v26, 8) );
BIO_free_all((int)v26);
if ( v12 )
return 1;
ERR_put_error(34, 150, 65, (int)"crypto/x509v3/v3_pci.c", 225);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
}
else
{
ERR_put_error(34, 150, 32, (int)"crypto/x509v3/v3_pci.c", 161);
ERR_add_error_data(6, "section:", *a1, ",name:", a1[1], ",value:", a1[2]);
}
}
}
LABEL_16:
if ( v35 )
{
ASN1_OCTET_STRING_free(*a4);
*a4 = 0;
}
return 0;
}
return 1;
}