aboutsummaryrefslogtreecommitdiffstats
path: root/tpm-util/duplicate/include
diff options
context:
space:
mode:
authorPramod Raghavendra Jayathirth <pramod.raghavendra.jayathirth@intel.com>2019-02-26 08:41:02 -0800
committerPramod <pramod.raghavendra.jayathirth@intel.com>2019-04-03 22:56:57 +0000
commit627d269bcc8761058b2d14a9be2a6fe706f065a8 (patch)
treeb0b07f4410d6fff7e50d6013a5d88bb3e2712f98 /tpm-util/duplicate/include
parent7626b75b3c71173ba62c2f92d22bab8f4291e44a (diff)
Upgrade Duplicate utility to the latest tss
This patch updates the Duplicate utility to match with the latest tss stack Issue-ID: AAF-763 Change-Id: I08a01b193e8cf550fa1cfcbe0781672b3051eb96 Signed-off-by: Pramod Raghavendra Jayathirth <pramod.raghavendra.jayathirth@intel.com>
Diffstat (limited to 'tpm-util/duplicate/include')
-rw-r--r--tpm-util/duplicate/include/crypto_aux.h8
-rw-r--r--tpm-util/duplicate/include/marshal.h580
-rw-r--r--tpm-util/duplicate/include/tpm_duplication_aux.h32
-rw-r--r--tpm-util/duplicate/include/util.h9
4 files changed, 328 insertions, 301 deletions
diff --git a/tpm-util/duplicate/include/crypto_aux.h b/tpm-util/duplicate/include/crypto_aux.h
index 272cc39..5774933 100644
--- a/tpm-util/duplicate/include/crypto_aux.h
+++ b/tpm-util/duplicate/include/crypto_aux.h
@@ -19,10 +19,12 @@
#define CRYPTO_AUX
#include <string.h>
-#include <sapi/tpm20.h>
+#include <tss2/tss2_sys.h>
+#include <tss2/tss2_tcti_mssim.h>
+#include <tss2/tss2_tpm2_types.h>
+#include <tss2/tpm2b.h>
#include <openssl/rsa.h>
#include <openssl/aes.h>
-#include <openssl/rsa.h>
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/evp.h>
@@ -49,7 +51,7 @@ void AES_128_CFB_enc_dec(
-TPM_RC KDFa( TPMI_ALG_HASH hashAlg, TPM2B *key, char *label,
+TPM2_RC KDFa( TPMI_ALG_HASH hashAlg, TPM2B *key, char *label,
TPM2B *contextU, TPM2B *contextV, UINT16 bits, TPM2B_MAX_BUFFER *resultKey );
UINT32 OpenSslHmac( TPMI_ALG_HASH hashAlg, TPM2B *key,TPM2B **bufferList, TPM2B_DIGEST *result );
diff --git a/tpm-util/duplicate/include/marshal.h b/tpm-util/duplicate/include/marshal.h
index 09d4aed..dea4bab 100644
--- a/tpm-util/duplicate/include/marshal.h
+++ b/tpm-util/duplicate/include/marshal.h
@@ -14,17 +14,32 @@
* limitations under the License.
*/
// Author: Arun Kumar Sekar
-
+#include <tss2/tss2_sys.h>
+#include <tss2/tss2_common.h>
+#include <tss2/tss2_esys.h>
+#include <tss2/tss2_mu.h>
+#include <tss2/tss2_tcti.h>
+#include <tss2/tss2_tcti_mssim.h>
+#include <tss2/tss2_tpm2_types.h>
+#include <tss2/tpm2b.h>
+#include <stdlib.h>
#ifndef __MARSHAL_H__
#define __MARSHAL_H__
-#include <sapi/tpm20.h>
-#include <sapi/implementation.h>
#define pAssert(a) ((void)0)
#define UNREFERENCED(a) ((void)(a))
-#if NO_AUTO_ALIGN == YES || LITTLE_ENDIAN_TPM == YES
+#define MAX_NV_INDEX_SIZE 2048
+UINT16 size;
+BYTE buffer[1];
+
+#define TRUE 1
+#define FALSE 0
+#define YES 1
+#define NO 0
+
+#if NO_AUTO_ALIGN == YES || LITTLE_ENDIAN_TPM2_ == YES
#define BYTE_ARRAY_TO_UINT8(b) (UINT8)((b)[0])
#define BYTE_ARRAY_TO_UINT16(b) (UINT16)( ((b)[0] << 8) \
@@ -92,7 +107,7 @@
// Table 2:3 - Definition of Base Types (BaseTypes)
// UINT8 definition from table 2:3
-TPM_RC
+TPM2_RC
UINT8_Unmarshal(UINT8 *target, BYTE **buffer, INT32 *size);
UINT16
UINT8_Marshal(UINT8 *source, BYTE **buffer, INT32 *size);
@@ -107,7 +122,7 @@ UINT8_Marshal(UINT8 *source, BYTE **buffer, INT32 *size);
UINT8_Unmarshal((UINT8 *)(target), buffer, size)
// INT8_Marshal not referenced
// UINT16 definition from table 2:3
-TPM_RC
+TPM2_RC
UINT16_Unmarshal(UINT16 *target, BYTE **buffer, INT32 *size);
UINT16
UINT16_Marshal(UINT16 *source, BYTE **buffer, INT32 *size);
@@ -116,7 +131,7 @@ UINT16_Marshal(UINT16 *source, BYTE **buffer, INT32 *size);
// INT16_Unmarshal not referenced
// INT16_Marshal not referenced
// UINT32 definition from table 2:3
-TPM_RC
+TPM2_RC
UINT32_Unmarshal(UINT32 *target, BYTE **buffer, INT32 *size);
UINT16
UINT32_Marshal(UINT32 *source, BYTE **buffer, INT32 *size);
@@ -126,7 +141,7 @@ UINT32_Marshal(UINT32 *source, BYTE **buffer, INT32 *size);
UINT32_Unmarshal((UINT32 *)(target), buffer, size)
// INT32_Marshal not referenced
// UINT64 definition from table 2:3
-TPM_RC
+TPM2_RC
UINT64_Unmarshal(UINT64 *target, BYTE **buffer, INT32 *size);
UINT16
UINT64_Marshal(UINT64 *source, BYTE **buffer, INT32 *size);
@@ -141,20 +156,20 @@ UINT64_Marshal(UINT64 *source, BYTE **buffer, INT32 *size);
// Table 2:5 - Definition of Types for Documentation Clarity (TypesTable)
// UINT32 definition from table 2:5
-// TPM_ALGORITHM_ID_Unmarshal not referenced
-// TPM_ALGORITHM_ID_Marshal not referenced
+// TPM2_ALGORITHM_ID_Unmarshal not referenced
+// TPM2_ALGORITHM_ID_Marshal not referenced
// UINT32 definition from table 2:5
-// TPM_MODIFIER_INDICATOR_Unmarshal not referenced
-// TPM_MODIFIER_INDICATOR_Marshal not referenced
+// TPM2_MODIFIER_INDICATOR_Unmarshal not referenced
+// TPM2_MODIFIER_INDICATOR_Marshal not referenced
// UINT32 definition from table 2:5
-// TPM_AUTHORIZATION_SIZE_Unmarshal not referenced
-// TPM_AUTHORIZATION_SIZE_Marshal not referenced
+// TPM2_AUTHORIZATION_SIZE_Unmarshal not referenced
+// TPM2_AUTHORIZATION_SIZE_Marshal not referenced
// UINT32 definition from table 2:5
-// TPM_PARAMETER_SIZE_Unmarshal not referenced
-// TPM_PARAMETER_SIZE_Marshal not referenced
+// TPM2_PARAMETER_SIZE_Unmarshal not referenced
+// TPM2_PARAMETER_SIZE_Marshal not referenced
// UINT16 definition from table 2:5
-// TPM_KEY_SIZE_Unmarshal not referenced
-// TPM_KEY_SIZE_Marshal not referenced
+// TPM2_KEY_SIZE_Unmarshal not referenced
+// TPM2_KEY_SIZE_Marshal not referenced
// UINT16 definition from table 2:5
#define TPM_KEY_BITS_Unmarshal(target, buffer, size) \
UINT16_Unmarshal((UINT16 *)(target), buffer, size)
@@ -162,31 +177,31 @@ UINT64_Marshal(UINT64 *source, BYTE **buffer, INT32 *size);
UINT16_Marshal((UINT16 *)(source), buffer, size)
-// Table 2:6 - Definition of TPM_SPEC Constants (ConstantsTable)
-// TPM_SPEC_Unmarshal not referenced
-// TPM_SPEC_Marshal not referenced
+// Table 2:6 - Definition of TPM2_SPEC Constants (ConstantsTable)
+// TPM2_SPEC_Unmarshal not referenced
+// TPM2_SPEC_Marshal not referenced
-// Table 2:7 - Definition of TPM_GENERATED Constants (ConstantsTable)
-// TPM_GENERATED_Unmarshal not referenced
+// Table 2:7 - Definition of TPM2_GENERATED Constants (ConstantsTable)
+// TPM2_GENERATED_Unmarshal not referenced
#define TPM_GENERATED_Marshal(source, buffer, size) \
UINT32_Marshal((UINT32 *)(source), buffer, size)
// Table 2:9 - Definition of TPM_ALG_ID Constants (ConstantsTable)
-#define TPM_ALG_ID_Unmarshal(target, buffer, size) \
+#define TPM2_ALG_ID_Unmarshal(target, buffer, size) \
UINT16_Unmarshal((UINT16 *)(target), buffer, size)
-#define TPM_ALG_ID_Marshal(source, buffer, size) \
+#define TPM2_ALG_ID_Marshal(source, buffer, size) \
UINT16_Marshal((UINT16 *)(source), buffer, size)
// Table 2:10 - Definition of TPM_ECC_CURVE Constants (ConstantsTable)
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPM_ECC_CURVE_Unmarshal(target, buffer, size) \
UINT16_Unmarshal((UINT16 *)(target), buffer, size)
#define TPM_ECC_CURVE_Marshal(source, buffer, size) \
UINT16_Marshal((UINT16 *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:13 - Definition of TPM_CC Constants (ConstantsTable)
@@ -203,15 +218,15 @@ UINT64_Marshal(UINT64 *source, BYTE **buffer, INT32 *size);
// Table 2:18 - Definition of TPM_CLOCK_ADJUST Constants (ConstantsTable)
-TPM_RC
-TPM_CLOCK_ADJUST_Unmarshal(TPM_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size);
+TPM2_RC
+TPM_CLOCK_ADJUST_Unmarshal(TPM2_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size);
// TPM_CLOCK_ADJUST_Marshal not referenced
// Table 2:19 - Definition of TPM_EO Constants (ConstantsTable)
-TPM_RC
-TPM_EO_Unmarshal(TPM_EO *target, BYTE **buffer, INT32 *size);
+TPM2_RC
+TPM_EO_Unmarshal(TPM2_EO *target, BYTE **buffer, INT32 *size);
// TPM_EO_Marshal not referenced
@@ -224,22 +239,22 @@ TPM_EO_Unmarshal(TPM_EO *target, BYTE **buffer, INT32 *size);
// Table 2:21 - Definition of TPM_SU Constants (ConstantsTable)
-TPM_RC
-TPM_SU_Unmarshal(TPM_SU *target, BYTE **buffer, INT32 *size);
+TPM2_RC
+TPM_SU_Unmarshal(TPM2_SU *target, BYTE **buffer, INT32 *size);
// TPM_SU_Marshal not referenced
// Table 2:22 - Definition of TPM_SE Constants (ConstantsTable)
-TPM_RC
-TPM_SE_Unmarshal(TPM_SE *target, BYTE **buffer, INT32 *size);
+TPM2_RC
+TPM_SE_Unmarshal(TPM2_SE *target, BYTE **buffer, INT32 *size);
// TPM_SE_Marshal not referenced
// Table 2:23 - Definition of TPM_CAP Constants (ConstantsTable)
-TPM_RC
-TPM_CAP_Unmarshal(TPM_CAP *target, BYTE **buffer, INT32 *size);
+TPM2_RC
+TPM_CAP_Unmarshal(TPM2_CAP *target, BYTE **buffer, INT32 *size);
#define TPM_CAP_Marshal(source, buffer, size) \
UINT32_Marshal((UINT32 *)(source), buffer, size)
@@ -291,7 +306,7 @@ TPM_CAP_Unmarshal(TPM_CAP *target, BYTE **buffer, INT32 *size);
// Table 2:32 - Definition of TPMA_OBJECT Bits (BitsTable)
-TPM_RC
+TPM2_RC
TPMA_OBJECT_Unmarshal(TPMA_OBJECT *target, BYTE **buffer, INT32 *size);
#define TPMA_OBJECT_Marshal(source, buffer, size) \
@@ -299,7 +314,7 @@ TPMA_OBJECT_Unmarshal(TPMA_OBJECT *target, BYTE **buffer, INT32 *size);
// Table 2:33 - Definition of TPMA_SESSION Bits (BitsTable)
-TPM_RC
+TPM2_RC
TPMA_SESSION_Unmarshal(TPMA_SESSION *target, BYTE **buffer, INT32 *size);
#define TPMA_SESSION_Marshal(source, buffer, size) \
@@ -335,7 +350,7 @@ TPMA_SESSION_Unmarshal(TPMA_SESSION *target, BYTE **buffer, INT32 *size);
// Table 2:39 - Definition of TPMI_YES_NO Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_YES_NO_Unmarshal(TPMI_YES_NO *target, BYTE **buffer, INT32 *size);
#define TPMI_YES_NO_Marshal(source, buffer, size) \
@@ -343,88 +358,88 @@ TPMI_YES_NO_Unmarshal(TPMI_YES_NO *target, BYTE **buffer, INT32 *size);
// Table 2:40 - Definition of TPMI_DH_OBJECT Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_DH_OBJECT_Unmarshal(TPMI_DH_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_DH_OBJECT_Marshal(source, buffer, size) \
- TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)
+ TPM_HANDLE_Marshal((TPM2_HANDLE *)(source), buffer, size)
// Table 2:41 - Definition of TPMI_DH_PERSISTENT Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_DH_PERSISTENT_Unmarshal(TPMI_DH_PERSISTENT *target, BYTE **buffer, INT32 *size);
// TPMI_DH_PERSISTENT_Marshal not referenced
// Table 2:42 - Definition of TPMI_DH_ENTITY Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_DH_ENTITY_Unmarshal(TPMI_DH_ENTITY *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMI_DH_ENTITY_Marshal not referenced
// Table 2:43 - Definition of TPMI_DH_PCR Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_DH_PCR_Unmarshal(TPMI_DH_PCR *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMI_DH_PCR_Marshal not referenced
// Table 2:44 - Definition of TPMI_SH_AUTH_SESSION Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_SH_AUTH_SESSION_Unmarshal(TPMI_SH_AUTH_SESSION *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_SH_AUTH_SESSION_Marshal(source, buffer, size) \
- TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)
+ TPM_HANDLE_Marshal((TPM2_HANDLE *)(source), buffer, size)
// Table 2:45 - Definition of TPMI_SH_HMAC Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_SH_HMAC_Unmarshal(TPMI_SH_HMAC *target, BYTE **buffer, INT32 *size);
// TPMI_SH_HMAC_Marshal not referenced
// Table 2:46 - Definition of TPMI_SH_POLICY Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_SH_POLICY_Unmarshal(TPMI_SH_POLICY *target, BYTE **buffer, INT32 *size);
// TPMI_SH_POLICY_Marshal not referenced
// Table 2:47 - Definition of TPMI_DH_CONTEXT Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_DH_CONTEXT_Unmarshal(TPMI_DH_CONTEXT *target, BYTE **buffer, INT32 *size);
#define TPMI_DH_CONTEXT_Marshal(source, buffer, size) \
- TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)
+ TPM_HANDLE_Marshal((TPM2_HANDLE *)(source), buffer, size)
// Table 2:48 - Definition of TPMI_RH_HIERARCHY Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_HIERARCHY_Unmarshal(TPMI_RH_HIERARCHY *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_RH_HIERARCHY_Marshal(source, buffer, size) \
- TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)
+ TPM_HANDLE_Marshal((TPM2_HANDLE *)(source), buffer, size)
// Table 2:49 - Definition of TPMI_RH_ENABLES Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_ENABLES_Unmarshal(TPMI_RH_ENABLES *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMI_RH_ENABLES_Marshal not referenced
// Table 2:50 - Definition of TPMI_RH_HIERARCHY_AUTH Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_HIERARCHY_AUTH_Unmarshal(TPMI_RH_HIERARCHY_AUTH *target, BYTE **buffer, INT32 *size);
// TPMI_RH_HIERARCHY_AUTH_Marshal not referenced
// Table 2:51 - Definition of TPMI_RH_PLATFORM Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_PLATFORM_Unmarshal(TPMI_RH_PLATFORM *target, BYTE **buffer, INT32 *size);
// TPMI_RH_PLATFORM_Marshal not referenced
@@ -436,54 +451,54 @@ TPMI_RH_PLATFORM_Unmarshal(TPMI_RH_PLATFORM *target, BYTE **buffer, INT32 *size)
// Table 2:53 - Definition of TPMI_RH_ENDORSEMENT Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_ENDORSEMENT_Unmarshal(TPMI_RH_ENDORSEMENT *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMI_RH_ENDORSEMENT_Marshal not referenced
// Table 2:54 - Definition of TPMI_RH_PROVISION Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_PROVISION_Unmarshal(TPMI_RH_PROVISION *target, BYTE **buffer, INT32 *size);
// TPMI_RH_PROVISION_Marshal not referenced
// Table 2:55 - Definition of TPMI_RH_CLEAR Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_CLEAR_Unmarshal(TPMI_RH_CLEAR *target, BYTE **buffer, INT32 *size);
// TPMI_RH_CLEAR_Marshal not referenced
// Table 2:56 - Definition of TPMI_RH_NV_AUTH Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_NV_AUTH_Unmarshal(TPMI_RH_NV_AUTH *target, BYTE **buffer, INT32 *size);
// TPMI_RH_NV_AUTH_Marshal not referenced
// Table 2:57 - Definition of TPMI_RH_LOCKOUT Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_LOCKOUT_Unmarshal(TPMI_RH_LOCKOUT *target, BYTE **buffer, INT32 *size);
// TPMI_RH_LOCKOUT_Marshal not referenced
// Table 2:58 - Definition of TPMI_RH_NV_INDEX Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX *target, BYTE **buffer, INT32 *size);
#define TPMI_RH_NV_INDEX_Marshal(source, buffer, size) \
- TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)
+ TPM_HANDLE_Marshal((TPM2_HANDLE *)(source), buffer, size)
// Table 2:59 - Definition of TPMI_ALG_HASH Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_HASH_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
// Table 2:60 - Definition of TPMI_ALG_ASYM Type (TypeTable)
@@ -492,59 +507,59 @@ TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH *target, BYTE **buffer, INT32 *size, BOOL
// Table 2:61 - Definition of TPMI_ALG_SYM Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMI_ALG_SYM_Marshal not referenced
// Table 2:62 - Definition of TPMI_ALG_SYM_OBJECT Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_SYM_OBJECT_Unmarshal(TPMI_ALG_SYM_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_SYM_OBJECT_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
// Table 2:63 - Definition of TPMI_ALG_SYM_MODE Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_SYM_MODE_Unmarshal(TPMI_ALG_SYM_MODE *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_SYM_MODE_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
// Table 2:64 - Definition of TPMI_ALG_KDF Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_KDF_Unmarshal(TPMI_ALG_KDF *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_KDF_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
// Table 2:65 - Definition of TPMI_ALG_SIG_SCHEME Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_SIG_SCHEME_Unmarshal(TPMI_ALG_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_SIG_SCHEME_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
// Table 2:66 - Definition of TPMI_ECC_KEY_EXCHANGE Type (TypeTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMI_ECC_KEY_EXCHANGE_Unmarshal(TPMI_ECC_KEY_EXCHANGE *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMI_ECC_KEY_EXCHANGE_Marshal not referenced
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:67 - Definition of TPMI_ST_COMMAND_TAG Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ST_COMMAND_TAG_Unmarshal(TPMI_ST_COMMAND_TAG *target, BYTE **buffer, INT32 *size);
// TPMI_ST_COMMAND_TAG_Marshal not referenced
-TPM_RC
+TPM2_RC
TPMS_EMPTY_Unmarshal(TPMS_EMPTY *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_EMPTY_Marshal(TPMS_EMPTY *source, BYTE **buffer, INT32 *size);
@@ -556,28 +571,28 @@ TPMS_EMPTY_Marshal(TPMS_EMPTY *source, BYTE **buffer, INT32 *size);
// Table 2:70 - Definition of TPMU_HA Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_HA_Unmarshal(TPMU_HA *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_HA_Marshal(TPMU_HA *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:71 - Definition of TPMT_HA Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_HA_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_HA_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size);
// Table 2:72 - Definition of TPM2B_DIGEST Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_DIGEST_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_DIGEST_Marshal(TPM2B_DIGEST *source, BYTE **buffer, INT32 *size);
// Table 2:73 - Definition of TPM2B_DATA Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_DATA_Unmarshal(TPM2B_DATA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_DATA_Marshal(TPM2B_DATA *source, BYTE **buffer, INT32 *size);
@@ -607,35 +622,35 @@ TPM2B_DATA_Marshal(TPM2B_DATA *source, BYTE **buffer, INT32 *size);
// Table 2:77 - Definition of TPM2B_EVENT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_EVENT_Unmarshal(TPM2B_EVENT *target, BYTE **buffer, INT32 *size);
// TPM2B_EVENT_Marshal not referenced
// Table 2:78 - Definition of TPM2B_MAX_BUFFER Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_MAX_BUFFER_Unmarshal(TPM2B_MAX_BUFFER *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_MAX_BUFFER_Marshal(TPM2B_MAX_BUFFER *source, BYTE **buffer, INT32 *size);
// Table 2:79 - Definition of TPM2B_MAX_NV_BUFFER Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_MAX_NV_BUFFER_Unmarshal(TPM2B_MAX_NV_BUFFER *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_MAX_NV_BUFFER_Marshal(TPM2B_MAX_NV_BUFFER *source, BYTE **buffer, INT32 *size);
// Table 2:80 - Definition of TPM2B_TIMEOUT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_TIMEOUT_Unmarshal(TPM2B_TIMEOUT *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_TIMEOUT_Marshal(TPM2B_TIMEOUT *source, BYTE **buffer, INT32 *size);
// Table 2:81 - Definition of TPM2B_IV Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_IV_Unmarshal(TPM2B_IV *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_IV_Marshal(TPM2B_IV *source, BYTE **buffer, INT32 *size);
@@ -645,7 +660,7 @@ TPM2B_IV_Marshal(TPM2B_IV *source, BYTE **buffer, INT32 *size);
// Table 2:83 - Definition of TPM2B_NAME Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_NAME_Unmarshal(TPM2B_NAME *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_NAME_Marshal(TPM2B_NAME *source, BYTE **buffer, INT32 *size);
@@ -657,35 +672,35 @@ TPM2B_NAME_Marshal(TPM2B_NAME *source, BYTE **buffer, INT32 *size);
// Table 2:85 - Definition of TPMS_PCR_SELECTION Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMS_PCR_SELECTION_Unmarshal(TPMS_PCR_SELECTION *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_PCR_SELECTION_Marshal(TPMS_PCR_SELECTION *source, BYTE **buffer, INT32 *size);
// Table 2:88 - Definition of TPMT_TK_CREATION Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_TK_CREATION_Unmarshal(TPMT_TK_CREATION *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_CREATION_Marshal(TPMT_TK_CREATION *source, BYTE **buffer, INT32 *size);
// Table 2:89 - Definition of TPMT_TK_VERIFIED Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_TK_VERIFIED_Unmarshal(TPMT_TK_VERIFIED *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_VERIFIED_Marshal(TPMT_TK_VERIFIED *source, BYTE **buffer, INT32 *size);
// Table 2:90 - Definition of TPMT_TK_AUTH Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_TK_AUTH_Unmarshal(TPMT_TK_AUTH *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_AUTH_Marshal(TPMT_TK_AUTH *source, BYTE **buffer, INT32 *size);
// Table 2:91 - Definition of TPMT_TK_HASHCHECK Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_TK_HASHCHECK_Unmarshal(TPMT_TK_HASHCHECK *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_HASHCHECK_Marshal(TPMT_TK_HASHCHECK *source, BYTE **buffer, INT32 *size);
@@ -710,7 +725,7 @@ TPMS_TAGGED_PCR_SELECT_Marshal(TPMS_TAGGED_PCR_SELECT *source, BYTE **buffer, IN
// Table 2:95 - Definition of TPML_CC Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_CC_Unmarshal(TPML_CC *target, BYTE **buffer, INT32 *size);
UINT16
TPML_CC_Marshal(TPML_CC *source, BYTE **buffer, INT32 *size);
@@ -723,7 +738,7 @@ TPML_CCA_Marshal(TPML_CCA *source, BYTE **buffer, INT32 *size);
// Table 2:97 - Definition of TPML_ALG Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_ALG_Unmarshal(TPML_ALG *target, BYTE **buffer, INT32 *size);
UINT16
TPML_ALG_Marshal(TPML_ALG *source, BYTE **buffer, INT32 *size);
@@ -736,14 +751,14 @@ TPML_HANDLE_Marshal(TPML_HANDLE *source, BYTE **buffer, INT32 *size);
// Table 2:99 - Definition of TPML_DIGEST Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_DIGEST_Unmarshal(TPML_DIGEST *target, BYTE **buffer, INT32 *size);
UINT16
TPML_DIGEST_Marshal(TPML_DIGEST *source, BYTE **buffer, INT32 *size);
// Table 2:100 - Definition of TPML_DIGEST_VALUES Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_DIGEST_VALUES_Unmarshal(TPML_DIGEST_VALUES *target, BYTE **buffer, INT32 *size);
UINT16
TPML_DIGEST_VALUES_Marshal(TPML_DIGEST_VALUES *source, BYTE **buffer, INT32 *size);
@@ -755,7 +770,7 @@ TPML_DIGEST_VALUES_Marshal(TPML_DIGEST_VALUES *source, BYTE **buffer, INT32 *siz
// Table 2:102 - Definition of TPML_PCR_SELECTION Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_PCR_SELECTION_Unmarshal(TPML_PCR_SELECTION *target, BYTE **buffer, INT32 *size);
UINT16
TPML_PCR_SELECTION_Marshal(TPML_PCR_SELECTION *source, BYTE **buffer, INT32 *size);
@@ -780,12 +795,12 @@ TPML_TAGGED_PCR_PROPERTY_Marshal(TPML_TAGGED_PCR_PROPERTY *source, BYTE **buffer
// Table 2:106 - Definition of TPML_ECC_CURVE Structure (StructureTable)
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPML_ECC_CURVE_Unmarshal not referenced
UINT16
TPML_ECC_CURVE_Marshal(TPML_ECC_CURVE *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:107 - Definition of TPMU_CAPABILITIES Union (UnionTable)
@@ -857,7 +872,7 @@ TPMS_NV_CERTIFY_INFO_Marshal(TPMS_NV_CERTIFY_INFO *source, BYTE **buffer, INT32
// Table 2:118 - Definition of TPMI_ST_ATTEST Type (TypeTable)
// TPMI_ST_ATTEST_Unmarshal not referenced
#define TPMI_ST_ATTEST_Marshal(source, buffer, size) \
- TPM_ST_Marshal((TPM_ST *)(source), buffer, size)
+ TPM_ST_Marshal((TPM2_ST *)(source), buffer, size)
// Table 2:119 - Definition of TPMU_ATTEST Union (UnionTable)
@@ -889,65 +904,66 @@ TPM2B_ATTEST_Marshal(TPM2B_ATTEST *source, BYTE **buffer, INT32 *size);
// Table 2:124 - Definition of TPMI_AES_KEY_BITS Type (TypeTable)
-#ifdef TPM_ALG_AES
-TPM_RC
+#ifdef TPM2_ALG_AES
+TPM2_RC
TPMI_AES_KEY_BITS_Unmarshal(TPMI_AES_KEY_BITS *target, BYTE **buffer, INT32 *size);
#define TPMI_AES_KEY_BITS_Marshal(source, buffer, size) \
- TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
-#endif // TPM_ALG_AES
+ TPM_KEY_BITS_Marshal((TPM2_KEY_BITS *)(source), buffer, size)
+#endif // TPM2_ALG_AES
+#define HASH_COUNT (TPM2_ALG_SHA1+TPM2_ALG_SHA256+TPM2_ALG_SHA384+TPM2_ALG_SM3_256+TPM2_ALG_SHA512)
// Table 2:124 - Definition of TPMI_SM4_KEY_BITS Type (TypeTable)
-#ifdef TPM_ALG_SM4
-TPM_RC
+#ifdef TPM2_ALG_SM4
+TPM2_RC
TPMI_SM4_KEY_BITS_Unmarshal(TPMI_SM4_KEY_BITS *target, BYTE **buffer, INT32 *size);
#define TPMI_SM4_KEY_BITS_Marshal(source, buffer, size) \
- TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
-#endif // TPM_ALG_SM4
+ TPM_KEY_BITS_Marshal((TPM2_KEY_BITS *)(source), buffer, size)
+#endif // TPM2_ALG_SM4
// Table 2:124 - Definition of TPMI_CAMELLIA_KEY_BITS Type (TypeTable)
-#ifdef TPM_ALG_CAMELLIA
-TPM_RC
-TPMI_CAMELLIA_KEY_BITS_Unmarshal(TPMI_CAMELLIA_KEY_BITS *target, BYTE **buffer, INT32 *size);
+#ifdef TPM2_ALG_CAMELLIA
+TPM2_RC
+TPMI_CAMELLIA_KEY_BITS_Unmarshal(TPMI_TPM2_CAMELLIA_KEY_BITS *target, BYTE **buffer, INT32 *size);
#define TPMI_CAMELLIA_KEY_BITS_Marshal(source, buffer, size) \
- TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
-#endif // TPM_ALG_CAMELLIA
+ TPM_KEY_BITS_Marshal((TPM2_KEY_BITS *)(source), buffer, size)
+#endif // TPM2_ALG_CAMELLIA
// Table 2:125 - Definition of TPMU_SYM_KEY_BITS Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_SYM_KEY_BITS_Unmarshal(TPMU_SYM_KEY_BITS *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SYM_KEY_BITS_Marshal(TPMU_SYM_KEY_BITS *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:126 - Definition of TPMU_SYM_MODE Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_SYM_MODE_Unmarshal(TPMU_SYM_MODE *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SYM_MODE_Marshal(TPMU_SYM_MODE *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:128 - Definition of TPMT_SYM_DEF Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_SYM_DEF_Unmarshal(TPMT_SYM_DEF *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMT_SYM_DEF_Marshal not referenced
// Table 2:129 - Definition of TPMT_SYM_DEF_OBJECT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_SYM_DEF_OBJECT_Unmarshal(TPMT_SYM_DEF_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_SYM_DEF_OBJECT_Marshal(TPMT_SYM_DEF_OBJECT *source, BYTE **buffer, INT32 *size);
// Table 2:130 - Definition of TPM2B_SYM_KEY Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_SYM_KEY_Unmarshal(TPM2B_SYM_KEY *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_SYM_KEY_Marshal(TPM2B_SYM_KEY *source, BYTE **buffer, INT32 *size);
@@ -961,21 +977,21 @@ TPM2B_SYM_KEY_Marshal(TPM2B_SYM_KEY *source, BYTE **buffer, INT32 *size);
// Table 2:132 - Definition of TPM2B_SENSITIVE_DATA Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_SENSITIVE_DATA_Unmarshal(TPM2B_SENSITIVE_DATA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_SENSITIVE_DATA_Marshal(TPM2B_SENSITIVE_DATA *source, BYTE **buffer, INT32 *size);
// Table 2:133 - Definition of TPMS_SENSITIVE_CREATE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMS_SENSITIVE_CREATE_Unmarshal(TPMS_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size);
// TPMS_SENSITIVE_CREATE_Marshal not referenced
// Table 2:134 - Definition of TPM2B_SENSITIVE_CREATE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_SENSITIVE_CREATE_Unmarshal(TPM2B_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size);
// TPM2B_SENSITIVE_CREATE_Marshal not referenced
@@ -989,21 +1005,21 @@ TPM2B_SENSITIVE_CREATE_Unmarshal(TPM2B_SENSITIVE_CREATE *target, BYTE **buffer,
// Table 2:136 - Definition of TPMS_SCHEME_ECDAA Structure (StructureTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMS_SCHEME_ECDAA_Unmarshal(TPMS_SCHEME_ECDAA *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_SCHEME_ECDAA_Marshal(TPMS_SCHEME_ECDAA *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:137 - Definition of TPMI_ALG_KEYEDHASH_SCHEME Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_KEYEDHASH_SCHEME_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
// Table 2:138 - Definition of Types for HMAC_SIG_SCHEME (TypesTable)
@@ -1015,128 +1031,128 @@ TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME *target, BYTE **bu
// Table 2:139 - Definition of TPMS_SCHEME_XOR Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMS_SCHEME_XOR_Unmarshal(TPMS_SCHEME_XOR *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMS_SCHEME_XOR_Marshal(TPMS_SCHEME_XOR *source, BYTE **buffer, INT32 *size);
// Table 2:140 - Definition of TPMU_SCHEME_KEYEDHASH Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_SCHEME_KEYEDHASH_Unmarshal(TPMU_SCHEME_KEYEDHASH *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SCHEME_KEYEDHASH_Marshal(TPMU_SCHEME_KEYEDHASH *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:141 - Definition of TPMT_KEYEDHASH_SCHEME Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_KEYEDHASH_SCHEME_Unmarshal(TPMT_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_KEYEDHASH_SCHEME_Marshal(TPMT_KEYEDHASH_SCHEME *source, BYTE **buffer, INT32 *size);
// Table 2:142 - Definition of Types for RSA Signature Schemes (TypesTable)
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
// TPMS_SCHEME_HASH definition from table 2:142
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
#define TPMS_SIG_SCHEME_RSASSA_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_RSASSA_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// TPMS_SCHEME_HASH definition from table 2:142
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
#define TPMS_SIG_SCHEME_RSAPSS_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_RSAPSS_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_RSA
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:143 - Definition of Types for ECC Signature Schemes (TypesTable)
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:143
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIG_SCHEME_ECDSA_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_ECDSA_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:143
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIG_SCHEME_SM2_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_SM2_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:143
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_ECSCHNORR_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_ECDAA definition from table 2:143
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIG_SCHEME_ECDAA_Unmarshal(target, buffer, size) \
TPMS_SCHEME_ECDAA_Unmarshal((TPMS_SCHEME_ECDAA *)(target), buffer, size)
#define TPMS_SIG_SCHEME_ECDAA_Marshal(source, buffer, size) \
TPMS_SCHEME_ECDAA_Marshal((TPMS_SCHEME_ECDAA *)(source), buffer, size)
-#endif // TPM_ALG_ECC
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:144 - Definition of TPMU_SIG_SCHEME Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_SIG_SCHEME_Unmarshal(TPMU_SIG_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector);
// TPMU_SIG_SCHEME_Marshal not referenced
// Table 2:145 - Definition of TPMT_SIG_SCHEME Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_SIG_SCHEME_Unmarshal(TPMT_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMT_SIG_SCHEME_Marshal not referenced
// Table 2:146 - Definition of Types for Encryption Schemes (TypesTable)
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
// TPMS_SCHEME_HASH definition from table 2:146
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
#define TPMS_ENC_SCHEME_OAEP_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_ENC_SCHEME_OAEP_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// TPMS_EMPTY definition from table 2:146
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
#define TPMS_ENC_SCHEME_RSAES_Unmarshal(target, buffer, size) \
TPMS_EMPTY_Unmarshal((TPMS_EMPTY *)(target), buffer, size)
#define TPMS_ENC_SCHEME_RSAES_Marshal(source, buffer, size) \
TPMS_EMPTY_Marshal((TPMS_EMPTY *)(source), buffer, size)
-#endif // TPM_ALG_RSA
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:147 - Definition of Types for ECC Key Exchange (TypesTable)
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:147
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_KEY_SCHEME_ECDH_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_KEY_SCHEME_ECDH_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:147
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_KEY_SCHEME_ECMQV_Unmarshal(target, buffer, size) \
TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_KEY_SCHEME_ECMQV_Marshal(source, buffer, size) \
TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
-#endif // TPM_ALG_ECC
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:148 - Definition of Types for KDF Schemes (TypesTable)
@@ -1163,14 +1179,14 @@ TPMT_SIG_SCHEME_Unmarshal(TPMT_SIG_SCHEME *target, BYTE **buffer, INT32 *size, B
// Table 2:149 - Definition of TPMU_KDF_SCHEME Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_KDF_SCHEME_Unmarshal(TPMU_KDF_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_KDF_SCHEME_Marshal(TPMU_KDF_SCHEME *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:150 - Definition of TPMT_KDF_SCHEME Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_KDF_SCHEME_Unmarshal(TPMT_KDF_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_KDF_SCHEME_Marshal(TPMT_KDF_SCHEME *source, BYTE **buffer, INT32 *size);
@@ -1182,7 +1198,7 @@ TPMT_KDF_SCHEME_Marshal(TPMT_KDF_SCHEME *source, BYTE **buffer, INT32 *size);
// Table 2:152 - Definition of TPMU_ASYM_SCHEME Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_ASYM_SCHEME_Unmarshal(TPMU_ASYM_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_ASYM_SCHEME_Marshal(TPMU_ASYM_SCHEME *source, BYTE **buffer, INT32 *size, UINT32 selector);
@@ -1194,223 +1210,223 @@ TPMU_ASYM_SCHEME_Marshal(TPMU_ASYM_SCHEME *source, BYTE **buffer, INT32 *size, U
// Table 2:154 - Definition of TPMI_ALG_RSA_SCHEME Type (TypeTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPMI_ALG_RSA_SCHEME_Unmarshal(TPMI_ALG_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_RSA_SCHEME_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
-#endif // TPM_ALG_RSA
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
+#endif // TPM2_ALG_RSA
// Table 2:155 - Definition of TPMT_RSA_SCHEME Structure (StructureTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPMT_RSA_SCHEME_Unmarshal(TPMT_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_RSA_SCHEME_Marshal(TPMT_RSA_SCHEME *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:156 - Definition of TPMI_ALG_RSA_DECRYPT Type (TypeTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPMI_ALG_RSA_DECRYPT_Unmarshal(TPMI_ALG_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMI_ALG_RSA_DECRYPT_Marshal not referenced
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:157 - Definition of TPMT_RSA_DECRYPT Structure (StructureTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPMT_RSA_DECRYPT_Unmarshal(TPMT_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL flag);
// TPMT_RSA_DECRYPT_Marshal not referenced
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:158 - Definition of TPM2B_PUBLIC_KEY_RSA Structure (StructureTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPM2B_PUBLIC_KEY_RSA_Unmarshal(TPM2B_PUBLIC_KEY_RSA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_PUBLIC_KEY_RSA_Marshal(TPM2B_PUBLIC_KEY_RSA *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:159 - Definition of TPMI_RSA_KEY_BITS Type (TypeTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPMI_RSA_KEY_BITS_Unmarshal(TPMI_RSA_KEY_BITS *target, BYTE **buffer, INT32 *size);
#define TPMI_RSA_KEY_BITS_Marshal(source, buffer, size) \
- TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
-#endif // TPM_ALG_RSA
+ TPM_KEY_BITS_Marshal((TPM2_KEY_BITS *)(source), buffer, size)
+#endif // TPM2_ALG_RSA
// Table 2:160 - Definition of TPM2B_PRIVATE_KEY_RSA Structure (StructureTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPM2B_PRIVATE_KEY_RSA_Unmarshal(TPM2B_PRIVATE_KEY_RSA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_PRIVATE_KEY_RSA_Marshal(TPM2B_PRIVATE_KEY_RSA *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:161 - Definition of TPM2B_ECC_PARAMETER Structure (StructureTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPM2B_ECC_PARAMETER_Unmarshal(TPM2B_ECC_PARAMETER *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ECC_PARAMETER_Marshal(TPM2B_ECC_PARAMETER *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:162 - Definition of TPMS_ECC_POINT Structure (StructureTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMS_ECC_POINT_Unmarshal(TPMS_ECC_POINT *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_ECC_POINT_Marshal(TPMS_ECC_POINT *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:163 - Definition of TPM2B_ECC_POINT Structure (StructureTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPM2B_ECC_POINT_Unmarshal(TPM2B_ECC_POINT *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ECC_POINT_Marshal(TPM2B_ECC_POINT *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:164 - Definition of TPMI_ALG_ECC_SCHEME Type (TypeTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMI_ALG_ECC_SCHEME_Unmarshal(TPMI_ALG_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
#define TPMI_ALG_ECC_SCHEME_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+ TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
+#endif // TPM2_ALG_ECC
// Table 2:165 - Definition of TPMI_ECC_CURVE Type (TypeTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMI_ECC_CURVE_Unmarshal(TPMI_ECC_CURVE *target, BYTE **buffer, INT32 *size);
#define TPMI_ECC_CURVE_Marshal(source, buffer, size) \
- TPM_ECC_CURVE_Marshal((TPM_ECC_CURVE *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+ TPM_ECC_CURVE_Marshal((TPM2_ECC_CURVE *)(source), buffer, size)
+#endif // TPM2_ALG_ECC
// Table 2:166 - Definition of TPMT_ECC_SCHEME Structure (StructureTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMT_ECC_SCHEME_Unmarshal(TPMT_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_ECC_SCHEME_Marshal(TPMT_ECC_SCHEME *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:167 - Definition of TPMS_ALGORITHM_DETAIL_ECC Structure (StructureTable)
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_ALGORITHM_DETAIL_ECC_Unmarshal not referenced
UINT16
TPMS_ALGORITHM_DETAIL_ECC_Marshal(TPMS_ALGORITHM_DETAIL_ECC *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:168 - Definition of TPMS_SIGNATURE_RSA Structure (StructureTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPMS_SIGNATURE_RSA_Unmarshal(TPMS_SIGNATURE_RSA *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_SIGNATURE_RSA_Marshal(TPMS_SIGNATURE_RSA *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:169 - Definition of Types for Signature (TypesTable)
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
// TPMS_SIGNATURE_RSA definition from table 2:169
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
#define TPMS_SIGNATURE_RSASSA_Unmarshal(target, buffer, size) \
TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)(target), buffer, size)
#define TPMS_SIGNATURE_RSASSA_Marshal(source, buffer, size) \
TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)(source), buffer, size)
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// TPMS_SIGNATURE_RSA definition from table 2:169
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
#define TPMS_SIGNATURE_RSAPSS_Unmarshal(target, buffer, size) \
TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)(target), buffer, size)
#define TPMS_SIGNATURE_RSAPSS_Marshal(source, buffer, size) \
TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)(source), buffer, size)
-#endif // TPM_ALG_RSA
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:170 - Definition of TPMS_SIGNATURE_ECC Structure (StructureTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMS_SIGNATURE_ECC_Unmarshal(TPMS_SIGNATURE_ECC *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_SIGNATURE_ECC_Marshal(TPMS_SIGNATURE_ECC *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:171 - Definition of Types for TPMS_SIGNATUE_ECC (TypesTable)
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SIGNATURE_ECC definition from table 2:171
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIGNATURE_ECDSA_Unmarshal(target, buffer, size) \
TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_ECDSA_Marshal(source, buffer, size) \
TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SIGNATURE_ECC definition from table 2:171
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIGNATURE_SM2_Unmarshal(target, buffer, size) \
TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_SM2_Marshal(source, buffer, size) \
TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SIGNATURE_ECC definition from table 2:171
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIGNATURE_ECSCHNORR_Unmarshal(target, buffer, size) \
TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_ECSCHNORR_Marshal(source, buffer, size) \
TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SIGNATURE_ECC definition from table 2:171
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
#define TPMS_SIGNATURE_ECDAA_Unmarshal(target, buffer, size) \
TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_ECDAA_Marshal(source, buffer, size) \
TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
-#endif // TPM_ALG_ECC
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:172 - Definition of TPMU_SIGNATURE Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_SIGNATURE_Unmarshal(TPMU_SIGNATURE *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SIGNATURE_Marshal(TPMU_SIGNATURE *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:173 - Definition of TPMT_SIGNATURE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_SIGNATURE_Unmarshal(TPMT_SIGNATURE *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_SIGNATURE_Marshal(TPMT_SIGNATURE *source, BYTE **buffer, INT32 *size);
@@ -1422,22 +1438,26 @@ TPMT_SIGNATURE_Marshal(TPMT_SIGNATURE *source, BYTE **buffer, INT32 *size);
// Table 2:175 - Definition of TPM2B_ENCRYPTED_SECRET Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_ENCRYPTED_SECRET_Unmarshal(TPM2B_ENCRYPTED_SECRET *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ENCRYPTED_SECRET_Marshal(TPM2B_ENCRYPTED_SECRET *source, BYTE **buffer, INT32 *size);
// Table 2:176 - Definition of TPMI_ALG_PUBLIC Type (TypeTable)
-TPM_RC
+TPM2_RC
TPMI_ALG_PUBLIC_Unmarshal(TPMI_ALG_PUBLIC *target, BYTE **buffer, INT32 *size);
+#define TPM_ALG_ID_Unmarshal(target, buffer, size) \
+ UINT16_Unmarshal((UINT16 *)(target), buffer, size)
+#define TPM_ALG_ID_Marshal(source, buffer, size) \
+ UINT16_Marshal((UINT16 *)(source), buffer, size)
#define TPMI_ALG_PUBLIC_Marshal(source, buffer, size) \
- TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
+ TPM_ALG_ID_Marshal((TPM2_ALG_ID *)(source), buffer, size)
// Table 2:177 - Definition of TPMU_PUBLIC_ID Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_PUBLIC_ID_Unmarshal(TPMU_PUBLIC_ID *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_PUBLIC_ID_Marshal(TPMU_PUBLIC_ID *source, BYTE **buffer, INT32 *size, UINT32 selector);
@@ -1456,48 +1476,48 @@ TPMU_PUBLIC_ID_Marshal(TPMU_PUBLIC_ID *source, BYTE **buffer, INT32 *size, UINT3
// Table 2:180 - Definition of TPMS_RSA_PARMS Structure (StructureTable)
-#ifdef TPM_ALG_RSA
-TPM_RC
+#ifdef TPM2_ALG_RSA
+TPM2_RC
TPMS_RSA_PARMS_Unmarshal(TPMS_RSA_PARMS *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_RSA_PARMS_Marshal(TPMS_RSA_PARMS *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// Table 2:181 - Definition of TPMS_ECC_PARMS Structure (StructureTable)
-#ifdef TPM_ALG_ECC
-TPM_RC
+#ifdef TPM2_ALG_ECC
+TPM2_RC
TPMS_ECC_PARMS_Unmarshal(TPMS_ECC_PARMS *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_ECC_PARMS_Marshal(TPMS_ECC_PARMS *source, BYTE **buffer, INT32 *size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Table 2:182 - Definition of TPMU_PUBLIC_PARMS Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_PUBLIC_PARMS_Unmarshal(TPMU_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:183 - Definition of TPMT_PUBLIC_PARMS Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_PUBLIC_PARMS_Unmarshal(TPMT_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size);
// TPMT_PUBLIC_PARMS_Marshal not referenced
// Table 2:184 - Definition of TPMT_PUBLIC Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_PUBLIC_Unmarshal(TPMT_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_PUBLIC_Marshal(TPMT_PUBLIC *source, BYTE **buffer, INT32 *size);
// Table 2:185 - Definition of TPM2B_PUBLIC Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_PUBLIC_Unmarshal(TPM2B_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPM2B_PUBLIC_Marshal(TPM2B_PUBLIC *source, BYTE **buffer, INT32 *size);
@@ -1509,21 +1529,21 @@ TPM2B_PUBLIC_Marshal(TPM2B_PUBLIC *source, BYTE **buffer, INT32 *size);
// Table 2:187 - Definition of TPMU_SENSITIVE_COMPOSITE Union (UnionTable)
-TPM_RC
+TPM2_RC
TPMU_SENSITIVE_COMPOSITE_Unmarshal(TPMU_SENSITIVE_COMPOSITE *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SENSITIVE_COMPOSITE_Marshal(TPMU_SENSITIVE_COMPOSITE *source, BYTE **buffer, INT32 *size, UINT32 selector);
// Table 2:188 - Definition of TPMT_SENSITIVE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_SENSITIVE_Unmarshal(TPMT_SENSITIVE *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_SENSITIVE_Marshal(TPMT_SENSITIVE *source, BYTE **buffer, INT32 *size);
// Table 2:189 - Definition of TPM2B_SENSITIVE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_SENSITIVE_Unmarshal(TPM2B_SENSITIVE *target, BYTE **buffer, INT32 *size);
// TPM2B_SENSITIVE_Marshal not referenced
@@ -1535,7 +1555,7 @@ TPM2B_SENSITIVE_Unmarshal(TPM2B_SENSITIVE *target, BYTE **buffer, INT32 *size);
// Table 2:191 - Definition of TPM2B_PRIVATE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_PRIVATE_Unmarshal(TPM2B_PRIVATE *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_PRIVATE_Marshal(TPM2B_PRIVATE *source, BYTE **buffer, INT32 *size);
@@ -1547,19 +1567,19 @@ TPM2B_PRIVATE_Marshal(TPM2B_PRIVATE *source, BYTE **buffer, INT32 *size);
// Table 2:193 - Definition of TPM2B_ID_OBJECT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_ID_OBJECT_Unmarshal(TPM2B_ID_OBJECT *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ID_OBJECT_Marshal(TPM2B_ID_OBJECT *source, BYTE **buffer, INT32 *size);
-// Table 2:194 - Definition of TPM_NV_INDEX Bits (BitsTable)
-// TPM_NV_INDEX_Unmarshal not referenced
-// TPM_NV_INDEX_Marshal not referenced
+// Table 2:194 - Definition of TPM2_NV_INDEX Bits (BitsTable)
+// TPM2_NV_INDEX_Unmarshal not referenced
+// TPM2_NV_INDEX_Marshal not referenced
// Table 2:195 - Definition of TPMA_NV Bits (BitsTable)
-TPM_RC
+TPM2_RC
TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size);
#define TPMA_NV_Marshal(source, buffer, size) \
@@ -1567,14 +1587,14 @@ TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size);
// Table 2:196 - Definition of TPMS_NV_PUBLIC Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMS_NV_PUBLIC_Unmarshal(TPMS_NV_PUBLIC *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_NV_PUBLIC_Marshal(TPMS_NV_PUBLIC *source, BYTE **buffer, INT32 *size);
// Table 2:197 - Definition of TPM2B_NV_PUBLIC Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_NV_PUBLIC_Unmarshal(TPM2B_NV_PUBLIC *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_NV_PUBLIC_Marshal(TPM2B_NV_PUBLIC *source, BYTE **buffer, INT32 *size);
@@ -1591,14 +1611,14 @@ TPM2B_NV_PUBLIC_Marshal(TPM2B_NV_PUBLIC *source, BYTE **buffer, INT32 *size);
// Table 2:200 - Definition of TPM2B_CONTEXT_DATA Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_CONTEXT_DATA_Unmarshal(TPM2B_CONTEXT_DATA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_CONTEXT_DATA_Marshal(TPM2B_CONTEXT_DATA *source, BYTE **buffer, INT32 *size);
// Table 2:201 - Definition of TPMS_CONTEXT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMS_CONTEXT_Unmarshal(TPMS_CONTEXT *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_CONTEXT_Marshal(TPMS_CONTEXT *source, BYTE **buffer, INT32 *size);
@@ -1626,27 +1646,27 @@ UINT16
TPMS_ALG_PROPERTY_Array_Marshal(TPMS_ALG_PROPERTY *source, BYTE **buffer, INT32 *size, INT32 count);
// Array Marshal/Unmarshal for TPMS_PCR_SELECTION
-TPM_RC
+TPM2_RC
TPMS_PCR_SELECTION_Array_Unmarshal(TPMS_PCR_SELECTION *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
TPMS_PCR_SELECTION_Array_Marshal(TPMS_PCR_SELECTION *source, BYTE **buffer, INT32 *size, INT32 count);
// Array Marshal/Unmarshal for TPMT_HA
-TPM_RC
+TPM2_RC
TPMT_HA_Array_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL flag, INT32 count);
UINT16
TPMT_HA_Array_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size, INT32 count);
// Array Marshal/Unmarshal for BYTE
-TPM_RC
+TPM2_RC
BYTE_Array_Unmarshal(BYTE *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
BYTE_Array_Marshal(BYTE *source, BYTE **buffer, INT32 *size, INT32 count);
-// Array Marshal/Unmarshal for TPM_HANDLE
-// TPM_HANDLE_Array_Unmarshal not referenced
+// Array Marshal/Unmarshal for TPM2_HANDLE
+// TPM2_HANDLE_Array_Unmarshal not referenced
UINT16
-TPM_HANDLE_Array_Marshal(TPM_HANDLE *source, BYTE **buffer, INT32 *size, INT32 count);
+TPM_HANDLE_Array_Marshal(TPM2_HANDLE *source, BYTE **buffer, INT32 *size, INT32 count);
// Array Marshal/Unmarshal for TPMA_CC
// TPMA_CC_Array_Unmarshal not referenced
@@ -1658,29 +1678,29 @@ TPMA_CC_Array_Marshal(TPMA_CC *source, BYTE **buffer, INT32 *size, INT32 count);
UINT16
TPMS_TAGGED_PCR_SELECT_Array_Marshal(TPMS_TAGGED_PCR_SELECT *source, BYTE **buffer, INT32 *size, INT32 count);
-// Array Marshal/Unmarshal for TPM_ECC_CURVE
-#ifdef TPM_ALG_ECC
-// TPM_ECC_CURVE_Array_Unmarshal not referenced
+// Array Marshal/Unmarshal for TPM2_ECC_CURVE
+#ifdef TPM2_ALG_ECC
+// TPM2_ECC_CURVE_Array_Unmarshal not referenced
UINT16
-TPM_ECC_CURVE_Array_Marshal(TPM_ECC_CURVE *source, BYTE **buffer, INT32 *size, INT32 count);
+TPM_ECC_CURVE_Array_Marshal(TPM2_ECC_CURVE *source, BYTE **buffer, INT32 *size, INT32 count);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// Array Marshal/Unmarshal for TPM2B_DIGEST
-TPM_RC
+TPM2_RC
TPM2B_DIGEST_Array_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
TPM2B_DIGEST_Array_Marshal(TPM2B_DIGEST *source, BYTE **buffer, INT32 *size, INT32 count);
-// Array Marshal/Unmarshal for TPM_CC
-TPM_RC
-TPM_CC_Array_Unmarshal(TPM_CC *target, BYTE **buffer, INT32 *size, INT32 count);
+// Array Marshal/Unmarshal for TPM2_CC
+TPM2_RC
+TPM_CC_Array_Unmarshal(TPM2_CC *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
-TPM_CC_Array_Marshal(TPM_CC *source, BYTE **buffer, INT32 *size, INT32 count);
+TPM_CC_Array_Marshal(TPM2_CC *source, BYTE **buffer, INT32 *size, INT32 count);
-// Array Marshal/Unmarshal for TPM_ALG_ID
-TPM_RC
-TPM_ALG_ID_Array_Unmarshal(TPM_ALG_ID *target, BYTE **buffer, INT32 *size, INT32 count);
+// Array Marshal/Unmarshal for TPM2_ALG_ID
+TPM2_RC
+TPM_ALG_ID_Array_Unmarshal(TPM2_ALG_ID *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
-TPM_ALG_ID_Array_Marshal(TPM_ALG_ID *source, BYTE **buffer, INT32 *size, INT32 count);
+TPM_ALG_ID_Array_Marshal(TPM2_ALG_ID *source, BYTE **buffer, INT32 *size, INT32 count);
#endif // _MARSHAL_FP_H
diff --git a/tpm-util/duplicate/include/tpm_duplication_aux.h b/tpm-util/duplicate/include/tpm_duplication_aux.h
index f32655b..442d766 100644
--- a/tpm-util/duplicate/include/tpm_duplication_aux.h
+++ b/tpm-util/duplicate/include/tpm_duplication_aux.h
@@ -18,30 +18,29 @@
#ifndef TPM_DUP_AUX
#define TPM_DUP_AUX
-#include <sapi/tpm20.h>
#include <openssl/rand.h>
#include <openssl/hmac.h>
#include "crypto_aux.h"
-#define BYTES_TO_BITS(val) (val * 8)
+#define BYTES_TO_BITS(val) (val * 8)
-#define INIT_SIMPLE_TPM2B_SIZE( type ) (type).t.size = sizeof( type ) - 2;
+#define INIT_SIMPLE_TPM2B_SIZE( type ) (type).size = sizeof( type ) - 2;
-TPM2B_NAME * GetName(TPMI_ALG_HASH hashAlg, TPM2B_PUBLIC *obj, TPM2B_NAME *outName);
+TPM2B_NAME * GetName(TPMI_ALG_HASH hashAlg, TPM2B_PUBLIC *obj);
TSS2_RC swKeyDuplicate(
- /* IN */
- RSA* rsaKey, TPM2B_PUBLIC* parentKeyPublicPortion, UINT8* policyDigest, int digestSize,
+ RSA* rsaKey, TPM2B_PUBLIC* parentKeyPublicPortion, UINT8* policyDigest, int digestSize,
/* OUT */
- TPM2B_DATA* encryptionKey, TPM2B_PUBLIC *swKeyPublic, TPM2B_PRIVATE *swKeyPrivate, TPM2B_ENCRYPTED_SECRET *encSymSeed);
+ TPM2B* encryptionKey, TPM2B_PUBLIC *swKeyPublic, TPM2B_PRIVATE *swKeyPrivate, TPM2B_ENCRYPTED_SECRET *encSymSeed);
+
void CreateDuplicationBlob(
//IN
TPM2B_PUBLIC_KEY_RSA *protector,
TPMT_PUBLIC * publicPortion,
TPMT_SENSITIVE *sens,
- TPM2B_ENCRYPTED_SECRET *plainSymSeed, TPMI_YES_NO generateInSymSeed,
- TPM2B_DATA *encryptionKey, TPMI_YES_NO generateEncryptionKey,
+ TPM2B *plainSymSeed, TPMI_YES_NO generateInSymSeed,
+ TPM2B encryptionKey, TPMI_YES_NO generateEncryptionKey,
//OUT
TPM2B_PRIVATE *outDuplicate,
@@ -53,16 +52,17 @@ void CreateSwDataObject(
RSA * rsakey,
BYTE * dataToSeal, UINT16 dataSize,
BYTE * policyDigest, UINT16 policyDigestSize,
- TPMT_PUBLIC * outPublic,
+ TPMT_PUBLIC * outPublic,
TPMT_SENSITIVE *outSens);
void CreateDuplicationBlob2B(
- //IN
+ //IN
TPM2B_PUBLIC_KEY_RSA *protector,
- TPM2B_PUBLIC * publicPortion,
- TPM2B_SENSITIVE *sens,
- TPM2B_ENCRYPTED_SECRET *plainSymSeed, TPMI_YES_NO generateInSymSeed,
- TPM2B_DATA *encryptionKey, TPMI_YES_NO generateEncryptionKey,
+ TPM2B_PUBLIC * public2B,
+ TPM2B_SENSITIVE *sens2B,
+ TPM2B *plainSymSeed, TPMI_YES_NO generateInSymSeed,
+ TPM2B encryptionKey, TPMI_YES_NO generateEncryptionKey,
+
//OUT
TPM2B_PRIVATE *outDuplicate,
TPM2B_ENCRYPTED_SECRET *encSymSeed);
@@ -73,7 +73,7 @@ void CreateSwDataObject2B(
RSA * rsaKey,
BYTE * policyDigest, UINT16 policyDigestSize,
//OUT
- TPM2B_PUBLIC * outPublic,
+ TPM2B_PUBLIC * outPublic,
TPM2B_SENSITIVE *outSens);
diff --git a/tpm-util/duplicate/include/util.h b/tpm-util/duplicate/include/util.h
index 1033b5f..d9e2b54 100644
--- a/tpm-util/duplicate/include/util.h
+++ b/tpm-util/duplicate/include/util.h
@@ -18,8 +18,13 @@
#ifndef __UTIL_H__
#define __UTIL_H__
-#include <sapi/tpm20.h>
+#include <tss2/tss2_sys.h>
+#include <tss2/tss2_common.h>
+#include <tss2/tss2_esys.h>
+#include <tss2/tss2_tpm2_types.h>
+#include <tss2/tpm2b.h>
#include <stdlib.h>
+
#include <stdio.h>
#include <string.h>
#include <limits.h>
@@ -29,7 +34,7 @@
void hex_log(UINT8 *pData, UINT32 numBytes, const char* caption);
-TPM_RC ConcatSizedByteBuffer( TPM2B_MAX_BUFFER *result, TPM2B *addBuffer );
+TPM2_RC ConcatSizedByteBuffer( TPM2B_MAX_BUFFER *result, TPM2B *addBuffer );
int saveDataToFile(const char *fileName, UINT8 *buf, UINT16 size);