//
// ssl_security_cert from 0x9c9874 to 0x9c9a30 (444 bytes)
//
// 8 xrefs:
// > ssl_cert_set0_chain @ 0x9a5e80
// > ssl_cert_add0_chain_cert @ 0x9a5fa8
// > ssl_build_cert_chain @ 0x9a71c8
// > SSL_use_certificate @ 0x9b0564
// > SSL_CTX_use_certificate @ 0x9b0e14
// > ssl_security_cert_chain @ 0x9c9a88
// > ssl_security_cert_chain @ 0x9c9ab8
// > ??> @ 0x74cac
//
// 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:07:08 +0000
//
int __fastcall ssl_security_cert(int a1, int a2, int a3, int a4, int a5)
{
int v5; // r8
int v6; // r7
int v7; // r5
int v11; // r0
int v12; // r2
int v13; // r0
int signature_nid; // r0
int v16; // r3
int v17; // r2
int v18; // r0
int v19; // r0
int v20; // r2
int v21; // r0
int sigid_algs; // r0
int v23; // r0
int digestbyname; // r0
int v25; // r0
int v26; // [sp+Ch] [bp-8h] BYREF
v5 = 393234;
if ( a4 )
v5 = 397329;
v6 = 397330;
if ( a4 )
{
v7 = 397328;
}
else
{
v6 = v5;
v5 = 393233;
v7 = 393232;
}
if ( a5 )
{
v11 = X509_get0_pubkey(a3);
if ( v11 )
v12 = EVP_PKEY_security_bits(v11);
else
v12 = -1;
if ( a1 )
v13 = ssl_security(a1, v7);
else
v13 = ssl_ctx_security(a2, v7, v12, 0, a3);
if ( !v13 )
return 399;
}
else
{
v19 = X509_get0_pubkey(a3);
if ( v19 )
v20 = EVP_PKEY_security_bits(v19);
else
v20 = -1;
if ( a1 )
v21 = ssl_security(a1, v5);
else
v21 = ssl_ctx_security(a2, v5, v20, 0, a3);
if ( !v21 )
return 397;
}
v26 = 0;
if ( (X509_get_extension_flags(a3) & 0x2000) != 0 )
return 1;
signature_nid = X509_get_signature_nid(a3);
if ( signature_nid )
{
sigid_algs = OBJ_find_sigid_algs(signature_nid, &v26, 0);
v16 = v26;
if ( !sigid_algs || !v26 )
{
v17 = -1;
goto LABEL_18;
}
v23 = OBJ_nid2sn(v26);
digestbyname = EVP_get_digestbyname(v23);
if ( digestbyname )
{
v25 = EVP_MD_size(digestbyname);
v16 = v26;
v17 = 4 * v25;
goto LABEL_18;
}
}
v16 = v26;
v17 = -1;
LABEL_18:
if ( a1 )
v18 = ssl_security(a1, v6);
else
v18 = ssl_ctx_security(a2, v6, v17, v16, a3);
if ( v18 )
return 1;
else
return 398;
}