//
// ssl_get_server_send_pkey from 0x9adaa8 to 0x9adb90 (232 bytes)
//
// 5 xrefs:
// > ssl3_ctrl @ 0x9a4224
// > tls_construct_server_certificate @ 0x9c12bc
// > ssl_check_clienthello_tlsext_late @ 0x9c4124
// > ssl_get_auto_dh @ 0x9c97b4
// > ??> @ 0x749bc
//
// 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:54 +0000
//
int __fastcall ssl_get_server_send_pkey(unsigned int a1)
{
int v1; // r2
int v2; // r5
int cert_index; // r0
_DWORD *v5; // r3
v1 = *(_DWORD *)(a1 + 104);
v2 = *(_DWORD *)(a1 + 200);
if ( !v1 || !*(_DWORD *)(v1 + 528) )
return 0;
ssl_set_masks(a1);
cert_index = ssl_cipher_get_cert_index(*(_DWORD *)(*(_DWORD *)(a1 + 104) + 528));
if ( !cert_index )
{
cert_index = *(_DWORD *)(*(_DWORD *)(a1 + 200) + 20) == 0;
LABEL_10:
if ( cert_index >= 0 )
return v2 + 20 * cert_index + 20;
return 0;
}
if ( cert_index == 8 )
{
v5 = *(_DWORD **)(a1 + 200);
if ( v5[35] )
{
cert_index = 6;
return v2 + 20 * cert_index + 20;
}
if ( v5[30] )
{
cert_index = 5;
return v2 + 20 * cert_index + 20;
}
if ( v5[25] )
{
cert_index = 4;
return v2 + 20 * cert_index + 20;
}
goto LABEL_13;
}
if ( cert_index != -1 )
goto LABEL_10;
LABEL_13:
ERR_put_error(20, 322, 68, "ssl/ssl_lib.c", 2768);
return 0;
}