//
// X509v3_asid_validate_resource_set from 0x853548 to 0x8537f0 (680 bytes)
//
// 1 xrefs:
// > ??> @ 0x68b4c
//
// 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
//
int __fastcall X509v3_asid_validate_resource_set(_DWORD *a1, int *a2, int a3)
{
int v6; // r9
_DWORD *v7; // r8
int v8; // r10
int v9; // r7
int v10; // r6
signed int i; // r4
int *v12; // r2
int v13; // r3
_DWORD *v14; // r3
int v15; // r0
int v16; // r0
int result; // r0
bool v18; // zf
_DWORD *v19; // r3
int *v20; // r3
if ( !a2 )
return 1;
if ( !a1 || !OPENSSL_sk_num((int)a1) || !a3 && X509v3_asid_inherits(a2) )
return 0;
if ( OPENSSL_sk_num((int)a1) <= 0 )
OPENSSL_die("assertion failed: chain != NULL && sk_X509_num(chain) > 0", "crypto/x509v3/v3_asid.c", 718);
if ( !X509v3_asid_is_canonical((int)a2) )
return 0;
v6 = *a2;
if ( *a2 )
{
v7 = *(_DWORD **)v6;
if ( !*(_DWORD *)v6 )
{
v6 = 1;
goto LABEL_13;
}
if ( v7 == (int *)((char *)&dword_0 + 1) )
{
v7 = *(_DWORD **)(v6 + 4);
v6 = 0;
goto LABEL_13;
}
v6 = 0;
}
v7 = (_DWORD *)v6;
LABEL_13:
v8 = a2[1];
if ( !v8 )
goto LABEL_50;
v9 = *(_DWORD *)v8;
if ( *(_DWORD *)v8 )
{
if ( v9 == 1 )
{
v9 = *(_DWORD *)(v8 + 4);
v8 = 0;
goto LABEL_18;
}
v8 = 0;
LABEL_50:
v9 = v8;
goto LABEL_18;
}
v8 = 1;
LABEL_18:
v10 = 0;
for ( i = 0; i < OPENSSL_sk_num((int)a1); ++i )
{
v15 = OPENSSL_sk_value(a1, i);
v10 = v15;
if ( !v15 )
OPENSSL_die("assertion failed: x != NULL", "crypto/x509v3/v3_asid.c", 766);
v16 = *(_DWORD *)(v15 + 156);
if ( !v16 )
{
v18 = v7 == nullptr;
if ( !v7 )
v18 = v9 == 0;
v9 = !v18;
if ( !v18 )
return 0;
v7 = (_DWORD *)v9;
continue;
}
if ( !X509v3_asid_is_canonical(v16) )
return 0;
v12 = *(int **)(v10 + 156);
v13 = *v12;
if ( *v12 )
{
if ( *(_DWORD *)v13 == 1 )
{
if ( !v6 )
{
if ( !sub_851F04(*(_DWORD **)(v13 + 4), v7) )
return 0;
v12 = *(int **)(v10 + 156);
v13 = *v12;
}
v7 = *(_DWORD **)(v13 + 4);
v14 = (_DWORD *)v12[1];
v6 = 0;
if ( v14 )
{
LABEL_22:
if ( *v14 == 1 )
{
if ( !v8 )
{
if ( !sub_851F04((_DWORD *)v14[1], (_DWORD *)v9) )
return 0;
v14 = *(_DWORD **)(*(_DWORD *)(v10 + 156) + 4);
}
v9 = v14[1];
v8 = 0;
}
continue;
}
goto LABEL_39;
}
}
else if ( v7 )
{
return 0;
}
v14 = (_DWORD *)v12[1];
if ( v14 )
goto LABEL_22;
LABEL_39:
if ( v9 )
return 0;
}
if ( !v10 )
OPENSSL_die("assertion failed: x != NULL", "crypto/x509v3/v3_asid.c", 812);
v19 = *(_DWORD **)(v10 + 156);
if ( !v19 )
return 1;
if ( *v19 && !*(_DWORD *)*v19 )
return 0;
v20 = (int *)v19[1];
if ( !v20 )
return 1;
result = *v20;
if ( *v20 )
return 1;
return result;
}