Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modexp: 2.5x accel on small exponent #268

Merged
merged 3 commits into from
Sep 9, 2023
Merged

Conversation

mratsim
Copy link
Owner

@mratsim mratsim commented Sep 8, 2023

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
18 checks passed
@mratsim mratsim deleted the fuzz-6-modexp-slow-3 branch September 17, 2023 16:49
@mratsim
Copy link
Owner Author

mratsim commented Oct 18, 2023

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