//
// sub_9B015C from 0x9b015c to 0x9b02e4 (392 bytes)
//
// 2 xrefs:
// > SSL_use_certificate @ 0x9b05ac
// > SSL_CTX_use_certificate @ 0x9b0e5c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:06:56 +0000
//
int __fastcall sub_9B015C(_DWORD *a1, int a2)
{
int v4; // r9
int v5; // r0
int v6; // r8
int v7; // r1
int v8; // r0
_DWORD *v9; // r5
int can_sign; // r10
int v12; // r0
int v13; // r0
int v14; // r0
v4 = X509_get0_pubkey(a2);
if ( v4 )
{
v5 = ssl_cert_type(a2, v4);
v6 = v5;
if ( v5 < 0 )
{
ERR_put_error(20, 191, 247, "ssl/ssl_rsa.c", 324);
return 0;
}
else if ( v5 != 3 || (v14 = EVP_PKEY_get0_EC_KEY(v4), (can_sign = EC_KEY_can_sign(v14)) != 0) )
{
v7 = a1[5 * v6 + 6];
if ( v7 )
{
v8 = EVP_PKEY_copy_parameters(v4, v7);
ERR_clear_error(v8);
if ( EVP_PKEY_id(a1[5 * v6 + 6]) != 6 || (v12 = EVP_PKEY_get0_RSA(a1[5 * v6 + 6]), (RSA_flags(v12) & 1) == 0) )
{
if ( !X509_check_private_key(a2, a1[5 * v6 + 6]) )
{
v13 = EVP_PKEY_free(a1[5 * v6 + 6]);
a1[5 * v6 + 6] = 0;
ERR_clear_error(v13);
}
}
}
v9 = &a1[5 * v6];
X509_free(v9[5]);
can_sign = 1;
X509_up_ref(a2);
v9[5] = a2;
*a1 = v9 + 5;
}
else
{
ERR_put_error(20, 191, 318, "ssl/ssl_rsa.c", 329);
}
return can_sign;
}
else
{
ERR_put_error(20, 191, 268, "ssl/ssl_rsa.c", 318);
return 0;
}
}