Skip to content

Spec: the CFB, OFB and CTR contracts' docs point a partial last block at the final functions - #4487

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).

Trust change: Spec/ documentation only. No definition, contract, signature or Api changes: only the module docstrings (/-! … -/) of 19 files under Spec/.

The whole-block CFB, OFB and CTR contracts' docs still said a partial last segment or block "is the caller's". For OFB and CTR, they added that the caller XORs in the mode applied to a zero block. That described the Rust code that #4394, #4430 and #4451 replaced with verified final functions. Each sentence now names the function that takes the partial last segment or block, and the spec file that defines it:

  • CFB: Spec/Cfb/Contract.lean points at Spec/Cfb/Final.lean; Spec/<C>/Cfb.lean points at Spec/<C>/CfbFinal.lean, for Blowfish, Camellia, CAST5, IDEA, SEED, SM4 and Triple DES.
  • OFB: Spec/Ofb/Contract.lean points at vg_aes_ofb_final (Spec/Ofb/Final.lean); Spec/<C>/Ofb.lean points at vg_<c>_ofb_final (Spec/<C>/OfbFinal.lean), for the same seven ciphers.
  • CTR: Spec/Ctr/Contract.lean points at vg_aes_ctr_final (Spec/Ctr/Final.lean); Spec/{Camellia,Sm4}/Ctr.lean point at vg_{camellia,sm4}_ctr_final.

This is the Spec/ half of a reachability check over what #4394, #4430 and #4451 touched. I traced the transitive closure of every artifact's code and proof on each target, plus tactic and taint_summary uses by name. It found no unused CFB, OFB or CTR spec definition, contract or Api. The unreached top-level string specs Spec.Cfb.aesCfbEncrypt/aesCfbDecrypt, Spec.Ofb.aesOfb and Spec.Ctr.aesCtr are left as they are, as #4333 and #4392 left Spec.Cbc.aesCbcEncrypt. A few unused proof declarations from those PRs follow in their own PR.

The 19 modules build, and the Static checks pass locally.


Generated by Claude Code

… at the final functions

They said the caller handles a partial last segment or block, OFB's and
CTR's by XORing in the mode of a zero block: what the Rust code did before
#4394, #4430 and #4451 gave every one a verified final function. Name those
functions and their specs instead. Documentation only: no definition,
contract or Api changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHGJJidJdRDMDSSd58W
@alex
alex added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 79d5aae Nov 7, 2026
27 checks passed
@alex
alex deleted the claude/audit-4139-cfb-partial branch November 7, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants