Repository navigation
clazel-p384: field arithmetic over fiat-crypto behind six axioms (3.5h, PR2), tier 0 - #23
Merged
Merged
Conversation
The meaning of a field element (six Montgomery-domain limbs; fiat's eval and from_montgomery; mont(x) = x R mod m) and the ensures of every executable field function: add, sub, mul, one, equals, from_octets, to_octets, pow and inv, where inv refines spec::inv. Spec and contracts only; no code. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d mod n) fiat-crypto =0.3.0 becomes a shipped dependency (default features off). Six external_body wrappers, one per fiat function, each with a // AXIOM: and an ensures that copies the postcondition printed above the function. DEPENDENCIES.md gains the row; the crypto line of the VERIFICATION.md TCB gains fiat-crypto. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… contracts Fe is a residue mod p or n as six Montgomery-domain limbs with a type invariant (value below the modulus). Proven over the six axioms: conversion into the Montgomery domain (mul by R^2) and out of it (mul by 1), our own big-endian octet-string conversions with the range check, equality, pow by square-and-multiply over a 48-octet exponent, and inv (pow m-2 with the check a w = 1) against spec::inv. tests/field.rs checks add, sub, mul, inv, pow and the octet conversions against Python-computed known answers for both moduli. The crate stays at tier 0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brings in the spec's mutations.json. The README keeps both status notes. VERIFICATION.md's fiat-crypto TCB entry now also names the printed pre/postcondition comments, rustc's i128/u64/i8 arithmetic and the published crate being the synthesizer's output (the axiom review's one finding), and no longer says the unwritten ECDSA code is proven. 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.
PR2 of P-384 ECDSA verification (3.5h): the field arithmetic for
clazel-p384, built on fiat-crypto=0.3.0behind six axioms. It is stacked on #22, and the crate stays at tier 0.Commits
dcd344bspec: the field contracts (field/spec.rs,field/contract.rs), committed before any code.26c4e5e:src/axioms.rs, holdingp_mul,p_add,p_sub,n_mul,n_addandn_sub, one per fiat call. Also the fiat-crypto dependency, itsDEPENDENCIES.mdrow (shipped) and theVERIFICATION.mdTCB entry.8b1d2d1:field/fe.rsandfield/lemmas.rs, proven against the contracts over the axioms:Fetype whose invariant keeps each value below its modulus;mulby R² and by 1;pow;inv, proven equal to the spec's checkedinv.Plus
tests/field.rs, which uses known answers computed in Python.A merge of clazel-p384: ECDSA P-384 verification spec (3.5h, PR1), tier 0 #22, bringing in the spec's
mutations.json, plus the TCB wording below.Axioms
Each axiom's
requiresis fiat's printed precondition,0 ≤ eval arg < m. Eachensuresis fiat's printed postcondition, quoted verbatim in its doc comment.Independent review. A fresh session reviewed
axioms.rsat SHA-256e9ee88f170b0f0565a44a016c66b9b94fe7371ca50acd1efe61ea6289dbfa4e3. Verdict: all six are sound.requiresandensuresmatches fiat exactly. Both inverse literals and both R² literals were checked against the moduli.Feinvariant discharges every one.The review found one gap in the TCB text. It now also names:
i128,u64andi8arithmetic;It also no longer says the unwritten ECDSA code is proven.
Checks done
84 verified, 0 errors, from a clean cache.cargo xtask mutate clazel-p384gives 26 of 26 killed with certificates.cargo testpasses 7 tests, and clippy and fmt are clean.cargo xtask check: passes, with 18 documented axioms (12 in clazel-crypto, 6 here).Not yet
verify.CI has not run yet.
🤖 Generated with Claude Code