Skip to content

Commit 7fcf459

Browse files
committed
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>
1 parent faf07e6 commit 7fcf459

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

include/linux/tpm.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,10 @@ static inline ssize_t tpm_ret_to_err(ssize_t ret)
456456
return 0;
457457
case TPM2_RC_SESSION_MEMORY:
458458
return -ENOMEM;
459+
case TPM2_RC_HASH:
460+
return -EINVAL;
459461
default:
460-
return -EFAULT;
462+
return -EPERM;
461463
}
462464
}
463465

0 commit comments

Comments
 (0)