//
// sub_DE8CAC from 0xde8cac to 0xde8e38 (396 bytes)
//
// 7 xrefs:
// > sub_DE8E38 @ 0xde8e40
// > sub_DE8E44 @ 0xde8e4c
// > X509_check_trust @ 0xde8f94
// > X509_TRUST_set_default @ 0xde8e54
// > X509_TRUST_set_default @ 0xde8e58
// > X509_check_trust @ 0xde8fa8
// > ??> @ 0x1239298
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_DE8CAC(int a1, __int64 a2, char a3)
{
__int64 *v3; // x20
unsigned int *v7; // x0
int v8; // w19
__int64 v9; // x0
bool v10; // cc
int v11; // w1
unsigned int *v12; // x0
int v13; // w19
__int64 v14; // x0
int v15; // w1
unsigned int v16; // w19
int v18; // w19
int v19; // w1
__int64 v20; // x0
int v21; // w0
int v22; // w1
__int64 v23; // x0
int v24; // w0
v3 = *(__int64 **)(a2 + 312);
if ( !v3 )
goto LABEL_31;
v7 = (unsigned int *)v3[1];
if ( !v7 )
{
v12 = (unsigned int *)*v3;
if ( !*v3 )
goto LABEL_31;
if ( (a3 & 0x10) != 0 )
{
LABEL_17:
v18 = 0;
while ( 1 )
{
v10 = v18 < (int)OPENSSL_sk_num(v12);
v19 = v18++;
if ( !v10 )
break;
v20 = OPENSSL_sk_value(*v3, v19);
v21 = OBJ_obj2nid(v20);
if ( v21 == a1 || v21 == 910 )
return 1;
v12 = (unsigned int *)*v3;
}
return 2;
}
LABEL_9:
v13 = 0;
while ( 1 )
{
v10 = v13 < (int)OPENSSL_sk_num(v12);
v15 = v13++;
if ( !v10 )
break;
v14 = OPENSSL_sk_value(*v3, v15);
if ( (unsigned int)OBJ_obj2nid(v14) == a1 )
return 1;
v12 = (unsigned int *)*v3;
}
return 2;
}
v8 = 0;
if ( (a3 & 0x10) != 0 )
{
while ( 1 )
{
v10 = v8 < (int)OPENSSL_sk_num(v7);
v22 = v8++;
if ( !v10 )
break;
v23 = OPENSSL_sk_value(v3[1], v22);
v24 = OBJ_obj2nid(v23);
if ( v24 == a1 || v24 == 910 )
return 2;
v7 = (unsigned int *)v3[1];
}
v12 = (unsigned int *)*v3;
if ( !*v3 )
goto LABEL_31;
goto LABEL_17;
}
while ( 1 )
{
v10 = v8 < (int)OPENSSL_sk_num(v7);
v11 = v8++;
if ( !v10 )
break;
v9 = OPENSSL_sk_value(v3[1], v11);
if ( (unsigned int)OBJ_obj2nid(v9) == a1 )
return 2;
v7 = (unsigned int *)v3[1];
}
v12 = (unsigned int *)*v3;
if ( *v3 )
goto LABEL_9;
LABEL_31:
v16 = 3;
if ( (a3 & 8) == 0 )
return v16;
X509_check_purpose(a2, 0xFFFFFFFFLL, 0);
if ( (a3 & 4) != 0 || (*(_DWORD *)(a2 + 208) & 0x2000) == 0 )
return v16;
return 1;
}