summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/tpm2_tlcl.c8
-rw-r--r--src/lib/tpm2_tlcl_structures.h10
2 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/tpm2_tlcl.c b/src/lib/tpm2_tlcl.c
index 754f835719..fde90a002a 100644
--- a/src/lib/tpm2_tlcl.c
+++ b/src/lib/tpm2_tlcl.c
@@ -210,7 +210,13 @@ uint32_t tlcl_read(uint32_t index, void *data, uint32_t length)
case 0:
break;
- case 0x28b:
+ /* Uninitialized, returned if the space hasn't been written. */
+ case TPM_RC_NV_UNINITIALIZED:
+ /*
+ * Bad index, cr50 specific value, returned if the space
+ * hasn't been defined.
+ */
+ case TPM_RC_CR50_NV_UNDEFINED:
return TPM_E_BADINDEX;
default:
diff --git a/src/lib/tpm2_tlcl_structures.h b/src/lib/tpm2_tlcl_structures.h
index 2d6164b1b7..4ea20783e5 100644
--- a/src/lib/tpm2_tlcl_structures.h
+++ b/src/lib/tpm2_tlcl_structures.h
@@ -121,8 +121,18 @@ struct tpm_header {
#define TPM_ST_NO_SESSIONS 0x8001
#define TPM_ST_SESSIONS 0x8002
+/* Values copied from tpm2/tpm_types.h */
#define RC_VER1 0x100
#define TPM_RC_INITIALIZE ((TPM_RC)(RC_VER1 + 0x000))
+#define TPM_RC_NV_UNINITIALIZED ((TPM_RC)(RC_VER1 + 0x04A))
+
+/*
+ * Cr50 returns this code when an attempt is made to read an NV location which
+ * has not yet been defined. This is an aggregation of various return code
+ * extensions which may or may not match if a different TPM2 device is
+ * used.
+ */
+#define TPM_RC_CR50_NV_UNDEFINED 0x28b
/* TPM command structures. */