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

RSA: Precompute R**3 and store it instead of R**2. #1817

Merged
merged 2 commits into from
Nov 23, 2023

Conversation

briansmith
Copy link
Owner

This saves two private-modulus-length multiplications per RSA private key operation at the cost of two private-modulus-length squarings per RsaKeyPair construction.

See each individual commit message for details.

Split the checking of the private modulus from the checking of the
private exponent so that we can do things in the order recommended
in the NIST spec.

This also facilitates storing R**3 instead of R**2 in the
`RsaKeyPair`. (We need R**2 during `RsaKeyPair` construction, but
R**3 afterwards.)
This saves two private-modulus-length multiplications per RSA
private key operation at the cost of two private-modulus-length
squarings per `RsaKeyPair` construction.
@briansmith briansmith self-assigned this Nov 23, 2023
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (6de2724) 96.00% compared to head (691278c) 96.00%.

Files Patch % Lines
src/arithmetic/montgomery.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1817      +/-   ##
==========================================
- Coverage   96.00%   96.00%   -0.01%     
==========================================
  Files         137      137              
  Lines       20727    20741      +14     
  Branches      226      226              
==========================================
+ Hits        19899    19912      +13     
- Misses        795      796       +1     
  Partials       33       33              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@briansmith briansmith merged commit 3145a79 into main Nov 23, 2023
136 of 138 checks passed
@briansmith briansmith deleted the b/split-privateprime branch November 23, 2023 03:16
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