diff options
| author | Jarkko Sakkinen <jarkko.sakkinen@opinsys.com> | 2025-09-30 16:02:54 +0300 |
|---|---|---|
| committer | Jarkko Sakkinen <jarkko@kernel.org> | 2025-12-03 22:55:28 +0200 |
| commit | 7fcf459ac84c42a4ef63a650dccc345602cf4da6 (patch) | |
| tree | f7a17e12ae2b2c0102898d1375d7c71985cc5c2c | |
| parent | faf07e611dfa464b201223a7253e9dc5ee0f3c9e (diff) | |
tpm: Use -EPERM as fallback error code in tpm_ret_to_err
Using -EFAULT as the tpm_ret_to_err() fallback error code causes makes it
incompatible on how trusted keys transmute TPM return codes.
Change the fallback as -EPERM in order to gain compatibility with trusted
keys. In addition, map TPM_RC_HASH to -EINVAL in order to be compatible
with tpm2_seal_trusted() return values.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@opinsys.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
| -rw-r--r-- | include/linux/tpm.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 53de9488c509..3d8f7d1ce2b8 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -456,8 +456,10 @@ static inline ssize_t tpm_ret_to_err(ssize_t ret) return 0; case TPM2_RC_SESSION_MEMORY: return -ENOMEM; + case TPM2_RC_HASH: + return -EINVAL; default: - return -EFAULT; + return -EPERM; } } |