summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-11-02 10:59:46 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-11-10 12:25:34 -0800
commitd28b4e1444372e709729787be6e81490e46c202d (patch)
treecd2c3f7235f16261e243552e047f67ea93264b37
parent6a2f9c5a5873427d9cb40d5f854b37f611d22f8d (diff)
downloadvboot-d28b4e1444372e709729787be6e81490e46c202d.tar.gz
tpm2_lite: do not ignore errors reported by TPM
Some tpm command wrappers ignore TPM return code, they should not report success in case TPM operation failed. BRANCH=none BUG=chrome-os-partner:55668 TEST=verified that tpmc on reef does not silently ignore tpm write errors any more. Change-Id: Id8955e3757948a3fd0972f88b569fb8828be7715 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/406516 Commit-Ready: Andrey Pronin <apronin@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--firmware/lib/tpm2_lite/tlcl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/firmware/lib/tpm2_lite/tlcl.c b/firmware/lib/tpm2_lite/tlcl.c
index 3b4ba480..e4f3b53b 100644
--- a/firmware/lib/tpm2_lite/tlcl.c
+++ b/firmware/lib/tpm2_lite/tlcl.c
@@ -448,7 +448,7 @@ uint32_t TlclWrite(uint32_t index, const void *data, uint32_t length)
response = tpm_process_command(TPM2_NV_Write, &nv_writec);
/* Need to map tpm error codes into internal values. */
- if (!response)
+ if (!response || response->hdr.tpm_code)
return TPM_E_WRITE_FAILURE;
return TPM_SUCCESS;
@@ -472,7 +472,7 @@ uint32_t TlclWriteLock(uint32_t index)
response = tpm_process_command(TPM2_NV_WriteLock, &nv_writelockc);
/* Need to map tpm error codes into internal values. */
- if (!response)
+ if (!response || response->hdr.tpm_code)
return TPM_E_WRITE_FAILURE;
return TPM_SUCCESS;
@@ -490,7 +490,7 @@ uint32_t TlclReadLock(uint32_t index)
response = tpm_process_command(TPM2_NV_ReadLock, &nv_readlockc);
/* Need to map tpm error codes into internal values. */
- if (!response)
+ if (!response || response->hdr.tpm_code)
return TPM_E_READ_FAILURE;
return TPM_SUCCESS;