//
// SSL_CTX_use_certificate_file from 0x79c294 to 0x79c3f0 (348 bytes)
//
// 2 xrefs:
// > sub_643938 @ 0x64409c
// > ??> @ 0x552ac
//
// 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 SSL_CTX_use_certificate_file(int a1, int a2, int a3)
{
int v6; // r0
int v7; // r0
int v8; // r5
int v9; // r4
int v10; // r6
int bio_X509; // r0
int v13; // r2
int v14; // r0
v6 = BIO_s_file();
v7 = BIO_new(v6);
v8 = v7;
if ( !v7 )
{
ERR_put_error(20, 173, 7, "ssl/ssl_rsa.c", 381);
v9 = 0;
v10 = 0;
goto LABEL_6;
}
if ( BIO_ctrl(v7, 108, 3, a2) <= 0 )
{
v9 = 0;
ERR_put_error(20, 173, 2, "ssl/ssl_rsa.c", 386);
v10 = 0;
goto LABEL_6;
}
if ( a3 == 2 )
{
v14 = d2i_X509_bio(v8, 0);
v13 = 13;
v9 = v14;
}
else
{
if ( a3 != 1 )
{
ERR_put_error(20, 173, 124, "ssl/ssl_rsa.c", 397);
v9 = 0;
v10 = 0;
goto LABEL_6;
}
bio_X509 = PEM_read_bio_X509(v8, 0, *(_DWORD *)(a1 + 108), *(_DWORD *)(a1 + 112));
v13 = 9;
v9 = bio_X509;
}
if ( v9 )
{
v10 = SSL_CTX_use_certificate(a1, v9);
}
else
{
ERR_put_error(20, 173, v13, "ssl/ssl_rsa.c", 402);
v10 = 0;
}
LABEL_6:
X509_free(v9);
BIO_free(v8);
return v10;
}