aboutsummaryrefslogtreecommitdiff
path: root/Global.h
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2016-12-12 17:31:58 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-15 14:49:15 -0800
commit1d3ac310707d4c587b275b2683c26eb5cde32123 (patch)
tree4625d650ac77e15e668bf5f424c183d9b790eeb1 /Global.h
parentabb7a18cbd57bb1bbaf56b91d5cbf8cb26fb69a9 (diff)
downloadtpm2-1d3ac310707d4c587b275b2683c26eb5cde32123.tar.gz
Add a build-time assert for sizeof(OBJECT)
Add a build assert that checks the sizeof the tpm2 OBJECT struct. This check indicates that NV_FORMAT_VERSION needs to be bumped, due to a change to tpm2 data structures. BRANCH=none BUG=none TEST=build succeeds Change-Id: Id6cddd7bec10ebf0aa78e2199826fb6e1ff4fd8c Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/419120 Commit-Ready: Nagendra Modadugu <ngm@google.com> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'Global.h')
-rw-r--r--Global.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Global.h b/Global.h
index 057fa89..5b868ad 100644
--- a/Global.h
+++ b/Global.h
@@ -190,6 +190,12 @@ typedef struct
TPM2B_NAME name; // Name of the object name. Kept here
// to avoid repeatedly computing it.
} OBJECT;
+#ifdef EMBEDDED_MODE
+// This build time assert serves as a rudimentary check for changes
+// to the OBJECT structure (which is serialized to NVmem). Whenever
+// the OBJECT struct changes, NV_FORMAT_VERSION ought to be bumped.
+struct size_check { char a[sizeof(OBJECT) == 1536 ? 1 : -1]; };
+#endif
//
//
// HASH_OBJECT Structure