arm-trusted-firmware/drivers/auth
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
..
cca feat(auth): add CCA NV ctr to CCA CoT 2023-05-25 16:40:43 -05:00
dualroot refactor(mbedtls): avoid including MBEDTLS_CONFIG_FILE 2023-02-21 11:09:47 +00:00
mbedtls fix(mbedtls): sign verification issue with invalid Key/Signature 2024-06-19 22:56:35 +02:00
tbbr refactor(auth): remove HW_CONFIG reference from BL1 CoT file 2024-06-05 10:20:36 +01:00
auth_mod.c feat(fwu): modify the check for getting the FWU bank's state 2024-03-01 14:19:56 +05:30
crypto_mod.c refactor(auth): replace plat_convert_pk 2023-04-21 09:46:01 +01:00
img_parser_mod.c Coverity: remove unnecessary header file includes 2020-02-04 10:23:51 -06:00