//
// ssl_get_server_cert_serverinfo from 0x799068 to 0x799148 (224 bytes)
//
// 2 xrefs:
// > sub_79B830 @ 0x79b858
// > ??> @ 0x5c03c
//
// 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
//
int __fastcall ssl_get_server_cert_serverinfo(int a1, int *a2, _DWORD *a3)
{
int v3; // r3
int v7; // r4
int cert_index; // r0
int v9; // r3
int result; // r0
int v11; // r3
_DWORD *v12; // r3
v3 = *(_DWORD *)(a1 + 104);
*a3 = 0;
v7 = *(_DWORD *)(a1 + 200);
cert_index = ssl_cipher_get_cert_index(*(_DWORD *)(v3 + 528));
switch ( cert_index )
{
case 0:
cert_index = *(_DWORD *)(*(_DWORD *)(a1 + 200) + 20) == 0;
break;
case 8:
v12 = *(_DWORD **)(a1 + 200);
if ( v12[35] )
{
cert_index = 6;
break;
}
if ( v12[30] )
{
cert_index = 5;
break;
}
if ( v12[25] )
{
cert_index = 4;
break;
}
LABEL_13:
ERR_put_error(20, 322, 68, "ssl/ssl_lib.c", 2768);
return 0;
case -1:
goto LABEL_13;
}
v9 = v7 + 20 * cert_index;
result = *(_DWORD *)(v9 + 32);
if ( result )
{
v11 = *(_DWORD *)(v9 + 36);
*a2 = result;
result = 1;
*a3 = v11;
}
return result;
}