Skip to content

DSA: remove the three-tape parameter-generation spec and its dead proofs - #4304

Merged
reaperhulk merged 1 commit into
mainfrom
claude/unify-random-bytes-crypto-xqmg0z-dsa-spec-cleanup
Nov 6, 2026
Merged

reaperhulk merged 1 commit into
mainfrom
claude/unify-random-bytes-crypto-xqmg0z-dsa-spec-cleanup

Conversation

@reaperhulk

Copy link
Copy Markdown
Member

#4234, #4293, #4295, #4297 and #4296 moved DSA parameter generation on every architecture to the refillable-tape search (Spec/Dsa/ParameterSearch.lean). Nothing registers generateParametersApi any more, no crate emits vg_dsa_generate_parameters, and the Rust no longer calls it. This PR removes that old spec and every proof and piece of code that existed only for it. The generated crates are unchanged.

Trust change: Spec/ (removals and doc wording only)

Definitions removed:

  • Spec/Dsa/Generate.lean: generateParametersBytes, generateParametersSig, generateParametersContract, generateParametersApi.
  • Spec/Dsa.lean: the list-based generateParameters (and its attempt). Apart from tests that checked it directly, only generateParametersBytes and the old controllers' proofs used it.

Kept (used by the parameter search, key generation, or live proofs): generationChunks, generationLengthsValid, generationScratchWords, encodeParams, paramsBytes, encodePrivateKey, the generateKey* definitions, generator, primeFromSeed, qCandidate, pCandidate and subgroupBits.

Doc wording only, no definition changed:

  • Generate.lean's module doc now describes only key generation and the shared helpers.
  • In ParameterSearch.lean, the module doc and the docs of parameterSeeds and generatorAttempts now describe the one-tape layout directly, without naming the removed definition.

TCB/ is untouched.

Dead code and proofs removed

Deleted modules (27):

  • 22 x86-64 old-controller proof modules under Proof/Dsa/X86_64/Generation/: ABI, ABIContext, ABIGeometry, BackendVerified, Dispatch, DispatchCT, EntryAllocated, EntryFrame, EntryInitial, EntryReady, EntryResult, GenerateCT, NativeParameters, NativeParametersCT, ParameterIterationCT, ParameterLoopCT, ParameterTailCT, PublicCT, Sized, SizedBackend, SizedContract, Widths. DSA parameter search on x86-64: verified refill controller #4234 had left these behind.
  • 3 x86-64 code modules under Impl/Dsa/X86_64/Generation/, none of them emitted: Generate, Sized, Widths.
  • 2 shared proof modules under Proof/Dsa/Generation/: ByteResult, SeedResult.

Declarations removed from modules that remain:

  • x86-64 proofs:
    • old-API lemmas in BackendCorrect, EntryInnerCT, EntryState, ParameterCTState, ParameterInvariant, SeedAttempt, SeedOutcome, and the Hash* modules;
    • SharedChecker keeps only name;
    • parameters_verified and parametersSatisfiable.
  • x86-64 code: Entry's code, dispatch, entryBody, entryHeader, entryIncoming and incomingSlots; SeedSearch's parameterSearch and seedAttempt; Hash's seedHash and hashTest; PHash's useWrappedSeed; TapeLoop's seedTape.
  • AArch64: ParameterInvariant loses the three-tape GenerationContext.remaining and ParameterInvariant.
  • Shared: Generation/Search loses parameterAttempt_nil and parameterAttempt_step; Generation/SeedSuffix loses seedResult_suffix.

How "dead" was established:

  • A dependency graph at the level of individual definitions, built from the .ilean files of a full build. It starts from every definition in Artifacts/, Generic/, Variants/, TCB/ and the tests.
  • Only definitions that nothing live refers to were removed.
  • A second reachability pass after the change found no module newly unreachable from a registration file.

Code that was already dead on main but does not involve the old API is left for a separate cleanup: the AArch64 Tape*/WrappedSeed/RoundTail modules and some unused lemmas.

Lean tests:

  • The assertions on generateParametersBytes and generateParameters are removed, including checkParameters, an end-to-end check of the NIST PQGGen seed through the old adapter.
  • End-to-end coverage remains in Rust: cavp_generated_parameters runs the full refillable search on the NIST vectors on every architecture. The pieces it uses (qCandidate, pCandidate, probablePrime) are still checked against NIST in Dsa.lean.

Other: a benchmark comment now says "from a fixed tape". Nothing in docs/algorithms, ci/, vectors/ or the README tables named the old API.

Size

65 files changed, +53 / −4,466.

Checks

  • Lean build: the full lake build passes (28,970 jobs). Emit.lean --check passes with the standard axiom audit, so the generated crates are unchanged.
  • Static checks: every step passes. check_lean_public_imports --base origin/main passes on the modified modules.
  • Rust: cargo fmt --check (library and bench/) and cargo clippy --all-targets -- -D warnings pass.
  • No new escapes: no sorry, native_decide, bv_decide, admit or axiom added.

No benchmark: nothing that runs changed.


Generated by Claude Code

Every architecture now generates DSA parameters with the refillable-tape
search (`Spec/Dsa/ParameterSearch.lean`); no registration uses
`generateParametersApi` and no crate emits `vg_dsa_generate_parameters`.

Spec (removal only; the rest is doc wording):
* `Spec/Dsa/Generate.lean`: `generateParametersBytes`,
  `generateParametersSig`, `generateParametersContract`,
  `generateParametersApi`.
* `Spec/Dsa.lean`: the list-based `generateParameters` (and its `attempt`),
  which only the byte adapter and the old controllers' proofs used.
* Docs in `Generate.lean`, `ParameterSearch.lean`, `RefillSeed.lean` and
  `GeneratorStageContract.lean` no longer name the removed definitions.

Proofs and code that only the old API or the old x86-64 three-tape
controller used, found with a declaration-level graph from the build's
.ilean files (reachable from no Artifacts/Generic/Variants file), then
confirmed by a full build and `Emit.lean --check`:
* 27 modules deleted, among them x86-64's `Generation/{ABI, ABIContext,
  ABIGeometry, BackendVerified, Dispatch, DispatchCT, EntryAllocated,
  EntryFrame, EntryInitial, EntryReady, EntryResult, GenerateCT,
  NativeParameters, NativeParametersCT, ParameterIterationCT,
  ParameterLoopCT, ParameterTailCT, PublicCT, Sized, SizedBackend,
  SizedContract, Widths}`, `Impl/Dsa/X86_64/Generation/{Generate, Sized,
  Widths}` and the shared `Proof/Dsa/Generation/{ByteResult, SeedResult}`.
* The old controller's declarations removed from the modules the refill
  proofs still use (e.g. `BackendCorrect`, `EntryInnerCT`, `EntryState`,
  `ParameterCTState`, `ParameterInvariant`, `SharedChecker`'s code and
  proof, `Impl/.../Entry`'s `code`/`dispatch`/`entryBody`), AArch64's
  three-tape `ParameterInvariant`/`GenerationContext.remaining`, and
  x86-64's `parameters_verified`/`parametersSatisfiable`, which only the
  old shared checker used.

Tests drop their checks of the removed definitions. The bench comment
says the search reads one fixed tape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
@reaperhulk
reaperhulk enabled auto-merge November 6, 2026 09:50
@reaperhulk
reaperhulk added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 402c926 Nov 6, 2026
22 checks passed
@reaperhulk
reaperhulk deleted the claude/unify-random-bytes-crypto-xqmg0z-dsa-spec-cleanup branch November 6, 2026 10:22
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