Skip to content

AArch64 Brainpool-P512 signing with a fixed-base comb - #4515

Merged
reaperhulk merged 1 commit into
mainfrom
codex/arm64-brainpool512-comb
Nov 7, 2026
Merged

reaperhulk merged 1 commit into
mainfrom
codex/arm64-brainpool512-comb

Conversation

@reaperhulk

@reaperhulk reaperhulk commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Brainpool-P512 signing on AArch64 currently computes nonce points with the general scalar multiplier. Use the existing shared 7-bit fixed-base comb table and AArch64 complete general-curve comb instead: 74 additions per nonce candidate, following x86-64 #4425.

Rebased onto 079a361738dc8ae4273d37114e38fdf15ae6fbd6 after #4512 merged. This PR contains only the P512 change. The existing shared table certificate is reused, with arithmetic, ABI, constant-time and RFC 6979 composition proofs. No TCB/spec/public-API changes. The shared read-only table adds 592 KiB; per-key storage and the 8 KiB workspace stay unchanged. Verification, ECDH and public-key derivation retain their existing paths.

M1 Max, macOS 27.2, Rust 1.99.0 / LLVM 23.1.1, OpenSSL 4.0.3, normal CPU detection. Production comparison against 335bd82bbc4e972a57ec7b9a16c29e0664378ed4 (which leaves P512 unchanged), measured implementation e4006b65a0df22b0c87d98389547f9e081c6d2cf:

SHA-512 signing Parent This PR OpenSSL
64-byte message 1.82 ms 176.25 µs 871.71 µs
1 KiB 912.71 µs 89.33 µs 871.46 µs
16 KiB 921.86 µs 98.61 µs 884.22 µs
Prehashed, 64 bytes 912.75 µs 88.33 µs 869.88 µs

Three interleaved rounds and three fresh binary copies, 25 samples, 0.3 s warm-up, 1 s measurement per case; the repository harness reports the fastest per-round median and fastest copy. Copy spread: 0.1–0.4% for parent, 0.5–0.9% for head. OpenSSL ran once for reference. The 64-byte fixed message takes an extra deterministic nonce attempt on both VG versions; the retry policy is preserved. These are steady-state API timings, including hashing where applicable.

The benchmark harness includes P512 signing in fresh-copy handling for its large comb table. No measurement artifacts are committed.

Validation:

  • Full Lean build after rebase: 28,622 jobs; full Emit.lean --check, including all artifact audits. The P512 implementation, proofs and generated signing code/table are unchanged from the measured revision.
  • Public-import audit, Static checks, formatting and Clippy with warnings denied.
  • 241 unit, 141 CAVP and 299 integration tests, including published vectors and Wycheproof, pass. Six Brainpool-P512 integration tests also pass with VG_CPU_FEATURES=none.

Scoped native N2 benchmark passed. N2 reference: OpenSSL 3.5.5, the runner system library.

SHA-512 signing N2 parent N2 this PR N2 OpenSSL
64-byte message 2.72 ms 256.07 µs 1.27 ms
1 KiB 1.36 ms 129.46 µs 1.27 ms
16 KiB 1.37 ms 141.02 µs 1.28 ms
Prehashed, 64 bytes 1.36 ms 128.55 µs 1.26 ms

Three interleaved rounds and three fresh binary copies. N2 head copy spread was 4.7–5.4%, versus 0.1% for parent; these are the harness's fastest-copy/round results. The improvement remains large for every measured copy. OpenSSL ran once for reference; exact runner and toolchain metadata are in the linked run.

Base automatically changed from codex/arm64-brainpool384-comb to main November 7, 2026 18:41
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

This pull request has conflicts with main, found after f63a8d0 landed on main: rebase it to resolve them. Before rebasing, see CLAUDE.md on checking how much Lean main changed, and on restacking a stacked pull request.

Posted by .github/workflows/conflicts.yml, once per push to a conflicting pull request.

@reaperhulk
reaperhulk force-pushed the codex/arm64-brainpool512-comb branch from e4006b6 to 1513e86 Compare November 7, 2026 20:07
@reaperhulk
reaperhulk enabled auto-merge November 7, 2026 20:07
@reaperhulk
reaperhulk added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 559c47c Nov 7, 2026
23 checks passed
@reaperhulk
reaperhulk deleted the codex/arm64-brainpool512-comb branch November 7, 2026 20:21
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.

1 participant