diff options
author | nagendra modadugu <ngm@google.com> | 2016-12-12 17:31:58 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-12-15 14:49:15 -0800 |
commit | 1d3ac310707d4c587b275b2683c26eb5cde32123 (patch) | |
tree | 4625d650ac77e15e668bf5f424c183d9b790eeb1 /Global.h | |
parent | abb7a18cbd57bb1bbaf56b91d5cbf8cb26fb69a9 (diff) | |
download | tpm2-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.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 |