tpm2: Return TPM_RC_VALUE upon decryption failure

When decryption fails then return TPM_RC_VALUE rather than TPM_RC_FAILURE.
The old error code could indicate to an application or driver that
something is wrong with the TPM (has possibly gone into failure mode) even
though only the decryption failed, possibly due to a wrong key.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2024-07-29 10:19:00 -04:00 committed by Stefan Berger
parent d3ce650f93
commit 037eb0e2bb

View File

@ -1708,7 +1708,7 @@ CryptRsaDecrypt(
outlen = sizeof(buffer);
if (EVP_PKEY_decrypt(ctx, buffer, &outlen,
cIn->buffer, cIn->size) <= 0)
ERROR_EXIT(TPM_RC_FAILURE);
ERROR_EXIT(TPM_RC_VALUE);
if (outlen > dOut->size)
ERROR_EXIT(TPM_RC_FAILURE);