[coreboot-gerrit] New patch to review for coreboot: vboot: TPM2 - report attempts to re-create NVRAM spaces
Vadim Bendebury (vbendeb@chromium.org)
gerrit at coreboot.org
Tue Nov 15 01:54:39 CET 2016
Vadim Bendebury (vbendeb at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17422
-gerrit
commit 718127702d88c54ba1e73d7e88928784949b4499
Author: Vadim Bendebury <vbendeb at chromium.org>
Date: Fri Nov 11 14:15:31 2016 -0800
vboot: TPM2 - report attempts to re-create NVRAM spaces
Currently the tlcl_define_space() function returns the same error
value for any non-zero TPM response code. The thing is that the caller
might want to allow attempts to re-create existing NVRAM spaces. This
patch adds a new API return value to indicate this condition and uses
it as appropriate.
BRANCH=none
BUG=chrome-os-partner:59654
TEST=for test purposes modified the code not to create the firmware
space, wiped out the TPM NVRAM and booted the device. Observed it
create kernel and MRC index spaces on the first boot and then
reporting return code 0x14c for already existing spaces on the
following restarts.
Change-Id: Ic183eb45e73edfbccf11cc19fd2f64f64274bfb2
Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
---
src/include/tpm_lite/tss_constants.h | 1 +
src/lib/tpm2_tlcl.c | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/include/tpm_lite/tss_constants.h b/src/include/tpm_lite/tss_constants.h
index 883a5ad..0aa032d 100644
--- a/src/include/tpm_lite/tss_constants.h
+++ b/src/include/tpm_lite/tss_constants.h
@@ -40,6 +40,7 @@
#define TPM_E_WRITE_FAILURE ((uint32_t)0x00005008) /* vboot local */
#define TPM_E_READ_EMPTY ((uint32_t)0x00005009) /* vboot local */
#define TPM_E_READ_FAILURE ((uint32_t)0x0000500a) /* vboot local */
+#define TPM_E_NV_DEFINED ((uint32_t)0x0000500b) /* vboot local */
#define TPM_NV_INDEX0 ((uint32_t)0x00000000)
#define TPM_NV_INDEX_LOCK ((uint32_t)0xffffffff)
diff --git a/src/lib/tpm2_tlcl.c b/src/lib/tpm2_tlcl.c
index 457e874..08bb405 100644
--- a/src/lib/tpm2_tlcl.c
+++ b/src/lib/tpm2_tlcl.c
@@ -359,6 +359,12 @@ uint32_t tlcl_define_space(uint32_t space_index, size_t space_size)
if (!response)
return TPM_E_NO_DEVICE;
- return response->hdr.tpm_code ? TPM_E_INTERNAL_INCONSISTENCY :
- TPM_SUCCESS;
+ switch(response->hdr.tpm_code) {
+ case 0:
+ return TPM_SUCCESS;
+ case 0x14c:
+ return TPM_E_NV_DEFINED;
+ default:
+ return TPM_E_INTERNAL_INCONSISTENCY;
+ }
}
More information about the coreboot-gerrit
mailing list