//
// X509_load_crl_file from 0x83cca0 to 0x83ce5c (444 bytes)
//
// 3 xrefs:
// > sub_643938 @ 0x643ed6
// > sub_83C074 @ 0x83c2d8
// > ??> @ 0x5525c
//
// 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 X509_load_crl_file(int a1, int a2, int a3)
{
void *v6; // r0
_DWORD *v7; // r0
_DWORD *v8; // r7
int bio_X509_CRL; // r5
int v10; // r4
_BOOL4 v12; // r0
if ( !a2 )
return 1;
v6 = BIO_s_file();
v7 = BIO_new((int)v6);
v8 = v7;
if ( v7 && BIO_ctrl(v7, 108, 3, a2) > 0 )
{
if ( a3 == 1 )
{
v10 = 0;
while ( 1 )
{
bio_X509_CRL = PEM_read_bio_X509_CRL((int)v8, 0, 0, 0);
if ( !bio_X509_CRL )
break;
++v10;
if ( !X509_STORE_add_crl(*(_DWORD *)(a1 + 16), bio_X509_CRL) )
{
v10 = 0;
goto LABEL_7;
}
X509_CRL_free(bio_X509_CRL);
}
v12 = ERR_peek_last_error() << 20 == 113246208;
if ( !v10 )
v12 = 0;
if ( v12 )
{
ERR_clear_error();
}
else
{
ERR_put_error(11, 112, 9, (int)"crypto/x509/by_file.c", 157);
v10 = 0;
}
}
else if ( a3 == 2 )
{
bio_X509_CRL = d2i_X509_CRL_bio(v8, 0);
if ( bio_X509_CRL )
{
v10 = X509_STORE_add_crl(*(_DWORD *)(a1 + 16), bio_X509_CRL);
}
else
{
ERR_put_error(11, 112, 13, (int)"crypto/x509/by_file.c", 172);
v10 = 0;
}
}
else
{
ERR_put_error(11, 112, 100, (int)"crypto/x509/by_file.c", 180);
bio_X509_CRL = 0;
v10 = 0;
}
}
else
{
bio_X509_CRL = 0;
ERR_put_error(11, 112, 2, (int)"crypto/x509/by_file.c", 144);
v10 = 0;
}
LABEL_7:
X509_CRL_free(bio_X509_CRL);
BIO_free(v8);
return v10;
}