feat: tls 1.3 handshake message parsers - #436
Merged
Merged
Conversation
mirror the senders in message_build.zig — server_hello, encrypted_ extensions, certificate (single-leaf only), certificate_verify, finished, certificate_request — plus a small nextMessage iterator since the server packs several handshake messages into one record. narrow profile (AES-256-GCM / X25519 / ECDSA-SHA256) so the parsers reject anything the rest of the stack can't handle anyway. eight round-trip tests against the existing builders cover every parser, including the certificate_request scheme-list check.
This was referenced Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
second PR-4 chunk (after #435). adds the TLS 1.3 handshake message
parsers the client driver will need, plus a small iterator for walking
the packed handshake stream that comes out of a single decrypted record.
no behavior change — these are pure decoders. mirrors the senders in
message_build.zigone-for-one so a builder + parser test covers eachmessage format.
what's in here
src/tls/handshake/message_parse.zigwith:nextMessage(stream, &pos)— walks the concatenated stream ofhandshake messages, returns each as
{ msg_type, body, raw }(rawis what feeds the transcript hash on both sides)
parseServerHello— extracts server_random, X25519 share; rejectsanything that isn't TLS 1.3 / AES-256-GCM / X25519
parseEncryptedExtensions— selected ALPN (or null)parseCertificateMessage— leaf cert DER (single-cert chain only,matches what we issue)
parseCertificateVerify— algorithm code + signature DERparseFinished— verify_data sliceparseCertificateRequest— context + raw SignatureSchemeList, plusa
certRequestOffersEcdsaP256Sha256helper for the only scheme weactually understand
tests
eight round-trip tests (builder → parser) cover every message type plus
a packed-stream walk and a truncated-stream rejection.
not in this PR
CertificateRequest+ client-cert verify pathstill security-sensitive (it's the wire format), so no auto-merge —
landing in chunks per your earlier instruction.