//
// ssl3_check_cert_and_algorithm from 0xd4b1d8 to 0xd4b39c (452 bytes)
//
// 3 xrefs:
// > tls_process_key_exchange @ 0xd4b550
// > tls_process_server_done @ 0xd4c0fc
// > ??> @ 0x3c8b8
//
// 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
//
__int64 __fastcall ssl3_check_cert_and_algorithm(__int64 a1)
{
__int64 v1; // x1
int v2; // w20
int v3; // w21
__int64 v5; // x0
unsigned int v6; // w2
__int64 v8; // x0
char v9; // w0
v1 = *(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL);
v2 = *(_DWORD *)(v1 + 24);
v3 = *(_DWORD *)(v1 + 20);
if ( (v2 & 4) == 0 && (v3 & 8) == 0 )
{
v5 = *(_QWORD *)(a1 + 376);
if ( *(_DWORD *)(v5 + 160) == 3 )
{
if ( !(unsigned int)ssl_check_srvr_ecc_cert_and_alg(*(_QWORD *)(v5 + 152), a1) )
{
ERR_put_error(20, 130, 304, "ssl/statem/statem_clnt.c", 2821);
v6 = 40;
goto LABEL_6;
}
}
else
{
if ( (v2 & 8) != 0 )
{
ERR_put_error(20, 130, 381, "ssl/statem/statem_clnt.c", 2828);
v6 = 40;
LABEL_6:
ssl3_send_alert(a1, 2, v6);
return 0;
}
v8 = X509_get0_pubkey(*(_QWORD *)(v5 + 152));
v9 = X509_certificate_type(*(_QWORD *)(*(_QWORD *)(a1 + 376) + 152LL), v8);
if ( (v2 & 1) != 0 && (v9 & 0x11) != 0x11 )
{
ERR_put_error(20, 130, 170, "ssl/statem/statem_clnt.c", 2838);
v6 = 40;
goto LABEL_6;
}
if ( (v2 & 2) != 0 && (v9 & 0x12) != 0x12 )
{
ERR_put_error(20, 130, 165, "ssl/statem/statem_clnt.c", 2844);
v6 = 40;
goto LABEL_6;
}
if ( (v3 & 0x41) != 0 && (v9 & 0x21) != 0x21 )
{
ERR_put_error(20, 130, 169, "ssl/statem/statem_clnt.c", 2852);
v6 = 40;
goto LABEL_6;
}
if ( (v3 & 2) != 0 && !*(_QWORD *)(*(_QWORD *)(a1 + 144) + 1016LL) )
{
ERR_put_error(20, 130, 68, "ssl/statem/statem_clnt.c", 2859);
v6 = 80;
goto LABEL_6;
}
}
}
return 1;
}