//
// sub_A5579C from 0xa5579c to 0xa55924 (392 bytes)
//
// 7 xrefs:
// > sub_A55928 @ 0xa55930
// > sub_A55934 @ 0xa5593c
// > X509_check_trust @ 0xa55a7c
// > X509_TRUST_set_default @ 0xa55948
// > X509_TRUST_set_default @ 0xa5594c
// > X509_check_trust @ 0xa55a94
// > ??> @ 0xd26138
//
// 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:26 +0000
//
int __fastcall sub_A5579C(char *a1, int a2, char a3)
{
int *v3; // r5
int v7; // r0
signed int v8; // r4
signed int v9; // r4
int v10; // r0
int v11; // r0
int v13; // r0
unsigned int v14; // r1
bool v15; // cc
int v16; // r0
char *v17; // r0
signed int v18; // r4
int v19; // r0
signed int v20; // r4
int v21; // r0
unsigned int v22; // r1
int v23; // r0
char *v24; // r0
v3 = *(int **)(a2 + 180);
if ( !v3 )
goto LABEL_10;
v7 = v3[1];
if ( !v7 )
{
v11 = *v3;
if ( !*v3 )
goto LABEL_10;
if ( (a3 & 0x10) != 0 )
{
LABEL_29:
v20 = 0;
while ( 1 )
{
v21 = OPENSSL_sk_num(v11);
v22 = v20;
v15 = v20++ < v21;
if ( !v15 )
break;
v23 = OPENSSL_sk_value((_DWORD *)*v3, v22);
v24 = OBJ_obj2nid(v23);
if ( v24 == a1 || v24 == (_BYTE *)&stru_38C.st_name + 2 )
return 1;
v11 = *v3;
}
return 2;
}
LABEL_20:
v18 = 0;
while ( v18 < OPENSSL_sk_num(v11) )
{
v19 = OPENSSL_sk_value((_DWORD *)*v3, v18++);
if ( OBJ_obj2nid(v19) == a1 )
return 1;
v11 = *v3;
}
return 2;
}
v8 = a3 & 0x10;
if ( (a3 & 0x10) == 0 )
{
while ( v8 < OPENSSL_sk_num(v7) )
{
v10 = OPENSSL_sk_value((_DWORD *)v3[1], v8++);
if ( OBJ_obj2nid(v10) == a1 )
return 2;
v7 = v3[1];
}
v11 = *v3;
if ( !*v3 )
goto LABEL_10;
goto LABEL_20;
}
v9 = 0;
while ( 1 )
{
v13 = OPENSSL_sk_num(v7);
v14 = v9;
v15 = v9++ < v13;
if ( !v15 )
break;
v16 = OPENSSL_sk_value((_DWORD *)v3[1], v14);
v17 = OBJ_obj2nid(v16);
if ( v17 == a1 || v17 == (_BYTE *)&stru_38C.st_name + 2 )
return 2;
v7 = v3[1];
}
v11 = *v3;
if ( *v3 )
goto LABEL_29;
LABEL_10:
if ( (a3 & 8) != 0 && (X509_check_purpose(a2, -1, 0), (a3 & 4) == 0) && (*(_DWORD *)(a2 + 112) & 0x2000) != 0 )
return 1;
else
return 3;
}