arm-trusted-firmware/drivers/auth/mbedtls
Manish V Badarkhe 7731465252 fix(mbedtls): sign verification issue with invalid Key/Signature
When the verify_signature function is called with the RSASSA_PSS
signature algorithm and a somewhat well-formed public key, invalid
signatures can be incorrectly verified due to this change [1].
This is primarily because of the introduction of the following code,
where a return check is missing before the goto:

  if (pk_alg == MBEDTLS_PK_RSASSA_PSS) {
     rc = pk_bytes_from_subpubkey((unsigned char **) &pk_ptr, &pk_len);
     goto end2;
  }

This code executes before the call to psa_verify_message. The
unconditional goto end2; branch leads to the immediate return of rc.
If the call to pk_bytes_from_subpubkey succeeds (i.e., the key is
formatted correctly), the signature is verified regardless of its
actual content.

This change [1] was included in the v2.11 release. Therefore, anyone
using this release with the PSA Crypto implementation must apply
this patch to ensure proper signature verification.

[1]: https://review.trustedfirmware.org/plugins/gitiles/TF-A/
trusted-firmware-a/+/55aed7d798f3d48d6aa08d58eb46c4cda318bcfb/drivers/
auth/mbedtls/mbedtls_psa_crypto.c#447

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Reported-by: Ryan Everett <ryan.everett@arm.com>
Change-Id: Ib484d97a04b7a82dd72592c8b5b153d577d01fc9
2024-06-19 22:56:35 +02:00
..
mbedtls_common.c refactor(mbedtls): avoid including MBEDTLS_CONFIG_FILE 2023-02-21 11:09:47 +00:00
mbedtls_common.mk feat(mbedtls): update config for 3.6.0 2024-05-09 18:44:38 +01:00
mbedtls_crypto.c feat(mbedtls): update config for 3.6.0 2024-05-09 18:44:38 +01:00
mbedtls_crypto.mk feat(mbedtls-psa): register an ad-hoc PSA crypto driver 2023-10-05 09:27:15 +01:00
mbedtls_psa_crypto.c fix(mbedtls): sign verification issue with invalid Key/Signature 2024-06-19 22:56:35 +02:00
mbedtls_x509.mk Create a library file for libmbedtls 2018-08-03 11:31:36 +01:00
mbedtls_x509_parser.c fix(auth): allow hashes of different lengths 2023-06-15 15:31:00 +02:00