Skip to content

CFB/OFB/CTR finals: remove declarations and fields nothing uses - #4492

Merged
alex merged 1 commit into
mainfrom
claude/audit-4139-cfb-partial
Nov 7, 2026
Merged

alex merged 1 commit into
mainfrom
claude/audit-4139-cfb-partial

Conversation

@alex

@alex alex commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Part of #4139 (finding 4: CFB's partial last segment is XORed in Rust; the clean-up after it).

This is the Impl/+Proof/ half of a dead-code check over what #4394, #4430 and #4451 touched. #4487 was the Spec/ half.

How it was checked. For each target, I took the transitive closure of every artifact's code and proof through types and values, proof terms included. The roots were everything in Artifacts/, Generic/, Variants/, TCB/ and Dispatch. Names that tactics, macros and taint summaries use by name count as used, as in #4333. I then grepped each declaration outside that closure across lean/ and src/. Lemmas that are only rfl and used through simp or sig_pre lists leave no proof-term trace, so I checked those by grep and kept them.

Removed (31 files, net 101 lines):

  • Unused declarations:
    • the abbrev VG.Proof.AesCtr.X86_64.cT;
    • the theorems VG.Proof.Modes.X86_64.xorByte_scal and fit_off, and VG.Proof.Modes.RISCV64.cryptBuf_copy_chn (its sibling cryptBuf_copy_dat is used);
    • Setup.pt (AES-CFB on x86) and TArgs.pt (AES-, Camellia- and SM4-CTR on x86).
  • Precondition fields no proof reads, together with their proofs where the structures are built, including the positional builds FPre.of/CPre.of/KPre.of and Arm's and RISC-V's XPre:
    • FPre.sch_wrap and CPre.sch_wrap in the AES-CFB and AES-CTR finals; on x86-64 also sp_lo, sp_hi, ret_sch, ret_arg and sv_wrap;
    • KPre.ret_sch in the x86-64 Camellia and SM4 CTR finals;
    • XPre.pos in every target's final mode;
    • XPre.fitK and fitR on PPC64LE and x86-64;
    • XDone.syms on x86.
  • Docstring: seqWith_changes_wp on RISC-V cited seqWith_wp, which no longer exists. It now says what the theorem states.

No remaining statement, no code and no registration changes. No TCB or Spec changes.

Found and left alone:

Checks:

🤖 Generated with Claude Code

https://claude.ai/code/session_01TKUFHGJJidJdRDMDSSd58W

A reachability check over what #4394, #4430 and #4451 touched (the
transitive closure of every artifact's code and proof on each target, and
names used by tactics and taint summaries) found these unused:

* the abbrev VG.Proof.AesCtr.X86_64.cT, and the theorems
  VG.Proof.Modes.X86_64.xorByte_scal and fit_off,
  VG.Proof.Modes.RISCV64.cryptBuf_copy_chn, Setup.pt (AES-CFB x86) and
  TArgs.pt (AES-, Camellia- and SM4-CTR x86);
* precondition fields no proof reads: FPre.sch_wrap and CPre.sch_wrap
  (AES-CFB and AES-CTR finals; on x86-64 also sp_lo, sp_hi, ret_sch,
  ret_arg and sv_wrap), KPre.ret_sch (Camellia and SM4 CTR finals, x86-64),
  XPre.pos (every target's final mode), XPre.fitK and fitR, and XDone.syms
  (x86), with their proofs where the structures are built.

Also corrects the docstring of seqWith_changes_wp (RISC-V), which cited a
lemma that no longer exists. No remaining statement, no code and no
registration changes; the generated code is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHGJJidJdRDMDSSd58W
@github-actions github-actions Bot added the untrusted-only This changes exclusively implementations and proofs, and thus is entirely formally verified. label Nov 7, 2026
@alex
alex added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 3215541 Nov 7, 2026
24 checks passed
@alex
alex deleted the claude/audit-4139-cfb-partial branch November 7, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

untrusted-only This changes exclusively implementations and proofs, and thus is entirely formally verified.

Development

Successfully merging this pull request may close these issues.

2 participants