//
// SSL_load_client_CA_file from 0xd3ae5c to 0xd3b034 (472 bytes)
//
// 1 xrefs:
// > ??> @ 0x970b0
//
// 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 SSL_load_client_CA_file(__int64 a1)
{
__int64 v2; // x0
__int64 v3; // x22
__int64 v4; // x0
__int64 v5; // x21
__int64 v6; // x20
__int64 v7; // x19
__int64 subject_name; // x0
__int64 v9; // x0
__int64 v10; // x19
__int64 v11; // x0
__int64 v13; // x0
__int64 v14; // [xsp+48h] [xbp+48h] BYREF
v2 = BIO_s_file();
v3 = BIO_new(v2);
v14 = 0;
v4 = OPENSSL_LH_new(j_X509_NAME_hash, j_X509_NAME_cmp);
v5 = v4;
if ( !v3 || !v4 )
{
v6 = 0;
ERR_put_error(20, 185, 65, "ssl/ssl_cert.c", 580);
v7 = 0;
LABEL_15:
v13 = v7;
v10 = 0;
X509_NAME_free(v13);
OPENSSL_sk_pop_free(v6, X509_NAME_free);
BIO_free(v3);
X509_free(v14);
OPENSSL_LH_free(v5);
return v10;
}
v6 = 0;
if ( !(unsigned int)BIO_ctrl(v3, 108, 3, a1) )
{
v7 = 0;
goto LABEL_15;
}
v7 = 0;
while ( PEM_read_bio_X509(v3, &v14, 0, 0) )
{
while ( 1 )
{
if ( !v6 )
{
v6 = OPENSSL_sk_new_null();
if ( !v6 )
{
ERR_put_error(20, 185, 65, "ssl/ssl_cert.c", 593);
goto LABEL_15;
}
}
subject_name = X509_get_subject_name(v14);
v7 = subject_name;
if ( !subject_name )
goto LABEL_15;
v7 = X509_NAME_dup(subject_name);
if ( !v7 )
goto LABEL_15;
if ( !OPENSSL_LH_retrieve(v5, v7) )
break;
v9 = v7;
v7 = 0;
X509_NAME_free(v9);
if ( !PEM_read_bio_X509(v3, &v14, 0, 0) )
goto LABEL_11;
}
OPENSSL_LH_insert(v5, v7);
if ( !(unsigned int)OPENSSL_sk_push(v6, v7) )
goto LABEL_15;
}
LABEL_11:
v10 = v6;
BIO_free(v3);
X509_free(v14);
v11 = OPENSSL_LH_free(v5);
if ( v6 )
{
ERR_clear_error(v11);
return v6;
}
return v10;
}