Repository navigation
Spec: retire the Apis of vg_keccak_absorb_scratch, vg_keccak_pad and vg_keccak_squeeze - #4369
Merged
Merged
Conversation
…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
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.
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_padandvg_keccak_squeeze. They are internal functions now: the SHA-3/SHAKE instances, Ed448, ML-KEM and ML-DSA call them. So:Apis are deleted (absorbScratchApi,padApi,squeezeApi). Callers now name the functions by their symbols ("vg_keccak_pad", …), as Spec: retire the Apis of vg_rsa_private_checked, vg_rsa_public_precomputed_checked and vg_rsa_check_crt_key #4303 did.Spec/Sha3/Contract.leantoProof/Sha3/Contract.lean, where they are untrusted. The text is unchanged: signatures,absorbPre/absorbPost,padPre/padPost,squeezePre/squeezePost, and the contracts. The proofs refer to them asProof.Sha3.*.Spec/Sha3/Contract.leankeeps onlyrates, which the instances' contracts (Spec/Sha3/Instances.lean) use.Proof/Sha3/Scratch.leanis deleted. Only SHA-3 and SHAKE: per-instance verified functions on every target #4352's deleted stack-scratch wrappers (Frame.lean) used it.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: threeApis and the sponge's contracts leaveSpec/. The functions those contracts describe are not exported to Rust any more. What Rust calls (the instances) is still proven againstSpec/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.check_lean_public_imports.pypasses on each edited module.No benchmark: the generated code is unchanged.
Generated by Claude Code