summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Pronin <apronin@chromium.org>2018-03-22 15:38:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-26 20:16:46 -0700
commitd3ec8f8116b167f58d76f0c798ae1b4d14aec389 (patch)
treeff4750e456e6e2cbb2fa292040e0ddd261dde4e9
parenta040600eaa03c3be54bce5381a4ca38c9ba6fc1f (diff)
downloadvboot-d3ec8f8116b167f58d76f0c798ae1b4d14aec389.tar.gz
firmware: move TPM_E constants to tss_constants.h
The constants from the list defined in tss_constants.h should be the same values regardless of TPM 1.2 vs 2.0 spec version since AP firmware checks for those exact values in certain cases. Stop defining them separately for TPM 1.2 and 2.0 and move to the common tss_constants.h. Before the change, even though TPM_E constants were defined in TPM spec dependent files, they were defined identically. So, no changes to the behavior are caused by this CL. This is a preparatoryy change to fixing error handling for Tlcl and mount-encrypted. BUG=chromium:702724 BRANCH=none TEST=emerge vboot_reference Change-Id: Ib7a5f41ca55579d053ba63ce07f4bed1394e7ae9 Signed-off-by: Andrey Pronin <apronin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/976871 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--firmware/include/tpm1_tss_constants.h14
-rw-r--r--firmware/include/tpm2_tss_constants.h9
-rw-r--r--firmware/include/tss_constants.h21
3 files changed, 21 insertions, 23 deletions
diff --git a/firmware/include/tpm1_tss_constants.h b/firmware/include/tpm1_tss_constants.h
index 972f7a3b..97d7358f 100644
--- a/firmware/include/tpm1_tss_constants.h
+++ b/firmware/include/tpm1_tss_constants.h
@@ -16,20 +16,6 @@
#define TPM_PUBEK_SIZE 256
#define TPM_PCR_DIGEST 20
-#define TPM_E_NON_FATAL 0x800
-
-#define TPM_E_AREA_LOCKED ((uint32_t) 0x0000003c)
-#define TPM_E_BADINDEX ((uint32_t) 0x00000002)
-#define TPM_E_BAD_ORDINAL ((uint32_t) 0x0000000a)
-#define TPM_E_BAD_PRESENCE ((uint32_t) 0x0000002d)
-#define TPM_E_IOERROR ((uint32_t) 0x0000001f)
-#define TPM_E_INVALID_POSTINIT ((uint32_t) 0x00000026)
-#define TPM_E_MAXNVWRITES ((uint32_t) 0x00000048)
-#define TPM_E_OWNER_SET ((uint32_t) 0x00000014)
-
-#define TPM_E_NEEDS_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 1))
-#define TPM_E_DOING_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 2))
-
#define TPM_NV_INDEX0 ((uint32_t) 0x00000000)
#define TPM_NV_INDEX_LOCK ((uint32_t) 0xffffffff)
#define TPM_NV_PER_GLOBALLOCK (((uint32_t) 1) << 15)
diff --git a/firmware/include/tpm2_tss_constants.h b/firmware/include/tpm2_tss_constants.h
index f44dc715..498cc954 100644
--- a/firmware/include/tpm2_tss_constants.h
+++ b/firmware/include/tpm2_tss_constants.h
@@ -30,15 +30,6 @@
#define TPM2_NV_ReadPublic ((TPM_CC)0x00000169)
#define TPM2_GetCapability ((TPM_CC)0x0000017A)
-/* TCG Spec defined, verify for TPM2.
- * TODO(apronin): find TPM2 RC substitutes for TPM1.2 error codes.
- */
-#define TPM_E_BADINDEX ((uint32_t) 0x00000002)
-#define TPM_E_INVALID_POSTINIT ((uint32_t) 0x00000026)
-#define TPM_E_BADTAG ((uint32_t) 0x0000001E)
-#define TPM_E_IOERROR ((uint32_t) 0x0000001F)
-#define TPM_E_MAXNVWRITES ((uint32_t) 0x00000048)
-
#define HR_SHIFT 24
#define TPM_HT_NV_INDEX 0x01
#define HR_NV_INDEX (TPM_HT_NV_INDEX << HR_SHIFT)
diff --git a/firmware/include/tss_constants.h b/firmware/include/tss_constants.h
index e85fa817..1fe92b92 100644
--- a/firmware/include/tss_constants.h
+++ b/firmware/include/tss_constants.h
@@ -24,6 +24,27 @@
#define TPM_E_STRUCT_SIZE ((uint32_t) 0x0000500b) /* vboot local */
#define TPM_E_STRUCT_VERSION ((uint32_t) 0x0000500c) /* vboot local */
+/*
+ * AP firmware relies on Tlcl returning these exact TPM1.2 error codes
+ * regardless of the TPM spec version in certain sitautions. So, TPM2.0 should
+ * map to these errors when necessary. All TPM2.0-spec-defined errors have
+ * either 0x100 or 0x80 bit set, so there is no confusion with actual error
+ * codes returned from a TPM2.0 chip.
+ */
+#define TPM_E_BADINDEX ((uint32_t) 0x00000002)
+#define TPM_E_BAD_ORDINAL ((uint32_t) 0x0000000a)
+#define TPM_E_OWNER_SET ((uint32_t) 0x00000014)
+#define TPM_E_BADTAG ((uint32_t) 0x0000001e)
+#define TPM_E_IOERROR ((uint32_t) 0x0000001f)
+#define TPM_E_INVALID_POSTINIT ((uint32_t) 0x00000026)
+#define TPM_E_BAD_PRESENCE ((uint32_t) 0x0000002d)
+#define TPM_E_AREA_LOCKED ((uint32_t) 0x0000003c)
+#define TPM_E_MAXNVWRITES ((uint32_t) 0x00000048)
+
+#define TPM_E_NON_FATAL 0x800
+#define TPM_E_NEEDS_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 1))
+#define TPM_E_DOING_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 2))
+
#ifdef TPM2_MODE
#include "tpm2_tss_constants.h"
#else