//
// sub_D440A4 from 0xd440a4 to 0xd441e8 (324 bytes)
//
// 2 xrefs:
// > SSL_use_RSAPrivateKey @ 0xd445dc
// > SSL_CTX_use_RSAPrivateKey @ 0xd44ed0
//
// 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
//
__int64 __fastcall sub_D440A4(_QWORD *a1, __int64 a2)
{
int v4; // w0
__int64 v5; // x19
__int64 v6; // x0
__int64 v7; // x0
unsigned int v8; // w20
__int64 v9; // x0
_QWORD *v10; // x23
__int64 v11; // x19
__int64 v13; // x0
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 = a1[5 * v4 + 4];
if ( !v6 )
goto LABEL_6;
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 = &a1[5 * v5], (unsigned int)X509_check_private_key(v10[4], a2)) )
{
LABEL_6:
v8 = 1;
v11 = 5 * v5;
EVP_PKEY_free(a1[v11 + 5]);
EVP_PKEY_up_ref(a2);
a1[v11 + 5] = a2;
*a1 = &a1[v11 + 4];
return v8;
}
X509_free(v10[4]);
v10[4] = 0;
return 0;
}