//
// SSL_add_file_cert_subjects_to_stack from 0xfb9388 to 0xfb94cc (324 bytes)
//
// 3 xrefs:
// > SSL_add_dir_cert_subjects_to_stack @ 0xfb9554
// > sub_FE0038 @ 0xfe0058
// > ??> @ 0x7f3c0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:16 +0000
//
__int64 __fastcall SSL_add_file_cert_subjects_to_stack(__int64 a1, __int64 a2)
{
__int64 v4; // x23
__int64 v5; // x0
__int64 v6; // x0
__int64 v7; // x21
__int64 v8; // x0
__int64 subject_name; // x0
__int64 v10; // x19
unsigned int v11; // w19
__int64 v12; // x0
__int64 v14; // [xsp+48h] [xbp+48h] BYREF
v14 = 0;
v4 = OPENSSL_sk_set_cmp_func(a1, sub_FB8020);
v5 = BIO_s_file();
v6 = BIO_new(v5);
v7 = v6;
if ( !v6 )
{
v11 = 0;
ERR_put_error(20, 216, 65, "ssl/ssl_cert.c", 651);
goto LABEL_12;
}
if ( !(unsigned int)BIO_ctrl(v6, 108, 3, a2) )
goto LABEL_11;
LABEL_3:
v8 = PEM_read_bio_X509(v7, &v14, 0, 0);
if ( v8 )
{
while ( 1 )
{
subject_name = X509_get_subject_name(v14);
if ( !subject_name )
break;
v10 = X509_NAME_dup(subject_name);
if ( !v10 )
break;
if ( (OPENSSL_sk_find(a1, v10) & 0x80000000) != 0 )
{
if ( (unsigned int)OPENSSL_sk_push(a1, v10) )
goto LABEL_3;
v12 = v10;
v11 = 0;
X509_NAME_free(v12);
goto LABEL_12;
}
X509_NAME_free(v10);
v8 = PEM_read_bio_X509(v7, &v14, 0, 0);
if ( !v8 )
goto LABEL_8;
}
LABEL_11:
v11 = 0;
goto LABEL_12;
}
LABEL_8:
v11 = 1;
ERR_clear_error(v8);
LABEL_12:
BIO_free(v7);
X509_free(v14);
OPENSSL_sk_set_cmp_func(a1, v4);
return v11;
}