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

Add support for RSA PSS and OAEP padding schemes #6

Merged
merged 8 commits into from
Mar 12, 2024

Conversation

simo5
Copy link
Member

@simo5 simo5 commented Feb 28, 2024

Change Rsa code to allow PSS and OAEP mechanisms

  • added PSS test
  • added OAEP tests

@simo5 simo5 added the enhancement New feature or request label Feb 28, 2024
@simo5 simo5 changed the title Add support for RSA PSS and OAEP padding schemes Draft: Add support for RSA PSS and OAEP padding schemes Feb 28, 2024
@simo5 simo5 force-pushed the rsa_pss_oaep branch 2 times, most recently from 7fb96f1 to 37552c0 Compare February 29, 2024 19:57
@simo5 simo5 changed the title Draft: Add support for RSA PSS and OAEP padding schemes Add support for RSA PSS and OAEP padding schemes Mar 8, 2024
@simo5 simo5 requested a review from Jakuje March 8, 2024 22:42
src/ossl/rsa.rs Show resolved Hide resolved
src/ossl/rsa.rs Outdated Show resolved Hide resolved
src/ossl/common.rs Show resolved Hide resolved
src/ossl/rsa.rs Outdated Show resolved Hide resolved
src/ossl/rsa.rs Show resolved Hide resolved
src/rsa.rs Outdated Show resolved Hide resolved
src/ossl/rsa.rs Outdated Show resolved Hide resolved
src/ossl/rsa.rs Outdated Show resolved Hide resolved
simo5 added 2 commits March 11, 2024 15:41
OpenSSL does not consider the padding type except for special TLS
padding, so even though it should know that PKCS1 1.5 padding implies
the output can't be larger than modulus length - 11, the decrypt
function requires a full modulus long output buffer.

Use a support buffer to bridge the required len if the application
provides a buffer that is long enough according to the PKCS#11 spec
but openssl considers too short.

Signed-off-by: Simo Sorce <[email protected]>
This allows in future to support different implementations haveing
support for different mechanisms for the same algorithm family.

Signed-off-by: Simo Sorce <[email protected]>
@simo5 simo5 requested a review from Jakuje March 11, 2024 21:02
@simo5
Copy link
Member Author

simo5 commented Mar 11, 2024

I should have addressed all the items except for mgf1_to_digest_buf() name one.

Copy link
Contributor

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

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

I think this is good to go regardless how the OAEP labels will evolve or the digest name buffers will change or not to avoid delaying the review more than needed.

Copy link
Contributor

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

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

one last typo in the tests comment, but it can be fixed later.

src/tests.rs Outdated Show resolved Hide resolved
simo5 added 3 commits March 12, 2024 12:19
Reuse the existing rsa_import function already use for private keys.
Move the constants in the implementation where they belong as the
supported key sizes depend on the implementation used.
Change the minimum key size in the fips implementation to reflect the
actual minimum for that implemenation.

Signed-off-by: Simo Sorce <[email protected]>
@simo5 simo5 merged commit eb11234 into latchset:main Mar 12, 2024
4 checks passed
@simo5
Copy link
Member Author

simo5 commented Mar 12, 2024

Merged! @Jakuje thanks for the thorough reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants