Skip to content

Guidance: the cryptography is in the verified code, never in Rust - #4488

Merged
alex merged 1 commit into
mainfrom
guidance-no-crypto-in-rust
Nov 7, 2026
Merged

alex merged 1 commit into
mainfrom
guidance-no-crypto-in-rust

Conversation

@alex

@alex alex commented Nov 7, 2026

Copy link
Copy Markdown
Member

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 in Spec/: 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-primitive skill, 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

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>
@alex
alex enabled auto-merge November 7, 2026 16:43
@alex
alex added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit da38ca4 Nov 7, 2026
20 checks passed
@alex
alex deleted the guidance-no-crypto-in-rust branch November 7, 2026 17:14
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.

1 participant