NEW UNIT (TLS 1.3).
Wire-level encode/decode for the TLS 1.3-specific handshake extensions and
messages, kept separate from the (TLS 1.2) state machine in
StreamSec.Mobile.Tls so that the existing code is untouched. The handshake
DRIVER (TTLS_HandshakeProtocol in StreamSec.Mobile.TlsLayer) calls these from
HandleClientHello / HandleServerHello / the post-ServerHello flight; the
integration points are noted in comments.
It REUSES:
* tBytes / byte helpers from stDERUtils, hashing from stSecUtils;
* the HKDF key schedule in StreamSec.Mobile.Tls13KeySchedule (for the
Finished verify_data).
Versions, groups and signature schemes are handled as their 16-bit wire
values (TTls13WordArray) to keep this unit independent of the heavier
StreamSec.Mobile.Tls state-machine unit. It does NOT do key agreement: the
caller supplies the raw key_share public bytes (computed by the existing
EC/FFC code) and the resulting shared secret (fed to the key schedule).Feature notes: TLS implementation notes (RFC map)
One entry of the client's OfferedPsks (RFC 8446 sec.4.2.11): a ticket identity + its obfuscated_ticket_age, paired positionally with its PskBinderEntry.
Identity: tBytes;
ObfAge: UInt32;
Binder: tBytes;
Running transcript for the TLS 1.3 key schedule and Finished/CertificateVerify (RFC 8446 sec.4.4.1). The driver feeds every handshake message (the raw msg_type||length||body bytes, in order) via Update, and reads CurrentHash at the points the RFC requires (ClientHello..ServerHello, ..server Finished, ..client Finished). Messages are buffered and hashed on demand, which keeps the implementation independent of any incremental-hash cloning support.
constructor Create(aHashClass: THashClass);
procedure Update(const aMessage: tBytes);
function CurrentHash: tBytes;
procedure SwitchToMessageHash;
property HashClass: THashClass read fHashClass;