Skip to content

tls: make hello::bootstrap verify - #12

Merged
atiernan merged 3 commits into
phase3/tls-ccs-fragmentsfrom
phase3/tls-bootstrap-proof
Oct 27, 2026
Merged

atiernan merged 3 commits into
phase3/tls-ccs-fragmentsfrom
phase3/tls-bootstrap-proof

Conversation

@atiernan

Copy link
Copy Markdown
Member

Stacked on #8. The WIP hello::bootstrap module, brought in by phase3/tls-handover, failed Verus with 4 errors: assertions in acknowledge_send and eof, and an rlimit in feed. It now verifies. Its spec, its contract and the requires/ensures of its public functions are unchanged. No escape hatches were added and rlimit was not raised.

Proof changes

  • acknowledge_send: captures the old mode and pending flight as ghosts before fail() overwrites them, and compares with the verified handshake::bytes_eq and matches! instead of ==, which has no spec.
  • eof: adds field-by-field state equalities.
  • feed: the private handlers ensured only wf(), so they could never prove feed_exec_ensures. They now ensure exact state against new spec helpers in bootstrap_lemmas.rs (record_step, fragment_step, alert_step, hello_step, after_messages, terminal, plus lemma_feed_complete and lemma_plain_fragment_bound). The Hello controller call moves into handle_hello_message.
  • framing.rs gains lemma_wf_mode, and reassemble.rs gains Reassembler::snapshot (contract: r@ == self@, r.wf() == self.wf()).

Behaviour changes (code brought in line with the existing spec)

  • After a reassembly error, the reassembler is restored from a snapshot instead of being reset, because the spec keeps the old reassembly state.
  • An alert record whose fragment is not exactly 2 bytes now fails with decode_error.
  • Any other unexpected record type now fails with unexpected_message.
  • A short or non-ServerHello message now fails with unexpected_message. Before, an empty message gave decode_error.
  • The redundant framer.is_empty check in handle_messages, which the spec does not have, is removed.

Local results (per module; I re-ran these myself after cleaning the Verus cache)

  • hello::bootstrap 15 verified, 0 errors.
  • hello::bootstrap_lemmas 4 verified, 0 errors.
  • connection::framing 11 verified, 0 errors.
  • reassemble 7 verified, 0 errors.
  • connection::exec 31 verified, 0 errors.
  • cargo test -p clazel-tls: 85 passed, 0 failed. Strict clippy, cargo fmt --check and cargo xtask check are clean.

Not done

🤖 Generated with Claude Code

atiernan and others added 2 commits October 26, 2026 15:21
Capture the pre-call mode and pending flight as ghost values (fail()
overwrites them), compare the flight with the verified bytes_eq, and
spell out the field-wise state equality in eof.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bootstrap_lemmas gains spec helpers (terminal, hello_step, after_messages,
fragment_step, alert_step, record_step) and lemma_feed_complete, which
reduce bootstrap_spec::feed's Complete branch to record_step. The private
handlers (fail, close, handle_*) now ensure exact state equalities against
those helpers, so feed's proof is a short chain instead of one large body
(clears the rlimit failure without raising it).

Reassembler::snapshot (new, contract: copy of the view) lets the handlers
restore the reassembly state when feed_record fails, as bootstrap_spec
requires (the old code reset it to empty). framing::lemma_wf_mode bridges
the closed Buffer::wf_mode to framing_spec::wf_mode. Alert records now
check for exactly two bytes first and other record types fail with
unexpected_message, mirroring bootstrap_spec::feed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@atiernan
atiernan marked this pull request as ready for review October 27, 2026 07:13
@atiernan
atiernan merged commit 96baecf into phase3/tls-handover Oct 27, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant