diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2016-11-02 10:59:46 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2017-01-15 15:02:30 +0000 |
commit | a682398cdaa2b7868fa7ef82bd55fd27a0e48474 (patch) | |
tree | a419fbfb0fd6e59b4eb7283ae54e01a91e338535 | |
parent | 0e18092bf180905a38ba12a340d742b351e13b61 (diff) | |
download | vboot-a682398cdaa2b7868fa7ef82bd55fd27a0e48474.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>
(cherry picked from commit d28b4e1444372e709729787be6e81490e46c202d)
Reviewed-on: https://chromium-review.googlesource.com/428190
Reviewed-by: Philip Chen <philipchen@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
-rw-r--r-- | firmware/lib/tpm2_lite/tlcl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/firmware/lib/tpm2_lite/tlcl.c b/firmware/lib/tpm2_lite/tlcl.c index 2e28e5b7..3baca122 100644 --- a/firmware/lib/tpm2_lite/tlcl.c +++ b/firmware/lib/tpm2_lite/tlcl.c @@ -422,7 +422,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; @@ -446,7 +446,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; @@ -464,7 +464,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; |