//
// SSL_use_certificate_file from 0x79b9e0 to 0x79bb40 (352 bytes)
//
// 1 xrefs:
// > ??> @ 0x5c81c
//
// 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_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, 200, 7, "ssl/ssl_rsa.c", 45);
v9 = 0;
v10 = 0;
goto LABEL_6;
}
if ( BIO_ctrl(v7, 108, 3, a2) <= 0 )
{
v9 = 0;
ERR_put_error(20, 200, 2, "ssl/ssl_rsa.c", 50);
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, 200, 124, "ssl/ssl_rsa.c", 61);
v9 = 0;
v10 = 0;
goto LABEL_6;
}
bio_X509 = PEM_read_bio_X509(
v8,
0,
*(_DWORD *)(*(_DWORD *)(a1 + 276) + 108),
*(_DWORD *)(*(_DWORD *)(a1 + 276) + 112));
v13 = 9;
v9 = bio_X509;
}
if ( v9 )
{
v10 = SSL_use_certificate(a1, v9);
}
else
{
ERR_put_error(20, 200, v13, "ssl/ssl_rsa.c", 66);
v10 = 0;
}
LABEL_6:
X509_free(v9);
BIO_free(v8);
return v10;
}