Repository navigation
Miller–Rabin x86-64 IFMA: 1024- and 1536-bit candidates (RSA-2048/3072 keygen, DSA-1024) - #4513
Merged
Merged
Conversation
…ndow math (WIP, unproven) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…ed MXCSR save; proof skeleton (WIP, contains sorry) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…roven Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…tlOk_of_noLoad Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…ather than never loaded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…und proofs) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
… (ctlC/ctlOk) rather than never loaded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…proven Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…he round; regenerate the crates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…A and FFDH parameter generation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
… x86-64 takes On aarch64, x86 and powerpc64 every implementation runs, so the skipped iteration's continue was never reached there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…n with the IFMA Miller–Rabin variant #4428's dispatchers, merged from main, now rank the _ifma instances. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
# Conflicts: # crates/verified-garbage-asm-x86_64/src/dispatch/ffdh.rs # src/ffdh/arithmetic.rs # src/ffdh/domain.rs # src/ffdh/generation.rs # src/ffdh/precomputed.rs
…to come) pay1024 and pay1536, one-lane layouts of 16 and 24 words, join AmmOk and UOk (the look-ahead, nl·R ≤ 10) with their kernel checks; the round's own MrOk lists its five layouts; code dispatches on 16 and 24 words first. mod_ofN, OutN.one' and ld52_ok take only what they use, so that the round's proofs reach the new layouts without changing PubOk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
…d 1536-bit candidates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u
alex
enabled auto-merge
November 7, 2026 18:08
6 tasks done
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.
Part of #4141. Follow-up to #4450.
What was slow
#4450's
vg_miller_rabin_round_ifmaran the IFMA round only for candidates of 32, 48 and 64 words. RSA-2048 and RSA-3072 key generation test 1024- and 1536-bit primes, and DSA-1024 a 1024-bit p, so on IFMA CPUs they still ran the ADX round.What changed
Impl/Rsa/X86_64/PubIfma.lean:pay1024 = ⟨5, 16, 20, 4, 1⟩(16 words, 20 limbs) andpay1536 = ⟨8, 24, 32, 4, 1⟩(24 words, 32 limbs). Both haveS = L, the radix the round's proofs use. The round'scodenow dispatches on 16, 24, 32, 48 and 64 words, and every other size still falls back to the ADX round.Proof/Bignum/X86_64/Ifma): the new layouts joinAmmOk. Both havenl·R ≤ 10, soammMultakes its look-ahead for them, and they also joinUOk. Each layout's per-step symbolic checks are added (checkStep,checkStepU,checkZerosU,checkStartU), checked by the kernel like every existing layout's. The case splits onAmmOkare widened.MrOk(the five one-lane layouts), instead ofPubOk. RSA's public operation and FFDH, which usePubOk, are unchanged. Three shared lemmas now take only what they use:mod_ofN(mod_ofstays as a wrapper).OutN.one'(OutN.onestays as a wrapper).ld52_ok, which now takesAmmOk; its three callers passhl.amm.vg_miller_rabin_round_ifmachanges, so the round's callers keep calling it. No new variant is added, so the dispatchers and README tables are unchanged.Correctness,
Keepsand the frame, and constant time (by taint on each layout's body, withRelCT.frame) are proven as in #4450. The MCDT prologue andctlOkare as before, andci/check_mcdt.pypasses. No contract changed.No TCB or Spec changes.
Numbers
One round, natively, same inputs (Intel Xeon @ 2.30 GHz with AVX512_IFMA):
cargo benchon the same machine, main / this PR, with the benchmarks' fixed tapes:Benchmarks workflow: run 6540 (x86_64, module
miller_rabin, against main, with OpenSSL). Its runner was an AMD EPYC 7763 with no AVX-512, so it chose the ADX round on both sides and measures only the code CPUs without IFMA run. Every benchmark is within 0.2% of main (RSA keygen/256 79.62 → 79.65 ms, /384 207.56 → 207.85 ms, DSA-1024 74.10 → 74.23 ms). The IFMA numbers above are from the local Xeon.Checks
check_lean_public_imports.pyon the changed modules.lake buildandEmit.leanpass.cargo test --features cpu-features-envpasses, unrestricted and underVG_CPU_FEATURES=avx,avx2,bmi2,adx. There are no Rust changes.🤖 Generated with Claude Code
https://claude.ai/code/session_01TKUFHEiNkt2jkCEfLQ6B2u