//
// SSL_CTX_use_PrivateKey from 0xfc34bc to 0xfc3640 (388 bytes)
//
// 5 xrefs:
// > sub_E2DA90 @ 0xe2eafc
// > sub_E2DA90 @ 0xe2ec7c
// > SSL_CTX_use_PrivateKey_file @ 0xfc36f0
// > SSL_CTX_use_PrivateKey_ASN1 @ 0xfc37f0
// > ??> @ 0x56248
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:22 +0000
//
__int64 __fastcall SSL_CTX_use_PrivateKey(__int64 a1, __int64 a2)
{
_QWORD *v3; // x22
int v4; // w0
__int64 v5; // x19
__int64 v6; // x0
__int64 v7; // x0
unsigned int v8; // w21
__int64 v9; // x0
_QWORD *v10; // x23
__int64 v11; // x19
__int64 v13; // x0
if ( a2 )
{
v3 = *(_QWORD **)(a1 + 288);
v4 = ssl_cert_type(0, a2);
if ( v4 < 0 )
{
v8 = 0;
ERR_put_error(20, 193, 247, "ssl/ssl_rsa.c", 126);
return v8;
}
v5 = v4;
v6 = v3[5 * v4 + 4];
if ( !v6 )
goto LABEL_7;
v7 = X509_get0_pubkey(v6);
v8 = v7;
if ( !v7 )
{
ERR_put_error(20, 193, 65, "ssl/ssl_rsa.c", 134);
return v8;
}
if ( (v9 = EVP_PKEY_copy_parameters(v7, a2), ERR_clear_error(v9), (unsigned int)EVP_PKEY_id(a2) == 6)
&& (v13 = EVP_PKEY_get0_RSA(a2), (RSA_flags(v13) & 1) != 0)
|| (v10 = &v3[5 * v5], (unsigned int)X509_check_private_key(v10[4], a2)) )
{
LABEL_7:
v8 = 1;
v11 = 5 * v5;
EVP_PKEY_free(v3[v11 + 5]);
EVP_PKEY_up_ref(a2);
v3[v11 + 5] = a2;
*v3 = &v3[v11 + 4];
return v8;
}
X509_free(v10[4]);
v10[4] = 0;
return 0;
}
else
{
ERR_put_error(20, 174, 67, "ssl/ssl_rsa.c", 517);
return 0;
}
}