//
// SSL_CTX_use_PrivateKey_file from 0x79c8d0 to 0x79ca20 (336 bytes)
//
// 11 xrefs:
// > sub_643938 @ 0x643fd4
// > sub_643938 @ 0x644394
// > sub_7BB490 @ 0x7bb4bc
// > SSL_CONF_CTX_finish @ 0x7bccac
// > SSL_CONF_CTX_finish @ 0x7bcd14
// > SSL_CONF_CTX_finish @ 0x7bcd60
// > SSL_CONF_CTX_finish @ 0x7bcdac
// > SSL_CONF_CTX_finish @ 0x7bcdf8
// > SSL_CONF_CTX_finish @ 0x7bce44
// > SSL_CONF_CTX_finish @ 0x7bce90
// > ??> @ 0x5527c
//
// 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_PrivateKey_file(int a1, int a2, int a3)
{
int v6; // r0
int v7; // r0
int v8; // r5
int v9; // r4
int v11; // r0
int v12; // r2
int v13; // r6
int bio_PrivateKey; // r0
v6 = BIO_s_file();
v7 = BIO_new(v6);
v8 = v7;
if ( !v7 )
{
ERR_put_error(20, 176, 7, "ssl/ssl_rsa.c", 531);
v9 = 0;
goto LABEL_6;
}
if ( BIO_ctrl(v7, 108, 3, a2) <= 0 )
{
ERR_put_error(20, 176, 2, "ssl/ssl_rsa.c", 536);
v9 = 0;
goto LABEL_6;
}
if ( a3 == 1 )
{
bio_PrivateKey = PEM_read_bio_PrivateKey(v8, 0, *(_DWORD *)(a1 + 108), *(_DWORD *)(a1 + 112));
v12 = 9;
v13 = bio_PrivateKey;
}
else
{
if ( a3 != 2 )
{
ERR_put_error(20, 176, 124, "ssl/ssl_rsa.c", 548);
v9 = 0;
goto LABEL_6;
}
v11 = d2i_PrivateKey_bio(v8, 0);
v12 = 13;
v13 = v11;
}
if ( v13 )
{
v9 = SSL_CTX_use_PrivateKey(a1, v13);
EVP_PKEY_free(v13);
}
else
{
v9 = 0;
ERR_put_error(20, 176, v12, "ssl/ssl_rsa.c", 552);
}
LABEL_6:
BIO_free(v8);
return v9;
}