tpm2: NVRAM file does exist if we get TPM_DECRYPT_ERROR

In case the NVRAM file cannot be decrypted we get a TPM_DECRYPT_ERROR
error which also indicates that the file exists. So do not return FALSE
in this case, which would delete the existing file and start over with
a blank file.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2017-11-13 19:28:12 -05:00
parent 8fb8816c3c
commit 63f70197c8

View File

@ -80,7 +80,7 @@ TPM_BOOL _TPM2_CheckNVRAMFileExists(void)
if (cbs->tpm_nvram_loaddata) {
ret = cbs->tpm_nvram_loaddata(&data, &length, tpm_number, name);
TPM_Free(data);
if (ret == TPM_SUCCESS)
if (ret == TPM_SUCCESS || ret == TPM_DECRYPT_ERROR)
return TRUE;
}
#endif /* TPM_LIBTPMS_CALLBACKS */