Skip to content

feat(twistededwards): add fixed-base base scalar mul for eddsa#839

Open
peter941221 wants to merge 2 commits into
Consensys:masterfrom
peter941221:issue/gnark-crypto-775
Open

feat(twistededwards): add fixed-base base scalar mul for eddsa#839
peter941221 wants to merge 2 commits into
Consensys:masterfrom
peter941221:issue/gnark-crypto-775

Conversation

@peter941221
Copy link
Copy Markdown

@peter941221 peter941221 commented May 16, 2026

Summary

  • add generator-driven fixed-base affine base-point scalar multiplication for twisted Edwards curves
  • use 4-bit windows with constant-time full-table scans from fixed-size scalar bytes
  • wire the new path into EdDSA GenerateKey, Sign, and [S]Base inside Verify without changing generic variable-base semantics

Validation

  • targeted Go tests passed across all generated twisted Edwards / EdDSA packages
  • added differential fixed-base vs generic tests plus EdDSA generic-reference regressions
  • local benchmarks show fixed-base affine base multiplication is consistently faster than the generic base path across the touched curves
  • local dudect-like timing checks passed on representative curves; this is timing evidence, not a formal proof

Ref #775.


Note

Medium Risk
Touches core elliptic-curve scalar multiplication and EdDSA keygen/sign/verify paths across multiple curves; any bug could break signature validity or introduce subtle side-channel/constant-time regressions despite added differential tests.

Overview
Adds a generator-driven, constant-time fixed-base scalar multiplication path for twisted Edwards curves via PointAffine.ScalarMultiplicationBase, using a lazily-initialized 4-bit window table and constant-time point selection.

Updates EdDSA implementations across supported curves to use the new fixed-base routine for public-key derivation in GenerateKey, computing R = [r]Base in Sign, and the [S]Base term in Verify.

Expands test coverage with generic-reference regressions and fixed-base vs generic differential checks, and adds benchmarks for keygen/sign plus generic-vs-fixed base multiplication performance comparisons.

Reviewed by Cursor Bugbot for commit 6a3b102. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 4ea721c. Configure here.

Comment thread internal/generator/edwards/eddsa/template/eddsa.go.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant