//
// sub_8566F0 from 0x8566f0 to 0x856b38 (1096 bytes)
//
// 1 xrefs:
// > ??> @ 0xab3d6c
//
// 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 sub_8566F0(int a1, int a2, _DWORD *a3)
{
int *v4; // r10
signed int i; // r4
int *v6; // r5
int v7; // r2
int v8; // r3
int v9; // r2
int v10; // r3
int v11; // r2
int v12; // r3
int v13; // r2
int v14; // r3
int v15; // r0
const char *v16; // r6
_DWORD *v17; // r7
int v18; // r0
_BYTE *v19; // r9
int *section; // r6
int v21; // r7
_DWORD *v22; // r0
int **v23; // r9
int v24; // r0
int v25; // r6
int v26; // r7
int v27; // r0
v4 = (int *)ISSUING_DIST_POINT_new();
if ( !v4 )
{
ERR_put_error(34, 157, 65, (int)"crypto/x509v3/v3_crld.c", 406);
goto LABEL_34;
}
for ( i = 0; ; ++i )
{
if ( i >= OPENSSL_sk_num((int)a3) )
return v4;
v15 = OPENSSL_sk_value(a3, i);
v16 = *(const char **)(v15 + 4);
v17 = (_DWORD *)v15;
v18 = strncmp(v16, "fullname", 9u);
v19 = (_BYTE *)v17[2];
if ( v18 )
break;
if ( *v19 == 64 )
{
section = (int *)X509V3_get_section(a2);
if ( !section )
{
LABEL_36:
ERR_put_error(34, 156, 150, (int)"crypto/x509v3/v3_crld.c", 55);
v6 = section;
goto LABEL_33;
}
}
else
{
section = (int *)X509V3_parse_list(v17[2]);
if ( !section )
goto LABEL_36;
}
v6 = v2i_GENERAL_NAMES(0, a2, section);
if ( *v19 == 64 )
X509V3_section_free(a2, (int)section);
else
OPENSSL_sk_pop_free((int)section, (void (__fastcall *)(int))X509V3_conf_free);
if ( !v6 )
{
section = nullptr;
goto LABEL_33;
}
v21 = *v4;
section = nullptr;
if ( *v4 )
goto LABEL_32;
LABEL_19:
v22 = DIST_POINT_NAME_new();
*v4 = (int)v22;
if ( !v22 )
goto LABEL_33;
if ( v6 )
v22[1] = v6;
else
v21 = 1;
if ( !v6 )
v22[1] = section;
*v22 = v21;
LABEL_10:
;
}
v6 = (int *)strcmp(v16, "relativename");
if ( !v6 )
{
v23 = (int **)X509_NAME_new();
if ( !v23 )
goto LABEL_34;
v24 = X509V3_get_section(a2);
v25 = v24;
if ( !v24 )
{
ERR_put_error(34, 158, 150, (int)"crypto/x509v3/v3_crld.c", 86);
goto LABEL_34;
}
v26 = X509V3_NAME_from_section(v23, v24, 4097);
X509V3_section_free(a2, v25);
section = *v23;
*v23 = nullptr;
X509_NAME_free(v23);
if ( !v26 )
{
v6 = nullptr;
goto LABEL_33;
}
if ( OPENSSL_sk_num((int)section) <= 0 )
goto LABEL_33;
v27 = OPENSSL_sk_num((int)section);
if ( *(_DWORD *)(OPENSSL_sk_value(section, v27 - 1) + 8) )
{
ERR_put_error(34, 158, 161, (int)"crypto/x509v3/v3_crld.c", 102);
goto LABEL_33;
}
v21 = *v4;
v6 = nullptr;
if ( *v4 )
{
LABEL_32:
ERR_put_error(34, 158, 160, (int)"crypto/x509v3/v3_crld.c", 110);
LABEL_33:
OPENSSL_sk_pop_free((int)v6, (void (__fastcall *)(int))GENERAL_NAME_free);
OPENSSL_sk_pop_free((int)section, (void (__fastcall *)(int))X509_NAME_ENTRY_free);
goto LABEL_34;
}
goto LABEL_19;
}
if ( !strcmp(v16, "onlyuser") )
{
if ( !X509V3_get_value_bool(v17, v4 + 1, v7, v8) )
goto LABEL_34;
goto LABEL_10;
}
if ( !strcmp(v16, "onlyCA") )
{
if ( !X509V3_get_value_bool(v17, v4 + 2, v9, v10) )
goto LABEL_34;
goto LABEL_10;
}
if ( !strcmp(v16, "onlyAA") )
{
if ( !X509V3_get_value_bool(v17, v4 + 5, v11, v12) )
goto LABEL_34;
goto LABEL_10;
}
if ( !strcmp(v16, "indirectCRL") )
{
if ( !X509V3_get_value_bool(v17, v4 + 4, v13, v14) )
goto LABEL_34;
goto LABEL_10;
}
if ( !strcmp(v16, "onlysomereasons") )
{
if ( !sub_855828(v4 + 3, (int)v19) )
goto LABEL_34;
goto LABEL_10;
}
ERR_put_error(34, 157, 106, (int)"crypto/x509v3/v3_crld.c", 398);
ERR_add_error_data(6, "section:", *v17, ",name:", v17[1], ",value:", v17[2]);
LABEL_34:
ISSUING_DIST_POINT_free(v4);
return nullptr;
}