From a83f2f89d4ef1e6ad4a73c486741240dc61bc834 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 6 Mar 2025 13:55:14 -0800 Subject: [PATCH] Cleanup to replace memcpy with public area copy function. Add CMake provisioning option (`WOLFTPM_PROVISIONING`) to match configure. --- CMakeLists.txt | 9 +++++++++ src/tpm2_wrap.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd4297..ec16da4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,15 @@ check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY) # * wait state # * small stack +# Provisioning +set(WOLFTPM_PROVISIONING "yes" CACHE STRING + "Enable support for Provisioning Initial Device Identity (IDevID) and Attestation Identity Keys (default: enabled)") +set_property(CACHE WOLFTPM_PROVISIONING + PROPERTY STRINGS "yes;no;verbose") +if(WOLFTPM_PROVISIONING) + list(APPEND WOLFTPM_DEFINITIONS + "-DWOLFTPM_PROVISIONING") +endif() # Enable Debugging set(WOLFTPM_DEBUG "no" CACHE STRING diff --git a/src/tpm2_wrap.c b/src/tpm2_wrap.c index 3a417f4..aaabf55 100644 --- a/src/tpm2_wrap.c +++ b/src/tpm2_wrap.c @@ -1871,7 +1871,7 @@ int wolfTPM2_CreateKey(WOLFTPM2_DEV* dev, WOLFTPM2_KEYBLOB* keyBlob, XMEMCPY(createIn.inSensitive.sensitive.userAuth.buffer, auth, createIn.inSensitive.sensitive.userAuth.size); } - XMEMCPY(&createIn.inPublic.publicArea, publicTemplate, sizeof(TPMT_PUBLIC)); + wolfTPM2_CopyPubT(&createIn.inPublic.publicArea, publicTemplate); #if 0 /* Optional creation nonce */