Repository navigation
AArch64 P-384 verify: the allocated doubling in the public NAF - #2870
Merged
Merged
Conversation
This was referenced Oct 19, 2026
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ma2fA9rUTPXEEQjYyCMCRw
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ma2fA9rUTPXEEQjYyCMCRw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ma2fA9rUTPXEEQjYyCMCRw
alex
force-pushed
the
claude/a64-p384-verify-dbl
branch
from
October 20, 2026 06:27
8b6dc87 to
214352c
Compare
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 #991. Stacked on #2867.
P-384 ECDSA verification's
[v]Q(the public width-five NAF,PubNaf.window) doubles with the same window slots as ECDH. So it can use #2867's register-allocatedR→Ddoubling as it is. Before this PR, each of its 385 doublings was eight out-of-line calls tovg_p384_mul_mod_porvg_p384_sqr_mod_pand 16 additions or subtractions through memory.Changes
Implementation
PubNaf.window(Impl/Weierstrass/AArch64/PubNaf.lean) takes an optional doubling. The defaultnonekeeps the field program's.stepD K dis an iteration with the doublingd, andstepOf K ddchooses between the two.pubNafPointsandpubNafVerifypass the doubling through.verifyP384passessome (.block EcdhAllocatedCode.doubleRD).Proofs
Proof/Weierstrass/AArch64/PubNaf/StepD.lean.stepD_okisstep_okwith the doubling given by AArch64 P-384 ECDH: register-allocated doublings in the window #2867'sDblSpec(fromInvondblVR), andstepOf_okcovers either case.PubNaf/StepDTiming.lean.stepDRaw_relCTis the relational timing of such an iteration:x0.Dat the same values, becauseDblSpecfixes them from the shared values ofR.ro_unch).window_ok,pubNafMul_ok,pubNafPoints_ok,pubNafVerify_ok,loop_relCT,window_relCTandpubNafVerify_public_cttake the doubling, withNafDblOk(correctness) andNafDblCT(timing). P-521's packed NAF passesnone.Proof/Ecdsa/Verify/AArch64/P384/Verified.lean. Supplies the doubling's correctness fromP384.EcdhDouble.dblsOkand its timing fromCertificate.ctRD.No changes to
TCB/orSpec/.Speed
Neoverse N2, run 39270255193, compared with #2867's head (62ccb5c):
ecdsa_p384_sha384_verify64 B / 1 KiB / 16 KiBecdh_p384ecdsa_p384_sha384_sign64 B / 1 KiB / 16 KiBec_p384_public_keyVG_CPU_FEATURES=none, verify is 5.7–6.6% faster and every other row is within 0.0%.Checks
These pass locally:
lake buildsrc/asm/aarch64/ecdsa_p384.rschanges)check_lean_imports,check_lean_modules,check_registrations,check_lean_speed,check_vectors,check_arch_gates,check_variants,check_mcdt,cpu_tests.py lintalgorithms_table.py --checkGenerated by Claude Code