Skip to content

Spec: retire the Apis of vg_keccak_absorb_scratch, vg_keccak_pad and vg_keccak_squeeze - #4369

Merged
alex merged 1 commit into
mainfrom
claude/audit-4139-sha3
Nov 6, 2026
Merged

alex merged 1 commit into
mainfrom
claude/audit-4139-sha3

Conversation

@alex

@alex alex commented Nov 6, 2026

Copy link
Copy Markdown
Member

Part of #4139 (finding 2: SHA-3 and SHAKE are composed in Rust from the generic Keccak sponge)

This is the follow-up to #4352. It retires what that PR left without a Rust caller, as #4303 did for RSA.

What changes

Since #4352, no Rust calls the generic sponge functions vg_keccak_absorb_scratch, vg_keccak_pad and vg_keccak_squeeze. They are internal functions now: the SHA-3/SHAKE instances, Ed448, ML-KEM and ML-DSA call them. So:

The generated crates and the Rust code are unchanged. Nothing in Rust was left without callers: #4352 already removed the Rust that called the sponge.

Trust

This is a trust change in Spec/, and it only removes: three Apis and the sponge's contracts leave Spec/. The functions those contracts describe are not exported to Rust any more. What Rust calls (the instances) is still proven against Spec/Sha3/Instances.lean, which this PR does not change.

Overlap with the other dead-code PRs

I checked the open dead-code PRs (#4354 ML-KEM, #4362 proof framework) and the merged #4349. None of them touches these declarations or Proof/Sha3/Scratch.lean.

Testing

  • lake build (all modules) and the full emit: the crates are unchanged.
  • Every step of the Static checks job passes locally.
  • check_lean_public_imports.py passes on each edited module.

No benchmark: the generated code is unchanged.


Generated by Claude Code

…vg_keccak_squeeze

No Rust code calls them since the SHA-3 and SHAKE instances have their
own verified functions (#4352): they are internal functions, which the
instances, Ed448, ML-KEM and ML-DSA call. So their Apis go, and their
contracts (absorbScratchContract, padContract, squeezeContract, with
their signatures, preconditions and postconditions) move from
Spec/Sha3/Contract.lean to Proof/Sha3/Contract.lean, untrusted.
Spec/Sha3/Contract.lean keeps only the rates, which the instances'
contracts use. The callers name the functions by their symbols, and the
proofs the contracts by their new namespace.

Proof/Sha3/Scratch.lean, which only the stack-scratch wrappers #4352
removed used, goes too. The generated code is unchanged.

Part of #4139 (finding 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHFSJeanUuEEcRTgVJf
@alex
alex enabled auto-merge November 6, 2026 20:58
@alex
alex added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 35f5628 Nov 6, 2026
17 checks passed
@alex
alex deleted the claude/audit-4139-sha3 branch November 6, 2026 21:36
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