Skip to content

RSA private exponentiation: multiply blinding invert in Mont - #6955

Merged
JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
SparkiDev:rsa_dec_inv_blind_mul_mont
Nov 28, 2023
Merged

JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
SparkiDev:rsa_dec_inv_blind_mul_mont

Conversation

@SparkiDev

Copy link
Copy Markdown
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

philljj commented Nov 9, 2023

Copy link
Copy Markdown
Contributor

Retest this please.

@philljj philljj self-assigned this Nov 9, 2023
@philljj

philljj commented Nov 9, 2023

Copy link
Copy Markdown
Contributor

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

philljj commented Nov 14, 2023

Copy link
Copy Markdown
Contributor

Testing in progress.

When blinding, multiply result of exponentiation my blinding invert in
Montgomery form to make code more constant time.
@SparkiDev
SparkiDev force-pushed the rsa_dec_inv_blind_mul_mont branch from c1bcd57 to d3448e2 Compare November 17, 2023 05:20
@philljj

philljj commented Nov 17, 2023

Copy link
Copy Markdown
Contributor

New testing in progress.

@philljj philljj left a comment

Copy link
Copy Markdown
Contributor

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

@JacobBarthelmeh JacobBarthelmeh left a comment

Copy link
Copy Markdown
Contributor

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
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