From 60afebf116799b29826db090e4e3622f9b314a52 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 10 Nov 2017 19:01:16 -0500 Subject: [PATCH] swtpm: Log an error if data encryption failed Signed-off-by: Stefan Berger --- src/swtpm/swtpm_nvfile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/swtpm/swtpm_nvfile.c b/src/swtpm/swtpm_nvfile.c index c8637df..c185371 100644 --- a/src/swtpm/swtpm_nvfile.c +++ b/src/swtpm/swtpm_nvfile.c @@ -382,6 +382,10 @@ SWTPM_NVRAM_StoreData_Intern(const unsigned char *data, if (rc == 0 && encrypt) { rc = SWTPM_NVRAM_EncryptData(&filekey, &encrypt_data, &encrypt_length, data, length); + if (rc) { + logprintf(STDERR_FILENO, + "SWTPM_NVRAM_EncryptData failed: 0x%02x\n", rc); + } if (encrypt_data) { TPM_DEBUG(" SWTPM_NVRAM_StoreData: Encrypted %u bytes before " "write, will write %u bytes\n", length, encrypt_length);