//
// dtls_construct_change_cipher_spec from 0xd4d480 to 0xd4d560 (224 bytes)
//
// 3 xrefs:
// > ossl_statem_client_construct_message @ 0xd4c418
// > ossl_statem_server_construct_message @ 0xd544f8
// > ??> @ 0x45750
//
// 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 dtls_construct_change_cipher_spec(__int64 a1)
{
_BYTE *v1; // x2
__int64 v2; // x1
__int16 v3; // w3
bool v4; // zf
v1 = *(_BYTE **)(*(_QWORD *)(a1 + 120) + 8LL);
*v1 = 1;
v2 = *(_QWORD *)(a1 + 152);
v3 = *(_WORD *)(v2 + 266);
v4 = *(_DWORD *)a1 == 256;
*(_WORD *)(v2 + 264) = v3;
*(_DWORD *)(a1 + 136) = 1;
if ( v4 )
{
*(_WORD *)(v2 + 266) = v3 + 1;
v1[1] = HIBYTE(v3);
v1[2] = *(_WORD *)(*(_QWORD *)(a1 + 152) + 264LL);
v2 = *(_QWORD *)(a1 + 152);
v3 = *(_WORD *)(v2 + 264);
*(_DWORD *)(a1 + 136) += 2;
}
*(_DWORD *)(a1 + 140) = 0;
*(_BYTE *)(v2 + 296) = 1;
*(_QWORD *)(v2 + 304) = 0;
*(_WORD *)(v2 + 312) = v3;
*(_QWORD *)(v2 + 320) = 0;
*(_QWORD *)(v2 + 328) = 0;
if ( (unsigned int)dtls1_buffer_message(a1, 1) )
return 1;
ERR_put_error(20, 371, 68, "ssl/statem/statem_dtls.c", 897);
return 0;
}