Changes to allow for libtpm2 compilation with marshaling code.
- New files tpm_generated.c and tpm_generated.h files add
functions to marshal and unmarshal TPM structures.
- New file marshal_test.c contains unit tests for
tpm_generated.c.
- Added missing types to TPM_Types.h and renamed structure
fields to match the spec.
- Made changes to scraped *.c files to match renaming changes
made to TPM_Types.h.
- Added tpm_generated.c to Makefile.
TEST=$ sudo emerge tpm2
builds libtpm2 with tpm_generated.c
$ gcc marshal_test.c -ltpm2 -lssl -lcrypto marshal-test
builds test exutable
$ ./marshal-test
passes all test cases
BUG=chromium:501639
Change-Id: Iea20a9d77f236bb5aee55a8b86dc39b58e340912
Reviewed-on: https://chromium-review.googlesource.com/282042
Reviewed-by: Utkarsh Sanghi <usanghi@chromium.org>
Commit-Queue: Jocelyn Bohr <bohr@chromium.org>
Tested-by: Jocelyn Bohr <bohr@chromium.org>
diff --git a/Duplicate.c b/Duplicate.c
index e022d08..1bf4d74 100644
--- a/Duplicate.c
+++ b/Duplicate.c
@@ -89,7 +89,7 @@
// Make encrypt key and its associated secret structure. A TPM_RC_KEY
// error may be returned at this point
- out->outSymSeed.t.size = sizeof(out->outSymSeed.t.buffer);
+ out->outSymSeed.t.size = sizeof(out->outSymSeed.t.secret);
result = CryptSecretEncrypt(in->newParentHandle,
"DUPLICATE", &data, &out->outSymSeed);
pAssert(result != TPM_RC_VALUE);