blob: d59a8d397a9a1a78df36a852a9d6d4869115ae6b [file] [log] [blame] [view]
Gilles Peskine9dbbc292021-06-22 18:28:13 +02001Signature functions now require the hash length to match the expected value
2---------------------------------------------------------------------------
Manuel Pégourié-Gonnarde7885e52021-06-22 12:29:27 +02003
Gilles Peskine9dbbc292021-06-22 18:28:13 +02004This 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.
Manuel Pégourié-Gonnarde7885e52021-06-22 12:29:27 +02005
6All the functions in the RSA module that accept a `hashlen` parameter used to
7ignore it unless the `md_alg` parameter was `MBEDTLS_MD_NONE`, indicating raw
Gilles Peskine9dbbc292021-06-22 18:28:13 +02008data was signed. The `hashlen` parameter is now always the size that is read
9from the `hash` input buffer. This length must be equal to the output size of
10the hash algorithm used when signing a hash. (The requirements when signing
11raw data are unchanged.) This affects the following functions:
12
13* `mbedtls_rsa_pkcs1_sign`, `mbedtls_rsa_pkcs1_verify`
14* `mbedtls_rsa_rsassa_pkcs1_v15_sign`, `mbedtls_rsa_rsassa_pkcs1_v15_verify`
15* `mbedtls_rsa_rsassa_pss_sign`, `mbedtls_rsa_rsassa_pss_verify`
16* `mbedtls_rsa_rsassa_pss_sign_ext`, `mbedtls_rsa_rsassa_pss_verify_ext`
17
18The 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:
19
20* `mbedtls_pk_sign`, `mbedtls_pk_verify`
21* `mbedtls_pk_sign_restartable`, `mbedtls_pk_verify_restartable`
22* `mbedtls_pk_verify_ext`
Manuel Pégourié-Gonnarde7885e52021-06-22 12:29:27 +020023
24The migration path is to pass the correct value to those functions.