Repository navigation
brainpoolP384r1 x86-64: sign by the fixed-base comb for any a - #4425
Merged
Merged
Conversation
The x86-64 signature computed [k]G by the ladder of complete additions, 256 doublings and additions of 17 products each, since x86-64's comb adds by the complete formulas for a = -3 and brainpoolP256r1's a is not -3. Add TCombCfg.generalComb, the comb with the complete addition for any a (rcb, with 3b R mod p in the slot of -y, as AArch64's generalComb), its proof (generalComb_ok, from tcomb_ok's), and Cfg.signG, the signature with [k]G by it, from the 7-bit comb tables AArch64, ARMv7 and RISC-V already use (Proof/BrainpoolP256r1/Comb7.lean checks them): 37 additions. The tables are the static VG_BRAINPOOLP256R1_COMB, which the signing configuration declares as its gtab, so that combConsts and the RFC 6979 contract list it. ECDH, verification and the public key keep the ladder. No change to TCB/ or Spec/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHFtUGDUpzkcbWbx7P7
As brainpoolP256r1's: the signature computes [k]G by Cfg.signG, the comb whose additions are the complete ones for any a, from new 7-bit comb tables (Impl/BrainpoolP384r1/CombTable7.lean: [m 2^(7j)]G, m = 1 … 64, j < 55), which Proof/BrainpoolP384r1/Comb7.lean checks in the kernel (combChecksW, with the sums' certificate): 55 additions rather than the ladder's 384 doublings and additions. The tables are the static VG_BRAINPOOLP384R1_COMB, the signing configuration's gtab. ECDH, verification and the public key keep the ladder. No change to TCB/ or Spec/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHFtUGDUpzkcbWbx7P7
…h merge) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHFtUGDUpzkcbWbx7P7 # Conflicts: # crates/verified-garbage-asm-x86_64/src/consts/mod.rs
This was referenced Nov 7, 2026
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 (findings: #4141 (comment), "Brainpool ECDSA"). Follows #4406, which added the general-
acomb (TCombCfg.generalComb,Cfg.signG) for brainpoolP256r1; this applies it to brainpoolP384r1.What was slow
Before #4406, brainpoolP256r1 had the same problem. The x86-64 signature computed
[k]Gwithvg_brainpoolp384r1_mul, the ladder of complete additions: 384 doublings and additions, 17 field products each.What changed
Impl/BrainpoolP384r1/CombTable7.lean(new): the 7-bit comb tables,[m 2^(7j)]Gform = 1 … 64,j < 55, affine. They come from the same procedure asImpl/BrainpoolP256r1/CombTable7.lean(the generator reproduces that file byte for byte). The tables aren't trusted; the next file checks them.Proof/BrainpoolP384r1/Comb7.lean(new): the tables checked in the kernel (combChecksW, with the sums' certificate,combChecksW_of_fast). From the group law this givescombOk7 : CombOkW … 7 55 comb7 comb7Start, asProof/BrainpoolP256r1/Comb7.leandoes.Impl/Ecdsa/BrainpoolP384r1/X86_64.lean:signBrainpoolP384r1 := brainpoolp384r1S.signG brainpoolp384r1Comb, wherebrainpoolp384r1Sdeclares the staticVG_BRAINPOOLP384R1_COMBas itsgtab. That makes[k]G55 additions instead of the ladder's 384 steps.Verified.lean, RFC 6979 wrapper and registration: the same changes brainpoolP256r1 x86-64: sign by a fixed-base comb for any a #4406 made for brainpoolP256r1.Verified.leanusessignG_ok, and its constant-time check covers the table's symbol.No change to
TCB/orSpec/, and none to #4406's shared code. There's no new variant, so the README tables are unchanged.Numbers
Benchmarks workflow run on x86_64, against
f8911ef3,VG_CPU_FEATURESunset (all features): https://github.com/pyca/verified-garbage/actions/runs/42362046267ecdsa_brainpoolp384r1_sha384_sign/64ecdsa_brainpoolp384r1_sha384_sign/1024ecdsa_brainpoolp384r1_sha384_sign/16384ecdsa_brainpoolp384r1_sha384_sign_prehashed/48Local, on an
Intel(R) Xeon(R) Processor @ 2.1GHzwithcargo bench: sign/64 went from 943 µs to 96 µs (OpenSSL 742 µs), and sign_prehashed/48 from 1011 µs to 93 µs (OpenSSL 755 µs).Checks
These pass:
lake buildof everything the change and currentmainreachEmit.lean --checkcheck_lean_public_imports.pyon the edited modulescargo fmt --checkcargo test --releasewith Wycheproof (brainpool ECDSA, RFC 7027)No Rust source changed.
Branch note: #4406 was squash-merged from this branch and a force-push wasn't available, so the branch carries a merge of
mainafter its old commit. Againstmain, the diff is only this change (11 files).🤖 Generated with Claude Code
https://claude.ai/code/session_01TKUFHFtUGDUpzkcbWbx7P7