-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4707 from gilles-peskine-arm/require-matching-has…
…hlen-rsa-implementation Require matching hashlen in RSA functions: implementation
- Loading branch information
Showing
13 changed files
with
144 additions
and
116 deletions.
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,5 @@ | ||
API changes | ||
* Signature functions in the RSA and PK modules now require the hash | ||
length parameter to be the size of the hash input. For RSA signatures | ||
other than raw PKCS#1 v1.5, this must match the output size of the | ||
specified hash algorithm. |
24 changes: 24 additions & 0 deletions
24
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,24 @@ | ||
Signature functions now require the hash length to match the expected value | ||
--------------------------------------------------------------------------- | ||
|
||
This affects users of the PK API as well as users of the low-level API in the RSA module. Users of the PSA API or of the ECDSA module are unaffected. | ||
|
||
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. The `hashlen` parameter is now always the size that is read | ||
from the `hash` input buffer. This length must be equal to the output size of | ||
the hash algorithm used when signing a hash. (The requirements when signing | ||
raw data are unchanged.) This affects the following functions: | ||
|
||
* `mbedtls_rsa_pkcs1_sign`, `mbedtls_rsa_pkcs1_verify` | ||
* `mbedtls_rsa_rsassa_pkcs1_v15_sign`, `mbedtls_rsa_rsassa_pkcs1_v15_verify` | ||
* `mbedtls_rsa_rsassa_pss_sign`, `mbedtls_rsa_rsassa_pss_verify` | ||
* `mbedtls_rsa_rsassa_pss_sign_ext`, `mbedtls_rsa_rsassa_pss_verify_ext` | ||
|
||
The signature functions in the PK module no longer accept 0 as the `hash_len` parameter. The `hash_len` parameter is now always the size that is read from the `hash` input buffer. This affects the following functions: | ||
|
||
* `mbedtls_pk_sign`, `mbedtls_pk_verify` | ||
* `mbedtls_pk_sign_restartable`, `mbedtls_pk_verify_restartable` | ||
* `mbedtls_pk_verify_ext` | ||
|
||
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
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.