cryptsetup: Give NV index missing its own error code
To be able to continue trying other tokens to unlock a disk the missing NV index case was mapped to EREMOTE (foreign TPM) which was ok because this mostly happens when trying to unlock on another system. Still it might be useful to deal with NV index errors differently. Give it its own EADDRNOTAVAIL error and handle it at all call sites.
This commit is contained in:
@@ -4753,8 +4753,8 @@ int tpm2_policy_authorize_nv(
|
||||
"Submitted policy does not match policy stored in PolicyAuthorizeNV.");
|
||||
if ((rc & ~(TPM2_RC_N_MASK|TPM2_RC_P)) == TPM2_RC_HANDLE ||
|
||||
rc == TPM2_RC_NV_UNINITIALIZED) /* NV index is missing, unwritten, or otherwise unusable for this policy (or: wrong authHandle/policySession). */
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EREMOTE),
|
||||
"NV index referenced by token is missing, unwritten, or unusable.");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EADDRNOTAVAIL),
|
||||
"NV index referenced by token is missing, unwritten, or unusable, it could be for another system.");
|
||||
if (rc != TSS2_RC_SUCCESS)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE),
|
||||
"Failed to add AuthorizeNV policy to TPM: %s",
|
||||
@@ -6667,7 +6667,8 @@ int tpm2_unseal(Tpm2Context *c,
|
||||
|
||||
/* Returns the following errors:
|
||||
*
|
||||
* -EREMOTE → blob is from a different TPM, or NV index referenced by policy is unusable
|
||||
* -EREMOTE → blob is from a different TPM
|
||||
* -EADDRNOTAVAIL → NV index referenced by policy is missing, unwritten, or unusable
|
||||
* -ENOSTR → signature JSON has no matching entry for the current PCR policy
|
||||
* -EDEADLK → couldn't create primary key because authorization failure
|
||||
* -ENOLCK → TPM is in dictionary lockout mode
|
||||
|
||||
Reference in New Issue
Block a user