Skip to content

modexp: 2.5x accel on small exponent - #268

Merged
mratsim merged 3 commits into
masterfrom
fuzz-6-modexp-slow-3
Sep 9, 2023
Merged

mratsim merged 3 commits into
masterfrom
fuzz-6-modexp-slow-3

Conversation

@mratsim

@mratsim mratsim commented Sep 8, 2023 •

Copy link
Copy Markdown
Owner

Improve a potential DOS vector for the modexp precompile.
The overhead of computing r² was too high, changing to the reduce operation compared to repeated doubling (which is used for the compile-time proc because reduce requires pointers) improves perf by 2.5x.

Todo:

  • Provide a vartime reduction to improve perf further
  • Use it at compile-time to improve compilation speed
  • Evaluate Barrett Reduction for small modexp instead of Montgomery
  • Or potentially just multiplication and modular reduction

@mratsim
mratsim merged commit 1575755 into master Sep 9, 2023
@mratsim
mratsim deleted the fuzz-6-modexp-slow-3 branch September 17, 2023 16:49
@mratsim

mratsim commented Oct 18, 2023

Copy link
Copy Markdown
Owner Author

Followed up by #286

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