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/MakeCredential.c b/MakeCredential.c
index bf6de6a..36ee5a1 100644
--- a/MakeCredential.c
+++ b/MakeCredential.c
@@ -50,7 +50,7 @@
// Make encrypt key and its associated secret structure.
// Even though CrypeSecretEncrypt() may return
- out->secret.t.size = sizeof(out->secret.t.buffer);
+ out->secret.t.size = sizeof(out->secret.t.secret);
result = CryptSecretEncrypt(in->handle, "IDENTITY", &data, &out->secret);
if(result != TPM_RC_SUCCESS)
return result;