//
// tls_process_change_cipher_spec from 0x7a6420 to 0x7a65a4 (388 bytes)
//
// 3 xrefs:
// > ossl_statem_client_process_message @ 0x7a42d4
// > ossl_statem_server_process_message @ 0x7acfb8
// > ??> @ 0x5d34c
//
// 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 tls_process_change_cipher_spec(_DWORD *a1, int a2)
{
int v3; // r2
int v4; // r2
int v6; // r3
v3 = *(_DWORD *)(a2 + 4);
if ( (*(_DWORD *)(*(_DWORD *)(a1[1] + 100) + 52) & 8) != 0 )
{
if ( *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(a1, 2, v4);
ossl_statem_set_error((int)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[26];
if ( !*(_DWORD *)(v6 + 528) )
{
ERR_put_error(20, 363, 133, "ssl/statem/statem_lib.c", 161);
v4 = 10;
goto LABEL_5;
}
*(_DWORD *)(v6 + 220) = 1;
if ( !ssl3_do_change_cipher_spec(a1) )
{
ERR_put_error(20, 363, 68, "ssl/statem/statem_lib.c", 168);
v4 = 80;
goto LABEL_5;
}
if ( (*(_DWORD *)(*(_DWORD *)(a1[1] + 100) + 52) & 8) == 0 )
return 3;
dtls1_reset_seq_numbers((int)a1, 1);
if ( *a1 != 256 )
return 3;
++*(_WORD *)(a1[27] + 268);
return 3;
}