From 63f70197c8bf43a7c4c07d5a628491c698c50ce6 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Mon, 13 Nov 2017 19:28:12 -0500 Subject: [PATCH] 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 --- src/tpm_tpm2_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tpm_tpm2_interface.c b/src/tpm_tpm2_interface.c index a53db0f0..3fbf4a9d 100644 --- a/src/tpm_tpm2_interface.c +++ b/src/tpm_tpm2_interface.c @@ -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 */