//
// tls_process_change_cipher_spec from 0xd4e3c8 to 0xd4e52c (356 bytes)
//
// 3 xrefs:
// > ossl_statem_client_process_message @ 0xd4c2cc
// > ossl_statem_server_process_message @ 0xd5464c
// > ??> @ 0x746d0
//
// 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 tls_process_change_cipher_spec(_QWORD *a1, __int64 a2)
{
__int64 v3; // x1
unsigned int v4; // w2
__int64 v6; // x2
v3 = *(_QWORD *)(a2 + 8);
if ( (*(_DWORD *)(*(_QWORD *)(a1[1] + 192LL) + 104LL) & 8) != 0 )
{
if ( *(_DWORD *)a1 == 256 )
{
if ( v3 != 2 )
goto LABEL_4;
}
else if ( v3 )
{
LABEL_4:
ERR_put_error(20, 363, 103, "ssl/statem/statem_lib.c", 146);
v4 = 47;
LABEL_5:
ssl3_send_alert((__int64)a1, 2, v4);
ossl_statem_set_error((__int64)a1);
return 0;
}
}
else if ( v3 )
{
ERR_put_error(20, 363, 103, "ssl/statem/statem_lib.c", 153);
v4 = 47;
goto LABEL_5;
}
v6 = a1[18];
if ( !*(_QWORD *)(v6 + 552) )
{
ERR_put_error(20, 363, 133, "ssl/statem/statem_lib.c", 161);
v4 = 10;
goto LABEL_5;
}
*(_DWORD *)(v6 + 232) = 1;
if ( !(unsigned int)ssl3_do_change_cipher_spec((__int64)a1) )
{
ERR_put_error(20, 363, 68, "ssl/statem/statem_lib.c", 168);
v4 = 80;
goto LABEL_5;
}
if ( (*(_DWORD *)(*(_QWORD *)(a1[1] + 192LL) + 104LL) & 8) == 0 )
return 3;
dtls1_reset_seq_numbers(a1, 1);
if ( *(_DWORD *)a1 != 256 )
return 3;
++*(_WORD *)(a1[19] + 268LL);
return 3;
}