diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index ffab4fecaa0..313e821e9a4 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -2460,6 +2460,9 @@ static int tpm2_import( seed, symmetric ?: &(TPMT_SYM_DEF_OBJECT){ .algorithm = TPM2_ALG_NULL, }, ret_private); + if ((rc & ~(TPM2_RC_N_MASK|TPM2_RC_P)) == TPM2_RC_INTEGRITY) /* Return a recognizable error if this key does not belong to the local TPM */ + return log_debug_errno(SYNTHETIC_ERRNO(EREMOTE), + "Key invalid or does not belong to current TPM."); if (rc != TSS2_RC_SUCCESS) return log_debug_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "Failed to import key into TPM: %s", sym_Tss2_RC_Decode(rc));