//
// X509_load_crl_file from 0xde4b38 to 0xde4cec (436 bytes)
//
// 3 xrefs:
// > sub_BB78D0 @ 0xbb8110
// > sub_DE3F88 @ 0xde4260
// > ??> @ 0x45420
//
// 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 X509_load_crl_file(__int64 a1, __int64 a2, int a3)
{
void *v6; // x0
__int64 v7; // x0
_QWORD *v8; // x22
__int64 bio_X509_CRL; // x19
unsigned int v10; // w20
if ( !a2 )
return 1;
v6 = BIO_s_file();
v7 = BIO_new((__int64)v6);
v8 = (_QWORD *)v7;
if ( v7 && (int)BIO_ctrl(v7, 0x6Cu, 3, a2) > 0 )
{
if ( a3 == 1 )
{
v10 = 0;
while ( 1 )
{
bio_X509_CRL = PEM_read_bio_X509_CRL((__int64)v8, 0, 0, 0);
if ( !bio_X509_CRL )
break;
++v10;
if ( !(unsigned int)X509_STORE_add_crl(*(_QWORD *)(a1 + 24), bio_X509_CRL) )
{
v10 = 0;
goto LABEL_7;
}
X509_CRL_free(bio_X509_CRL);
}
if ( (ERR_peek_last_error() & 0xFFF) == 0x6C && v10 )
{
ERR_clear_error();
}
else
{
v10 = 0;
ERR_put_error(11, 112, 9, (__int64)"crypto/x509/by_file.c", 157);
}
}
else if ( a3 == 2 )
{
bio_X509_CRL = d2i_X509_CRL_bio(v8, 0);
if ( bio_X509_CRL )
{
v10 = X509_STORE_add_crl(*(_QWORD *)(a1 + 24), bio_X509_CRL);
}
else
{
v10 = 0;
ERR_put_error(11, 112, 13, (__int64)"crypto/x509/by_file.c", 172);
}
}
else
{
bio_X509_CRL = 0;
v10 = 0;
ERR_put_error(11, 112, 100, (__int64)"crypto/x509/by_file.c", 180);
}
}
else
{
bio_X509_CRL = 0;
ERR_put_error(11, 112, 2, (__int64)"crypto/x509/by_file.c", 144);
v10 = 0;
}
LABEL_7:
X509_CRL_free(bio_X509_CRL);
BIO_free(v8);
return v10;
}