Repository navigation
DSA parameter search over a refillable tape on AArch64 - #4297
Merged
reaperhulk merged 16 commits intoNov 6, 2026
Merged
Conversation
… and one seed over the refill window (WIP) The generator stage returns its end (1, 2 for an invalid domain, 3 without a generator) and the octets of the candidates it read; the refill controller's seed attempt runs it over the window of the tape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
… entry (WIP) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
… and start, the h tape reset per seed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
…tant time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
…r and proofs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
AArch64 joins x86-64 on the shared entropy::serve path, matching the SHA-1 and SHA-256 backends exhaustively over the four emitted variants. The three-tape path's AArch64 select and its test are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
This was referenced Nov 6, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
reaperhulk
deleted the
claude/unify-random-bytes-crypto-xqmg0z-dsa-aarch64
branch
November 6, 2026 08:22
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.
Moves AArch64's DSA parameter generation onto the refill protocol (
Spec/Dsa/ParameterSearch.lean,Spec/Entropy.lean) and deletes its old three-tape function and controller. AArch64 is the last architecture: with #4293, #4295 and #4296, no target callsgenerateParametersApiany more, and a follow-up removes it. This is an implementation PR: nothing inTCB/orSpec/changes.Lean
AArch64's generation was laid out like x86-64's old one, so this follows #4234: a new refill controller wraps the existing seed-attempt pieces. The q and p searches and their constant-time proofs are reused as they are.
Code
Impl/Dsa/AArch64/Generation/Refill.leanaddsvg_dsa_parameter_search(out, out_len, used, rand, rand_len, scratch, scratch_len, state):state[1];usedandstatepointers, the seeds left, and the current seed's start;32769·Lis spent; otherwise the request ismin(2·max(avail, 256·L), 32769·L);rand, at most128·pLenoctets;stateandusedpointers once at the end, so the stores have public addresses.code + 4·octets read, where code is 1 found, 2 invalid domain, 3 none. This changes the untrusted internal contractProof/Dsa/GeneratorStageContract.lean, which only AArch64 uses. The controller needs the count to know how much was consumed, and needs to tell no generator from an invalid domain.Generic/MdHash/MdHash/MillerRabin/AArch64/Dsa.leanagainstparameterSearchApi: the baseline,_sha1_sha2,_sha256_sha2and_sha1_sha2_sha256_sha2.vg_dsa_parameter_search_init(state, p_len)(Impl/Dsa/AArch64/ParameterSearch.lean, registered in the newArtifacts/Dsa/AArch64.lean) writes[4096, L, 32769·L, 512·L]and returns 1, or writes zeros and returns 0.Proofs (
Proof/Dsa/AArch64/Generation/)RefillOutcome,RefillAttempt,RefillABI,RefillEntry,RefillLoop,RefillFinish,RefillCorrect;RefillCTAttempt,RefillCTLoop,RefillCTFinish,RefillCT;RefillVerified, andProof/Dsa/AArch64/ParameterSearchInit.lean.refillAttempt,search_*andrequested_requestsfromProof/Dsa/Generation/.Generate.lean,seedAttempt,parameterSearchandgeneratorCall*.Rust
src/dsa/parameters/search.rsnow covers AArch64: an exhaustive match over the SHA-1/SHA-256 backends.search/tests.rschecks the dispatch table against the emitted feature sets and runs every variant the CPU supports.selectand its three-tape test are removed fromparameters.rs.Size
Checks
lake buildpasses.Emit.lean --checkpasses with the standard axiom audit. Nosorry,native_decide,bv_decideormaxHeartbeats.check_variants.check_lean_public_imports --base origin/mainpasses too.cargo fmtandclippy -D warningspass on x86-64 and onaarch64-unknown-linux-gnu.aarch64-unknown-linux-gnuunder qemu, with the detected features and withVG_CPU_FEATURES=none, and on x86-64.Benchmark
Run: https://github.com/pyca/verified-garbage/actions/runs/42145796502 (
arches: aarch64,modules: dsa, basemain).none)none)dsa_generate_parameters/1024dsa_generate_parameters/2048dsa_generate_parameters/3072These differences are not noise. The benchmark feeds a fixed tape (
fixed_tapeinbench/benches/primitives/main.rs). The base splits it into three tapes: seeds, h values, then witnesses. The refill search instead reads seeds, witnesses and h windows from one tape in order. So the same stream yields different seeds and witnesses, and the search does a different amount of work. The same shift appears on every architecture (#4293, #4295, #4296): about 1% less at 1024 bits, 2.5–3.5% less at 2048, and 4–6% more at 3072. It measures which candidates this one tape yields, not how fast the code runs. The other DSA benchmarks run code this PR does not change. They move only by noise, the largest being single runs of sub-microsecond key-construction timings.This conflicts with #4293, #4295 and #4296 only in the
cfgs ofsrc/dsa/parameters*.rs. I'll rebase it as they merge.🤖 Generated with Claude Code
https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub