Repository navigation
Guidance: the cryptography is in the verified code, never in Rust - #4488
Merged
Merged
Conversation
A hard rule in AGENTS.md saying what the Rust around a verified function may do (check arguments, lay out buffers and state, call the dispatcher, serve entropy, map results to errors) and that everything else is verified code: padding, partial blocks, sequencing, constants, rejection sampling, key generation's loops, tag comparison, wiping on failure. A missing verified function is a spec PR, never a gap filled in Rust; any cryptography left in Rust is listed in the README's "What is not verified". adding-a-primitive's step 5 points to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Agents keep putting cryptographic logic in the Rust wrappers that belongs in verified code, and it keeps being moved back out (#4451, #4430, #4394, #4352, #4355, #4368, #4347). Nothing in the guidance said what the Rust may do: the README's "What is not verified" describes it, but as a description, not a rule.
AGENTS.md: a new hard rule, next to "All assembly comes from Lean". The Rust only checks the API's arguments, lays out buffers and state, calls the dispatcher, serves entropy and maps results to errors. Everything else is verified code with a contract inSpec/: padding, partial blocks and segments, sponge sequencing, constants, rejection sampling, key generation's loops, tag comparison, wiping on failure. A missing verified function means a spec PR first, never a stopgap in Rust ("for now" or on only some targets). Cryptography found in Rust is moved, not extended or copied. Since nothing checks this mechanically, whatever remains is listed in the README's "What is not verified".adding-a-primitiveskill, step 5 (building the Rust API): points to the rule, and to step 1 when the API needs a step no verified function does.Documentation only; no code, TCB or spec changes.
🤖 Generated with Claude Code