-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Require matching hashlen in RSA functions #4702
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b795332
mbedtls_rsa_rsassa_pss_*: improve documentation
yanesca 0af093b
PSA RSA PSS: pass pre-hash algorithm to Mbed TLS
yanesca ae50d28
Fix verify_hash tests for PSA RSA PSS
yanesca 4c0b60e
Fix exercise key test
yanesca 3dd3ff0
Add ChangeLog entry
yanesca ab97e00
Improve psa_rsa_decode_md_type()
yanesca e7885e5
RSA: Require hashlen to match md_alg when applicable
mpg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Bugfix | ||
* psa_verify_hash() was relying on implementation-specific behavior of | ||
mbedtls_rsa_rsassa_pss_verify() and was causing failures in some _ALT | ||
implementations. This reliance is now removed. Fixes #3990. | ||
* Disallow inputs of length different from the corresponding hash when | ||
signing or verifying with PSA_ALG_RSA_PSS (The PSA Crypto API mandates | ||
that PSA_ALG_RSA_PSS uses the same hash throughout the algorithm.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
API changes | ||
* Functions in the RSA module that accept a hashlen parameter now require | ||
it to match the output size of the hash algorithm used, except when | ||
signing raw data. |
13 changes: 13 additions & 0 deletions
13
docs/3.0-migration-guide.d/require-matching-hashlen-rsa.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
RSA signature functions now require `hashlen` to match the expected value | ||
------------------------------------------------------------------------- | ||
|
||
This only affects users of the low-level RSA API; users of the high-level PK | ||
API or of the PSA Crypto API are not affected. | ||
|
||
All the functions in the RSA module that accept a `hashlen` parameter used to | ||
ignore it unless the `md_alg` parameter was `MBEDTLS_MD_NONE`, indicating raw | ||
data was signed. They now require this parameter's value to be equal to the | ||
output size of the hash algorithm used when signing a hash. (The requirements | ||
when signing raw data are unchanged.) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be convenient to have the list of affected functions:
|
||
The migration path is to pass the correct value to those functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the salient point is that
hashlen
is now the size that is read from the buffer.