//
// ssl_get_server_send_pkey from 0xfbfd2c to 0xfbfe04 (216 bytes)
//
// 5 xrefs:
// > ssl3_ctrl @ 0xfb6e5c
// > tls_construct_server_certificate @ 0xfd2154
// > ssl_check_clienthello_tlsext_late @ 0xfd4ec4
// > ssl_get_auto_dh @ 0xfd9cd0
// > ??> @ 0x48370
//
// 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:20 +0000
//
__int64 __fastcall ssl_get_server_send_pkey(__int64 a1)
{
__int64 v1; // x2
__int64 v2; // x20
int cert_index; // w0
_QWORD *v5; // x1
v1 = *(_QWORD *)(a1 + 144);
v2 = *(_QWORD *)(a1 + 328);
if ( !v1 || !*(_QWORD *)(v1 + 552) )
return 0;
ssl_set_masks(a1);
cert_index = ssl_cipher_get_cert_index(*(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL));
if ( !cert_index )
{
cert_index = *(_QWORD *)(*(_QWORD *)(a1 + 328) + 32LL) == 0;
LABEL_8:
if ( (cert_index & 0x80000000) == 0 )
return v2 + 40LL * cert_index + 32;
return 0;
}
if ( cert_index == 8 )
{
v5 = *(_QWORD **)(a1 + 328);
cert_index = 6;
if ( !v5[34] )
{
cert_index = 5;
if ( !v5[29] )
{
cert_index = 4;
if ( !v5[24] )
goto LABEL_11;
}
}
return v2 + 40LL * cert_index + 32;
}
if ( cert_index != -1 )
goto LABEL_8;
LABEL_11:
ERR_put_error(20, 322, 68, "ssl/ssl_lib.c", 2768);
return 0;
}