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 private exponentiation: multiply blinding invert in Mont #6955

Merged

Conversation

SparkiDev
Copy link
Contributor

Description

When blinding, multiply result of exponentiation my blinding invert in Montgomery form to make code more constant time.

Fixes zd#16722

Testing

Normal

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@SparkiDev SparkiDev self-assigned this Nov 9, 2023
@SparkiDev SparkiDev force-pushed the rsa_dec_inv_blind_mul_mont branch 2 times, most recently from d3bc4a7 to e1d99a8 Compare November 9, 2023 10:41
@philljj philljj self-requested a review November 9, 2023 16:00
@philljj
Copy link
Contributor

philljj commented Nov 9, 2023

Retest this please.

@philljj philljj self-assigned this Nov 9, 2023
@philljj
Copy link
Contributor

philljj commented Nov 9, 2023

Testing for this in progress, will take a few days to see results.

@SparkiDev SparkiDev force-pushed the rsa_dec_inv_blind_mul_mont branch 2 times, most recently from a346f75 to c1bcd57 Compare November 14, 2023 06:46
@philljj
Copy link
Contributor

philljj commented Nov 14, 2023

Testing in progress.

When blinding, multiply result of exponentiation my blinding invert in
Montgomery form to make code more constant time.
@philljj
Copy link
Contributor

philljj commented Nov 17, 2023

New testing in progress.

Copy link
Contributor

@philljj philljj left a comment

Choose a reason for hiding this comment

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

Results look good, I am happy with this.

@philljj philljj removed their assignment Nov 27, 2023
@SparkiDev SparkiDev assigned wolfSSL-Bot and unassigned SparkiDev Nov 27, 2023
Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh left a comment

Choose a reason for hiding this comment

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

Thanks Sean! Looks like possibly a slight decrease in RSA performance, but that's to be expected.

Before:

------------------------------------------------------------------------------
 wolfSSL version 5.6.4
------------------------------------------------------------------------------
Math: 	Multi-Precision: Wolf(SP) word-size=64 bits=4096 sp_int.c
wolfCrypt Benchmark (block bytes 1048576, min 1.0 sec each)
RSA     2048   public     32500 ops took 1.002 sec, avg 0.031 ms, 32446.105 ops/sec
RSA     2048  private       600 ops took 1.141 sec, avg 1.902 ms, 525.736 ops/sec

After:

RSA     2048   public     32300 ops took 1.001 sec, avg 0.031 ms, 32269.664 ops/sec
RSA     2048  private       600 ops took 1.126 sec, avg 1.877 ms, 532.791 ops/sec

@JacobBarthelmeh JacobBarthelmeh merged commit 61a2d2d into wolfSSL:master Nov 28, 2023
105 checks passed
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.

4 participants