//
// SSL_use_PrivateKey from 0x79be88 to 0x79bff4 (364 bytes)
//
// 4 xrefs:
// > SSL_use_PrivateKey_file @ 0x79c0a8
// > SSL_use_PrivateKey_ASN1 @ 0x79c194
// > tls_prepare_client_certificate @ 0x7a4664
// > ??> @ 0x5c8dc
//
// 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_PrivateKey(int a1, int a2)
{
_DWORD *v3; // r6
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
if ( a2 )
{
v3 = *(_DWORD **)(a1 + 200);
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 = v3[5 * v4 + 5];
if ( !v7 )
goto LABEL_7;
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(v3[5 * v5 + 5], a2) )
{
LABEL_7:
v11 = &v3[5 * v5];
EVP_PKEY_free(v11[6]);
v9 = 1;
EVP_PKEY_up_ref(a2);
v11[6] = a2;
*v3 = v11 + 5;
return v9;
}
X509_free(v3[v6 + 5 + v5]);
v3[v6 + 5 + v5] = 0;
return 0;
}
else
{
ERR_put_error(20, 201, 67, "ssl/ssl_rsa.c", 231);
return 0;
}
}