Skip to content

FFDH generate_key_cached is internal: no Api, contract in Proof - #4875

Merged
alex merged 1 commit into
mainfrom
claude/vg-ffdh-cached-internal
Nov 9, 2026
Merged

alex merged 1 commit into
mainfrom
claude/vg-ffdh-cached-internal

Conversation

@alex

@alex alex commented Nov 9, 2026

Copy link
Copy Markdown
Member

Part of #4548. vg_ffdh_generate_key_cached is called only by verified code, the cached key search (vg_ffdh_generate_key_search_cached). Rust called it only from one #[cfg(test)] helper. So it stops being a public Api, and the emitter writes it as an internal function of the search.

What changes

Proofs.

  • New Proof/Ffdh/CachedGenerateKeyContract.lean holds Proof.Ffdh.cachedGenerateKeySig and cachedGenerateKeyContract, unchanged copies of the Spec.Ffdh ones.
  • Every proof that stated the attempt's contract now names these copies, on all five targets and in GenerationPolicy.
  • Code that calls the attempt now names it by its string, "vg_ffdh_generate_key_cached", where it used to read Spec.Ffdh.cachedGenerateKeyApi.name. That applies to Impl/Ffdh/X86/Cached.lean and the search proofs.

Registrations (Artifacts/Ffdh/<Target>.lean).

  • The five cachedGenerateKeyApi entries are removed.
  • The Cached.AttemptVerified imports that only those entries used are removed.

Generated crates. Regenerated:

  • The attempt's code moves to internal/vg_ffdh_generate_key_cached*.rs (and assembly/internal/*.s).
  • Its dispatcher and public declarations are gone.

Rust.

  • cache_tests::clones_share_immutable_context_and_keep_it_alive now runs the key search on the same draw, through key_state and key_search, with a fresh state each time. It expects status 1 with the 64 bytes consumed.
  • The test-only Domain::generate_key and its import are deleted.

CI data. ci/residue_allowlist.txt loses x86_64 vg_ffdh_generate_key_cached and _adx. They now name no public function, so the emitter refuses them, and the list only shrinks.

No Spec/ or TCB/ change. The follow-up Spec PR deletes Spec.Ffdh.cachedGenerateKeySig, cachedGenerateKeyContract and cachedGenerateKeyApi.

Checks

  • Run locally before the rebase onto main:
    • lake build (all modules), Emit.lean, and Emit.lean --check after trimming the registration imports
    • the Static checks job's scripts
    • check_lean_public_imports.py on each edited module
    • cargo fmt --check, cargo clippy --all-targets -D warnings
    • cargo test with Wycheproof, and the FFDH tests with VG_CPU_FEATURES=none
  • main's only change since was Spec: delete the AES block functions' Apis and contracts #4874, AES's Spec.

Generated by Claude Code

Only verified code, the cached key search, calls
vg_ffdh_generate_key_cached; Rust called it only from a test. Its
registrations go, so the emitter writes it as an internal function of the
search, and its signature and contract move to
Proof/Ffdh/CachedGenerateKeyContract.lean (copies of the Spec ones,
which a follow-up Spec PR deletes). The code that calls it names the
function by its string.

The test that a cloned domain keeps its context now runs the key search
on the same draw. The residue allowlist loses the function's two lines,
which name no public function any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHFjAR7Byf513R4zuFy
@alex
alex enabled auto-merge November 9, 2026 23:19
@alex
alex added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit f47d0de Nov 9, 2026
41 checks passed
@alex
alex deleted the claude/vg-ffdh-cached-internal branch November 9, 2026 23:26
alex pushed a commit that referenced this pull request Nov 9, 2026
main (#4875) removed the test-only Domain::generate_key; keep its
removal, with the lazy context's tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHGTYqNsecxgCdT9ZaD
alex pushed a commit that referenced this pull request Nov 15, 2026
`vg_ffdh_generate_key_cached` is internal on main (#4875, #4876): the
registration drops its artifact and its proofs name
`Proof.Ffdh.cachedGenerateKeyContract`. Generic callers are ordinary
registrations (#4654), so the sieved parameter search is registered in
`Artifacts/Ffdh/RISCV64.lean` over `Proof.Variants.MillerRabin.RISCV64`,
as on PPC64LE. `Shape.lean` uses the shared `RsaKeyGen.wv_half` that
replaced FFDH's `WordHalf` (#5059).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHHEKNw8eCDhgbwoFBL
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