//
// sub_79B6F4 from 0x79b6f4 to 0x79b828 (308 bytes)
//
// 2 xrefs:
// > SSL_use_RSAPrivateKey @ 0x79bc14
// > SSL_CTX_use_RSAPrivateKey @ 0x79c4d8
//
// 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 sub_79B6F4(_DWORD *a1, int a2)
{
int v4; // r0
int v5; // r7
int v6; // r4
int v7; // r0
int v8; // r0
int v9; // r9
int v10; // r0
_DWORD *v11; // r7
int v13; // r0
v4 = ssl_cert_type(0, a2);
v5 = v4;
if ( v4 < 0 )
{
ERR_put_error(20, 193, 247, "ssl/ssl_rsa.c", 126);
return 0;
}
v6 = 4 * v4;
v7 = a1[5 * v4 + 5];
if ( !v7 )
goto LABEL_6;
v8 = X509_get0_pubkey(v7);
v9 = v8;
if ( !v8 )
{
ERR_put_error(20, 193, 65, "ssl/ssl_rsa.c", 134);
return v9;
}
if ( (v10 = EVP_PKEY_copy_parameters(v8, a2), ERR_clear_error(v10), EVP_PKEY_id(a2) == 6)
&& (v13 = EVP_PKEY_get0_RSA(a2), (RSA_flags(v13) & 1) != 0)
|| X509_check_private_key(a1[5 * v5 + 5], a2) )
{
LABEL_6:
v11 = &a1[5 * v5];
EVP_PKEY_free(v11[6]);
v9 = 1;
EVP_PKEY_up_ref(a2);
v11[6] = a2;
*a1 = v11 + 5;
return v9;
}
X509_free(a1[v6 + 5 + v5]);
a1[v6 + 5 + v5] = 0;
return 0;
}