aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build.sh18
-rw-r--r--tpm-util/duplicate/crypto_aux.c64
-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
-rw-r--r--tpm-util/duplicate/main.c58
-rw-r--r--tpm-util/duplicate/marshal.c3051
-rw-r--r--tpm-util/duplicate/sampleMakefile9
-rw-r--r--tpm-util/duplicate/tpm_duplication_aux.c215
-rw-r--r--tpm-util/duplicate/util.c12
11 files changed, 2042 insertions, 2014 deletions
diff --git a/build.sh b/build.sh
index 6365435..8cb1efa 100644
--- a/build.sh
+++ b/build.sh
@@ -32,12 +32,21 @@ sudo apt-get -y install \
default-jdk \
libgcrypt20-dev
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/
+wget https://www.openssl.org/source/openssl-1.1.0.tar.gz
+gzip -d openssl-1.1.0.tar.gz
+tar -xvf openssl-1.1.0.tar
+cd openssl-1.1.0 && \
+ ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl && \
+ make && \
+sudo make install
+cd ..
+
+export LD_LIBRARY_PATH=/usr/local/ssl/lib
echo "Build SoftHSMv2..."
cd SoftHSMv2
sh autogen.sh
-./configure --disable-gost --with-openssl=/usr/local/
+./configure --disable-gost --with-openssl=/usr/local/ssl
make
make check
sudo make install
@@ -88,3 +97,8 @@ cd TPM2-Plugin
sudo make install
cd ..
sudo ldconfig
+
+echo "Build Duplicate Utility tool"
+cd tpm-util/duplicate
+make -f sampleMakefile
+
diff --git a/tpm-util/duplicate/crypto_aux.c b/tpm-util/duplicate/crypto_aux.c
index 2737ded..c366480 100644
--- a/tpm-util/duplicate/crypto_aux.c
+++ b/tpm-util/duplicate/crypto_aux.c
@@ -38,8 +38,8 @@ int RSA_OAEP_Enc(TPM2B_PUBLIC_KEY_RSA *plain, // plain text to encrypt
BIGNUM* n;
//Encoding
- RC = RSA_padding_add_PKCS1_OAEP_mgf1(encoded, key->b.size, plain->b.buffer, plain->b.size,
- encoding_params->b.buffer, encoding_params->b.size, EVP_sha256(), NULL);
+ RC = RSA_padding_add_PKCS1_OAEP_mgf1(encoded, key->size, plain->buffer, plain->size,
+ encoding_params->buffer, encoding_params->size, EVP_sha256(), NULL);
if(RC!=1)goto cleanup;
@@ -54,17 +54,17 @@ int RSA_OAEP_Enc(TPM2B_PUBLIC_KEY_RSA *plain, // plain text to encrypt
// Over-writing the public N:
//rsa->n = BN_bin2bn(key->b.buffer, key->b.size, rsa->n);
- n = BN_bin2bn(key->b.buffer, key->b.size, NULL);
+ n = BN_bin2bn(key->buffer, key->size, NULL);
RSA_set0_key(rsa,n,NULL, NULL);
//if(rsa->n == NULL) goto cleanup;
if(n == NULL) goto cleanup;
// Encrypting
- RC = RSA_public_encrypt(key->b.size, encoded, cipher->b.buffer, rsa, RSA_NO_PADDING);
+ RC = RSA_public_encrypt(key->size, encoded, cipher->buffer, rsa, RSA_NO_PADDING);
//if(RC<0)goto cleanup;
- cipher->b.size = key->b.size;
+ cipher->size = key->size;
cleanup:
RSA_free(rsa);
@@ -82,11 +82,11 @@ void AES_128_CFB_enc_dec(
TPM2B *ivOut,
const TPMI_YES_NO enc)
{
- TPM2B_SYM_KEY ivTemp = {{0}};
- ivTemp.b.size = 16;
+ TPM2B_SYM_KEY ivTemp = {0};
+ ivTemp.size = 16;
if(ivOut == NULL)
- ivOut = &(ivTemp.b);
+ ivOut = (TPM2B *) &(ivTemp);
memccpy(ivOut->buffer, ivIn->buffer, 0, ivIn->size);
AES_KEY aes;
@@ -124,17 +124,17 @@ UINT32 ChangeEndianDword( UINT32 p )
}
-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 )
{
- TPM2B_DIGEST tmpResult;
+ TPM2B_DIGEST tmpResult;
TPM2B_DIGEST tpm2bLabel, tpm2bBits, tpm2b_i_2;
- UINT8 *tpm2bBitsPtr = &tpm2bBits.t.buffer[0];
- UINT8 *tpm2b_i_2Ptr = &tpm2b_i_2.t.buffer[0];
+ UINT8 *tpm2bBitsPtr = &tpm2bBits.buffer[0];
+ UINT8 *tpm2b_i_2Ptr = &tpm2b_i_2.buffer[0];
TPM2B_DIGEST *bufferList[8];
UINT32 bitsSwizzled, i_Swizzled;
- TPM_RC rval;
+ TPM2_RC rval;
int i, j;
UINT16 bytes = bits / 8;
@@ -144,20 +144,20 @@ TPM_RC KDFa( TPMI_ALG_HASH hashAlg, TPM2B *key, char *label,
PrintSizedBuffer( key );
#endif
- resultKey->t .size = 0;
+ resultKey->size = 0;
- tpm2b_i_2.t.size = 4;
+ tpm2b_i_2.size = 4;
- tpm2bBits.t.size = 4;
+ tpm2bBits.size = 4;
bitsSwizzled = ChangeEndianDword( bits );
*(UINT32 *)tpm2bBitsPtr = bitsSwizzled;
for(i = 0; label[i] != 0 ;i++ );
- tpm2bLabel.t.size = i+1;
- for( i = 0; i < tpm2bLabel.t.size; i++ )
+ tpm2bLabel.size = i+1;
+ for( i = 0; i < tpm2bLabel.size; i++ )
{
- tpm2bLabel.t.buffer[i] = label[i];
+ tpm2bLabel.buffer[i] = label[i];
}
#ifdef DEBUG
@@ -171,11 +171,11 @@ TPM_RC KDFa( TPMI_ALG_HASH hashAlg, TPM2B *key, char *label,
PrintSizedBuffer( contextV );
#endif
- resultKey->t.size = 0;
+ resultKey->size = 0;
i = 1;
- while( resultKey->t.size < bytes )
+ while( resultKey->size < bytes )
{
// Inner loop
@@ -183,11 +183,11 @@ TPM_RC KDFa( TPMI_ALG_HASH hashAlg, TPM2B *key, char *label,
*(UINT32 *)tpm2b_i_2Ptr = i_Swizzled;
j = 0;
- bufferList[j++] = (TPM2B_DIGEST *)&(tpm2b_i_2.b);
- bufferList[j++] = (TPM2B_DIGEST *)&(tpm2bLabel.b);
+ bufferList[j++] = (TPM2B_DIGEST *)&(tpm2b_i_2);
+ bufferList[j++] = (TPM2B_DIGEST *)&(tpm2bLabel);
bufferList[j++] = (TPM2B_DIGEST *)contextU;
bufferList[j++] = (TPM2B_DIGEST *)contextV;
- bufferList[j++] = (TPM2B_DIGEST *)&(tpm2bBits.b);
+ bufferList[j++] = (TPM2B_DIGEST *)&(tpm2bBits);
bufferList[j++] = (TPM2B_DIGEST *)0;
#ifdef DEBUG
for( j = 0; bufferList[j] != 0; j++ )
@@ -197,29 +197,29 @@ TPM_RC KDFa( TPMI_ALG_HASH hashAlg, TPM2B *key, char *label,
}
#endif
rval = (*HmacFunctionPtr )( hashAlg, key, (TPM2B **)&( bufferList[0] ), &tmpResult );
- if( rval != TPM_RC_SUCCESS )
+ if( rval != TPM2_RC_SUCCESS )
{
return( rval );
}
- ConcatSizedByteBuffer( resultKey, &(tmpResult.b) );
+ ConcatSizedByteBuffer( resultKey, (TPM2B *) &(tmpResult) );
}
// Truncate the result to the desired size.
- resultKey->t.size = bytes;
+ resultKey->size = bytes;
#ifdef DEBUG
DebugPrintf( 0, "\n\nKDFA, resultKey = \n" );
PrintSizedBuffer( &( resultKey->b ) );
#endif
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT32 OpenSslHmac( TPMI_ALG_HASH hashAlg, TPM2B *key,TPM2B **bufferList, TPM2B_DIGEST *result )
{
- if(hashAlg != TPM_ALG_SHA256)return -1;
+ if(hashAlg != TPM2_ALG_SHA256)return -1;
UINT32 RC = 0;
HMAC_CTX *hmac = HMAC_CTX_new();
@@ -229,13 +229,13 @@ UINT32 OpenSslHmac( TPMI_ALG_HASH hashAlg, TPM2B *key,TPM2B **bufferList, TPM2B_
HMAC_Init_ex(hmac, key->buffer, key->size, EVP_sha256(), NULL);
- for(i=0;bufferList[i];i++)
+ for(i=0;bufferList[i];i++)
{
HMAC_Update(hmac, bufferList[i]->buffer, bufferList[i]->size);
}
- HMAC_Final(hmac, result->b.buffer, &resLen);
- result->b.size = resLen;
+ HMAC_Final(hmac, result->buffer, &resLen);
+ result->size = resLen;
HMAC_CTX_free(hmac);
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);
diff --git a/tpm-util/duplicate/main.c b/tpm-util/duplicate/main.c
index 662b984..7884711 100644
--- a/tpm-util/duplicate/main.c
+++ b/tpm-util/duplicate/main.c
@@ -19,17 +19,15 @@
//
#include <stdio.h>
-#include <stdlib.h>
+#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-
+#include <unistd.h>
#include <openssl/pem.h>
-
#include <pthread.h>
-
-#include <sapi/tpm20.h>
-#include <tcti/tcti_socket.h>
-
+#include <tss2/tss2-tcti-tabrmd.h>
+#include <tss2/tss2_common.h>
+#include <tss2/tss2_tpm2_types.h>
+#include <tss2/tpm2b.h>
#include "tpm_duplication_aux.h"
#include "util.h"
@@ -40,21 +38,21 @@ char version[] = "0.1";
void PrintHelp()
{
printf(
- "OSSL key to tpm import tool, Version %s\nUsage:"
- "./ossl_tpm_duplicate [-pemfile InputPemFile] [-pempwd inputPemPwd (optional)] [-parentPub inputParentPubFile]"
- "[-dupPub out_dupPubFile] [-dupPriv out_dupPrivFile] [-dupSymSeed out_dupSymSeedFile] [-dupEncKey out_dupEncKeyFile] \n"
+ "OSSL key to tpm import tool, Version %s\nUsage:"
+ "./ossl_tpm_duplicate [-pemfile InputPemFile] [-pempwd inputPemPwd (optional)] [-parentPub inputParentPubFile]"
+ "[-dupPub out_dupPubFile] [-dupPriv out_dupPrivFile] [-dupSymSeed out_dupSymSeedFile] [-dupEncKey out_dupEncKeyFile] \n"
"\n"
, version);
}
-static TPM_RC convert_PEM_To_EVP(EVP_PKEY **evpPkey, /* freed by caller */
+static TPM2_RC convert_PEM_To_EVP(EVP_PKEY **evpPkey, /* freed by caller */
const char *pem_Filename,
const char *pem_pwd)
{
- TPM_RC rc = 0;
+ TPM2_RC rc = 0;
FILE *fp_pemfile = NULL;
- if (rc == 0)
+ if (rc == 0)
{
fp_pemfile = fopen(pem_Filename, "rb"); /* closed @2 */
if(fp_pemfile == NULL) {
@@ -62,10 +60,10 @@ static TPM_RC convert_PEM_To_EVP(EVP_PKEY **evpPkey, /* freed by
}
}
- if (rc == 0)
+ if (rc == 0)
{
*evpPkey = PEM_read_PrivateKey(fp_pemfile, NULL, NULL, (void *)pem_pwd);
- if (*evpPkey == NULL)
+ if (*evpPkey == NULL)
{
printf("convert_PEM_To_EVP: Error reading key file %s\n", pem_Filename);
rc = EXIT_FAILURE;
@@ -73,8 +71,8 @@ static TPM_RC convert_PEM_To_EVP(EVP_PKEY **evpPkey, /* freed by
printf("PEM_read_PrivateKey success for file: %s \n", pem_Filename);
}
-end:
- if (fp_pemfile != NULL)
+end:
+ if (fp_pemfile != NULL)
{
fclose(fp_pemfile);
}
@@ -82,15 +80,15 @@ end:
return rc;
}
-static TPM_RC convert_EVP_to_RSA(RSA **rsaKey, /* freed by caller */
+static TPM2_RC convert_EVP_to_RSA(RSA **rsaKey, /* freed by caller */
EVP_PKEY *evpPkey)
{
- TPM_RC rc = 0;
+ TPM2_RC rc = 0;
- if (rc == 0)
+ if (rc == 0)
{
*rsaKey = EVP_PKEY_get1_RSA(evpPkey);
- if (*rsaKey == NULL)
+ if (*rsaKey == NULL)
{
printf("convert_EVP_to_RSA: EVP_PKEY_get1_RSA failed\n");
rc = EXIT_FAILURE;
@@ -104,7 +102,7 @@ static TPM_RC convert_EVP_to_RSA(RSA **rsaKey, /* freed by caller *
int main(int argc, char* argv[])
{
- TPM_RC rval = 0;
+ TPM2_RC rval = 0;
int count=0;
char pem_Filename[256];
@@ -125,10 +123,10 @@ int main(int argc, char* argv[])
int dupSymSeed_flag = 0;
char dupEncKey_Filename[256];
int dupEncKey_flag = 0;
- 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;
unsigned short file_size = 0;
UINT8 policyDigest[32] = {0};
UINT32 digestSize = 0;
@@ -224,13 +222,13 @@ int main(int argc, char* argv[])
}
// For Duplicate functionality, check all input params are present
- if( (!pemfile_flag) ||
+ if( (!pemfile_flag) ||
(!parent_pub_flag) ||
(!dupPub_flag) ||
(!dupPriv_flag) ||
(!dupSymSeed_flag) ||
(!dupEncKey_flag)
- )
+ )
{
printf("Error: One or more Inputs for Duplicate are not passed as input \n");
return -1;
@@ -252,7 +250,7 @@ int main(int argc, char* argv[])
/* SW key duplicate operation started */
if ( rval == 0 ) {
- rval = swKeyDuplicate(rsaKey, &parentKeyPublicPortion, policyDigest, digestSize,
+ rval = swKeyDuplicate(rsaKey, &parentKeyPublicPortion, policyDigest, digestSize,
&encryptionKey, &swKeyPublic, &swKeyPrivate, &encSymSeed);
if(rval != 0) {
printf("\nswKeyDuplicate failed: 0x%x ! \n", rval);
diff --git a/tpm-util/duplicate/marshal.c b/tpm-util/duplicate/marshal.c
index 27933ba..fd647ed 100644
--- a/tpm-util/duplicate/marshal.c
+++ b/tpm-util/duplicate/marshal.c
@@ -16,18 +16,18 @@
// Author: Arun Kumar Sekar
-#include "marshal.h"
+#include "include/marshal.h"
-TPM_RC
+TPM2_RC
UINT8_Unmarshal(
UINT8 *target, BYTE **buffer, INT32 *size
)
{
if((*size -= 1) < 0)
- return TPM_RC_INSUFFICIENT;
+ return TPM2_RC_INSUFFICIENT;
*target = BYTE_ARRAY_TO_UINT8(*buffer);
*buffer += 1;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -54,16 +54,16 @@ UINT8_Marshal(
// INT8_Unmarshal changed to #define
// INT8_Marshal not referenced
// UINT16 definition from table 2:3
-TPM_RC
+TPM2_RC
UINT16_Unmarshal(
UINT16 *target, BYTE **buffer, INT32 *size
)
{
if((*size -= 2) < 0)
- return TPM_RC_INSUFFICIENT;
+ return TPM2_RC_INSUFFICIENT;
*target = BYTE_ARRAY_TO_UINT16(*buffer);
*buffer += 2;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -87,16 +87,16 @@ UINT16_Marshal(
// 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
)
{
if((*size -= 4) < 0)
- return TPM_RC_INSUFFICIENT;
+ return TPM2_RC_INSUFFICIENT;
*target = BYTE_ARRAY_TO_UINT32(*buffer);
*buffer += 4;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -120,16 +120,16 @@ UINT32_Marshal(
// INT32_Unmarshal changed to #define
// INT32_Marshal not referenced
// UINT64 definition from table 2:3
-TPM_RC
+TPM2_RC
UINT64_Unmarshal(
UINT64 *target, BYTE **buffer, INT32 *size
)
{
if((*size -= 8) < 0)
- return TPM_RC_INSUFFICIENT;
+ return TPM2_RC_INSUFFICIENT;
*target = BYTE_ARRAY_TO_UINT64(*buffer);
*buffer += 8;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -159,223 +159,223 @@ UINT64_Marshal(
// 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
// TPM_KEY_BITS_Unmarshal changed to #define
// TPM_KEY_BITS_Marshal changed to #define
-// 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
-// TPM_GENERATED_Marshal changed to #define
+// Table 2:7 - Definition of TPM2_GENERATED Constants (ConstantsTable)
+// TPM2_GENERATED_Unmarshal not referenced
+// TPM2_GENERATED_Marshal changed to #define
-// Table 2:9 - Definition of TPM_ALG_ID Constants (ConstantsTable)
-// TPM_ALG_ID_Unmarshal changed to #define
-// TPM_ALG_ID_Marshal changed to #define
+// Table 2:9 - Definition of TPM2_ALG_ID Constants (ConstantsTable)
+// TPM2_ALG_ID_Unmarshal changed to #define
+// TPM2_ALG_ID_Marshal changed to #define
-// Table 2:10 - Definition of TPM_ECC_CURVE Constants (ConstantsTable)
-#ifdef TPM_ALG_ECC
-// TPM_ECC_CURVE_Unmarshal changed to #define
-// TPM_ECC_CURVE_Marshal changed to #define
-#endif // TPM_ALG_ECC
+// Table 2:10 - Definition of TPM2_ECC_CURVE Constants (ConstantsTable)
+#ifdef TPM2_ALG_ECC
+// TPM2_ECC_CURVE_Unmarshal changed to #define
+// TPM2_ECC_CURVE_Marshal changed to #define
+#endif // TPM2_ALG_ECC
-// Table 2:13 - Definition of TPM_CC Constants (ConstantsTable)
-// TPM_CC_Unmarshal changed to #define
-// TPM_CC_Marshal changed to #define
+// Table 2:13 - Definition of TPM2_CC Constants (ConstantsTable)
+// TPM2_CC_Unmarshal changed to #define
+// TPM2_CC_Marshal changed to #define
-// Table 2:17 - Definition of TPM_RC Constants (ConstantsTable)
-// TPM_RC_Unmarshal not referenced
-// TPM_RC_Marshal changed to #define
+// Table 2:17 - Definition of TPM2_RC Constants (ConstantsTable)
+// TPM2_RC_Unmarshal not referenced
+// TPM2_RC_Marshal changed to #define
-// Table 2:18 - Definition of TPM_CLOCK_ADJUST Constants (ConstantsTable)
-TPM_RC
-TPM_CLOCK_ADJUST_Unmarshal(
- TPM_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size
+// Table 2:18 - Definition of TPM2_CLOCK_ADJUST Constants (ConstantsTable)
+TPM2_RC
+TPM2_CLOCK_ADJUST_Unmarshal(
+ TPM2_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size
)
{
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
-// TPM_CLOCK_ADJUST_Marshal not referenced
+// TPM2_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
+// Table 2:19 - Definition of TPM2_EO Constants (ConstantsTable)
+TPM2_RC
+TPM2_EO_Unmarshal(
+ TPM2_EO *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT16_Unmarshal((UINT16 *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
switch(*target) {
- case TPM_EO_EQ :
- case TPM_EO_NEQ :
- case TPM_EO_SIGNED_GT :
- case TPM_EO_UNSIGNED_GT :
- case TPM_EO_SIGNED_LT :
- case TPM_EO_UNSIGNED_LT :
- case TPM_EO_SIGNED_GE :
- case TPM_EO_UNSIGNED_GE :
- case TPM_EO_SIGNED_LE :
- case TPM_EO_UNSIGNED_LE :
- case TPM_EO_BITSET :
- case TPM_EO_BITCLEAR :
+ case TPM2_EO_EQ :
+ case TPM2_EO_NEQ :
+ case TPM2_EO_SIGNED_GT :
+ case TPM2_EO_UNSIGNED_GT :
+ case TPM2_EO_SIGNED_LT :
+ case TPM2_EO_UNSIGNED_LT :
+ case TPM2_EO_SIGNED_GE :
+ case TPM2_EO_UNSIGNED_GE :
+ case TPM2_EO_SIGNED_LE :
+ case TPM2_EO_UNSIGNED_LE :
+ case TPM2_EO_BITSET :
+ case TPM2_EO_BITCLEAR :
break;
default :
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
break;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
-// TPM_EO_Marshal not referenced
+// TPM2_EO_Marshal not referenced
-// Table 2:20 - Definition of TPM_ST Constants (ConstantsTable)
-// TPM_ST_Unmarshal changed to #define
-// TPM_ST_Marshal changed to #define
+// Table 2:20 - Definition of TPM2_ST Constants (ConstantsTable)
+// TPM2_ST_Unmarshal changed to #define
+// TPM2_ST_Marshal changed to #define
-// Table 2:21 - Definition of TPM_SU Constants (ConstantsTable)
-TPM_RC
-TPM_SU_Unmarshal(
- TPM_SU *target, BYTE **buffer, INT32 *size
+// Table 2:21 - Definition of TPM2_SU Constants (ConstantsTable)
+TPM2_RC
+TPM2_SU_Unmarshal(
+ TPM2_SU *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT16_Unmarshal((UINT16 *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
switch(*target) {
- case TPM_SU_CLEAR :
- case TPM_SU_STATE :
+ case TPM2_SU_CLEAR :
+ case TPM2_SU_STATE :
break;
default :
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
break;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
-// TPM_SU_Marshal not referenced
+// TPM2_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
+// Table 2:22 - Definition of TPM2_SE Constants (ConstantsTable)
+TPM2_RC
+TPM2_SE_Unmarshal(
+ TPM2_SE *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT8_Unmarshal((UINT8 *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
switch(*target) {
- case TPM_SE_HMAC :
- case TPM_SE_POLICY :
- case TPM_SE_TRIAL :
+ case TPM2_SE_HMAC :
+ case TPM2_SE_POLICY :
+ case TPM2_SE_TRIAL :
break;
default :
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
break;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
-// TPM_SE_Marshal not referenced
+// TPM2_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
+// Table 2:23 - Definition of TPM2_CAP Constants (ConstantsTable)
+TPM2_RC
+TPM2_CAP_Unmarshal(
+ TPM2_CAP *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
switch(*target) {
- case TPM_CAP_ALGS :
- case TPM_CAP_HANDLES :
- case TPM_CAP_COMMANDS :
- case TPM_CAP_PP_COMMANDS :
- case TPM_CAP_AUDIT_COMMANDS :
- case TPM_CAP_PCRS :
- case TPM_CAP_TPM_PROPERTIES :
- case TPM_CAP_PCR_PROPERTIES :
- case TPM_CAP_ECC_CURVES :
- case TPM_CAP_VENDOR_PROPERTY :
+ case TPM2_CAP_ALGS :
+ case TPM2_CAP_HANDLES :
+ case TPM2_CAP_COMMANDS :
+ case TPM2_CAP_PP_COMMANDS :
+ case TPM2_CAP_AUDIT_COMMANDS :
+ case TPM2_CAP_PCRS :
+ case TPM2_CAP_TPM_PROPERTIES :
+ case TPM2_CAP_PCR_PROPERTIES :
+ case TPM2_CAP_ECC_CURVES :
+ case TPM2_CAP_VENDOR_PROPERTY :
break;
default :
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
break;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPM_CAP_Marshal changed to #define
-// Table 2:24 - Definition of TPM_PT Constants (ConstantsTable)
-// TPM_PT_Unmarshal not referenced
-// TPM_PT_Marshal changed to #define
+// Table 2:24 - Definition of TPM2_PT Constants (ConstantsTable)
+// TPM2_PT_Unmarshal not referenced
+// TPM2_PT_Marshal changed to #define
-// Table 2:25 - Definition of TPM_PT_PCR Constants (ConstantsTable)
-// TPM_PT_PCR_Unmarshal not referenced
-// TPM_PT_PCR_Marshal not referenced
+// Table 2:25 - Definition of TPM2_PT_PCR Constants (ConstantsTable)
+// TPM2_PT_PCR_Unmarshal not referenced
+// TPM2_PT_PCR_Marshal not referenced
-// Table 2:26 - Definition of TPM_PS Constants (ConstantsTable)
-// TPM_PS_Unmarshal not referenced
-// TPM_PS_Marshal not referenced
+// Table 2:26 - Definition of TPM2_PS Constants (ConstantsTable)
+// TPM2_PS_Unmarshal not referenced
+// TPM2_PS_Marshal not referenced
// Table 2:27 - Definition of Types for Handles (TypesTable)
// UINT32 definition from table 2:27
-// TPM_HANDLE_Unmarshal changed to #define
-// TPM_HANDLE_Marshal changed to #define
+// TPM2_HANDLE_Unmarshal changed to #define
+// TPM2_HANDLE_Marshal changed to #define
-// Table 2:28 - Definition of TPM_HT Constants (ConstantsTable)
-// TPM_HT_Unmarshal not referenced
-// TPM_HT_Marshal not referenced
+// Table 2:28 - Definition of TPM2_HT Constants (ConstantsTable)
+// TPM2_HT_Unmarshal not referenced
+// TPM2_HT_Marshal not referenced
-// Table 2:29 - Definition of TPM_RH Constants (ConstantsTable)
-// TPM_RH_Unmarshal not referenced
-// TPM_RH_Marshal not referenced
+// Table 2:29 - Definition of TPM2_RH Constants (ConstantsTable)
+// TPM2_RH_Unmarshal not referenced
+// TPM2_RH_Marshal not referenced
-// Table 2:30 - Definition of TPM_HC Constants (ConstantsTable)
-// TPM_HC_Unmarshal not referenced
-// TPM_HC_Marshal not referenced
+// Table 2:30 - Definition of TPM2_HC Constants (ConstantsTable)
+// TPM2_HC_Unmarshal not referenced
+// TPM2_HC_Marshal not referenced
// Table 2:31 - Definition of TPMA_ALGORITHM Bits (BitsTable)
@@ -384,36 +384,36 @@ TPM_CAP_Unmarshal(
// Table 2:32 - Definition of TPMA_OBJECT Bits (BitsTable)
-TPM_RC
+TPM2_RC
TPMA_OBJECT_Unmarshal(
TPMA_OBJECT *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
if(*((UINT32 *)target) & (UINT32)0xfff8f309)
- return TPM_RC_RESERVED_BITS;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_RESERVED_BITS;
+ return TPM2_RC_SUCCESS;
}
// TPMA_OBJECT_Marshal changed to #define
// Table 2:33 - Definition of TPMA_SESSION Bits (BitsTable)
-TPM_RC
+TPM2_RC
TPMA_SESSION_Unmarshal(
TPMA_SESSION *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT8_Unmarshal((UINT8 *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
if(*((UINT8 *)target) & (UINT8)0x18)
- return TPM_RC_RESERVED_BITS;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_RESERVED_BITS;
+ return TPM2_RC_SUCCESS;
}
// TPMA_SESSION_Marshal changed to #define
@@ -445,280 +445,280 @@ TPMA_SESSION_Unmarshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = BYTE_Unmarshal((BYTE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
case NO:
case YES:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_YES_NO_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if (*target == TPM_RH_NULL) {
+ if (*target == TPM2_RH_NULL) {
if(flag)
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
else
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_DH_OBJECT_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if((*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST))
- return TPM_RC_VALUE;
- return TPM_RC_SUCCESS;
+ if((*target < TPM2_PERSISTENT_FIRST) || (*target > TPM2_PERSISTENT_LAST))
+ return TPM2_RC_VALUE;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if (*target == TPM_RH_NULL) {
+ if (*target == TPM2_RH_NULL) {
if(flag)
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
else
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if (*target == TPM_RS_PW) {
+ if (*target == TPM2_RS_PW) {
if(flag)
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
else
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_SH_AUTH_SESSION_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_DH_CONTEXT_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_OWNER:
- case TPM_RH_PLATFORM:
- case TPM_RH_ENDORSEMENT:
+ case TPM2_RH_OWNER:
+ case TPM2_RH_PLATFORM:
+ case TPM2_RH_ENDORSEMENT:
break;
- case TPM_RH_NULL:
+ case TPM2_RH_NULL:
if (flag)
break;
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_RH_HIERARCHY_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_OWNER:
- case TPM_RH_PLATFORM:
- case TPM_RH_ENDORSEMENT:
- case TPM_RH_PLATFORM_NV:
+ case TPM2_RH_OWNER:
+ case TPM2_RH_PLATFORM:
+ case TPM2_RH_ENDORSEMENT:
+ case TPM2_RH_PLATFORM_NV:
break;
- case TPM_RH_NULL:
+ case TPM2_RH_NULL:
if (flag)
break;
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_OWNER:
- case TPM_RH_PLATFORM:
- case TPM_RH_ENDORSEMENT:
- case TPM_RH_LOCKOUT:
+ case TPM2_RH_OWNER:
+ case TPM2_RH_PLATFORM:
+ case TPM2_RH_ENDORSEMENT:
+ case TPM2_RH_LOCKOUT:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_PLATFORM:
+ case TPM2_RH_PLATFORM:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_RH_PLATFORM_Marshal not referenced
@@ -730,176 +730,176 @@ TPMI_RH_PLATFORM_Unmarshal(
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_ENDORSEMENT:
+ case TPM2_RH_ENDORSEMENT:
break;
- case TPM_RH_NULL:
+ case TPM2_RH_NULL:
if (flag)
break;
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_OWNER:
- case TPM_RH_PLATFORM:
+ case TPM2_RH_OWNER:
+ case TPM2_RH_PLATFORM:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_LOCKOUT:
- case TPM_RH_PLATFORM:
+ case TPM2_RH_LOCKOUT:
+ case TPM2_RH_PLATFORM:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_PLATFORM:
- case TPM_RH_OWNER:
+ case TPM2_RH_PLATFORM:
+ case TPM2_RH_OWNER:
break;
default:
- if((*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST))
- return TPM_RC_VALUE;
+ if((*target < TPM2_NV_INDEX_FIRST) || (*target > TPM2_NV_INDEX_LAST))
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_RH_LOCKOUT:
+ case TPM2_RH_LOCKOUT:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_HANDLE_Unmarshal((TPM2_HANDLE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if((*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST))
- return TPM_RC_VALUE;
- return TPM_RC_SUCCESS;
+ if((*target < TPM2_NV_INDEX_FIRST) || (*target > TPM2_NV_INDEX_LAST))
+ return TPM2_RC_VALUE;
+ return TPM2_RC_SUCCESS;
}
// TPMI_RH_NV_INDEX_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_SHA1
- case TPM_ALG_SHA1:
-#endif // TPM_ALG_SHA1
-#ifdef TPM_ALG_SHA256
- case TPM_ALG_SHA256:
-#endif // TPM_ALG_SHA256
-#ifdef TPM_ALG_SHA384
- case TPM_ALG_SHA384:
-#endif // TPM_ALG_SHA384
-#ifdef TPM_ALG_SHA512
- case TPM_ALG_SHA512:
-#endif // TPM_ALG_SHA512
-#ifdef TPM_ALG_SM3_256
- case TPM_ALG_SM3_256:
-#endif // TPM_ALG_SM3_256
+#ifdef TPM2_ALG_SHA1
+ case TPM2_ALG_SHA1:
+#endif // TPM2_ALG_SHA1
+#ifdef TPM2_ALG_SHA256
+ case TPM2_ALG_SHA256:
+#endif // TPM2_ALG_SHA256
+#ifdef TPM2_ALG_SHA384
+ case TPM2_ALG_SHA384:
+#endif // TPM2_ALG_SHA384
+#ifdef TPM2_ALG_SHA512
+ case TPM2_ALG_SHA512:
+#endif // TPM2_ALG_SHA512
+#ifdef TPM2_ALG_SM3_256
+ case TPM2_ALG_SM3_256:
+#endif // TPM2_ALG_SM3_256
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_HASH;
+ return TPM2_RC_HASH;
default:
- return TPM_RC_HASH;
+ return TPM2_RC_HASH;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_HASH_Marshal changed to #define
@@ -911,257 +911,257 @@ TPMI_ALG_HASH_Unmarshal(
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_AES
- case TPM_ALG_AES:
-#endif // TPM_ALG_AES
-#ifdef TPM_ALG_SM4
- case TPM_ALG_SM4:
-#endif // TPM_ALG_SM4
-#ifdef TPM_ALG_CAMELLIA
- case TPM_ALG_CAMELLIA:
-#endif // TPM_ALG_CAMELLIA
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
-#endif // TPM_ALG_XOR
+#ifdef TPM2_ALG_AES
+ case TPM2_ALG_AES:
+#endif // TPM2_ALG_AES
+#ifdef TPM2_ALG_SM4
+ case TPM2_ALG_SM4:
+#endif // TPM2_ALG_SM4
+#ifdef TPM2_ALG_CAMELLIA
+ case TPM2_ALG_CAMELLIA:
+#endif // TPM2_ALG_CAMELLIA
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
+#endif // TPM2_ALG_XOR
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_SYMMETRIC;
+ return TPM2_RC_SYMMETRIC;
default:
- return TPM_RC_SYMMETRIC;
+ return TPM2_RC_SYMMETRIC;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_AES
- case TPM_ALG_AES:
-#endif // TPM_ALG_AES
-#ifdef TPM_ALG_SM4
- case TPM_ALG_SM4:
-#endif // TPM_ALG_SM4
-#ifdef TPM_ALG_CAMELLIA
- case TPM_ALG_CAMELLIA:
-#endif // TPM_ALG_CAMELLIA
+#ifdef TPM2_ALG_AES
+ case TPM2_ALG_AES:
+#endif // TPM2_ALG_AES
+#ifdef TPM2_ALG_SM4
+ case TPM2_ALG_SM4:
+#endif // TPM2_ALG_SM4
+#ifdef TPM2_ALG_CAMELLIA
+ case TPM2_ALG_CAMELLIA:
+#endif // TPM2_ALG_CAMELLIA
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_SYMMETRIC;
+ return TPM2_RC_SYMMETRIC;
default:
- return TPM_RC_SYMMETRIC;
+ return TPM2_RC_SYMMETRIC;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_SYM_OBJECT_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_CTR
- case TPM_ALG_CTR:
-#endif // TPM_ALG_CTR
-#ifdef TPM_ALG_OFB
- case TPM_ALG_OFB:
-#endif // TPM_ALG_OFB
-#ifdef TPM_ALG_CBC
- case TPM_ALG_CBC:
-#endif // TPM_ALG_CBC
-#ifdef TPM_ALG_CFB
- case TPM_ALG_CFB:
-#endif // TPM_ALG_CFB
-#ifdef TPM_ALG_ECB
- case TPM_ALG_ECB:
-#endif // TPM_ALG_ECB
+#ifdef TPM2_ALG_CTR
+ case TPM2_ALG_CTR:
+#endif // TPM2_ALG_CTR
+#ifdef TPM2_ALG_OFB
+ case TPM2_ALG_OFB:
+#endif // TPM2_ALG_OFB
+#ifdef TPM2_ALG_CBC
+ case TPM2_ALG_CBC:
+#endif // TPM2_ALG_CBC
+#ifdef TPM2_ALG_CFB
+ case TPM2_ALG_CFB:
+#endif // TPM2_ALG_CFB
+#ifdef TPM2_ALG_ECB
+ case TPM2_ALG_ECB:
+#endif // TPM2_ALG_ECB
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_MODE;
+ return TPM2_RC_MODE;
default:
- return TPM_RC_MODE;
+ return TPM2_RC_MODE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_SYM_MODE_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_MGF1
- case TPM_ALG_MGF1:
-#endif // TPM_ALG_MGF1
-#ifdef TPM_ALG_KDF1_SP800_56A
- case TPM_ALG_KDF1_SP800_56A:
-#endif // TPM_ALG_KDF1_SP800_56A
-#ifdef TPM_ALG_KDF2
- case TPM_ALG_KDF2:
-#endif // TPM_ALG_KDF2
-#ifdef TPM_ALG_KDF1_SP800_108
- case TPM_ALG_KDF1_SP800_108:
-#endif // TPM_ALG_KDF1_SP800_108
+#ifdef TPM2_ALG_MGF1
+ case TPM2_ALG_MGF1:
+#endif // TPM2_ALG_MGF1
+#ifdef TPM2_ALG_KDF1_SP800_56A
+ case TPM2_ALG_KDF1_SP800_56A:
+#endif // TPM2_ALG_KDF1_SP800_56A
+#ifdef TPM2_ALG_KDF2
+ case TPM2_ALG_KDF2:
+#endif // TPM2_ALG_KDF2
+#ifdef TPM2_ALG_KDF1_SP800_108
+ case TPM2_ALG_KDF1_SP800_108:
+#endif // TPM2_ALG_KDF1_SP800_108
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_KDF;
+ return TPM2_RC_KDF;
default:
- return TPM_RC_KDF;
+ return TPM2_RC_KDF;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_KDF_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_RSASSA
- case TPM_ALG_RSASSA:
-#endif // TPM_ALG_RSASSA
-#ifdef TPM_ALG_RSAPSS
- case TPM_ALG_RSAPSS:
-#endif // TPM_ALG_RSAPSS
-#ifdef TPM_ALG_ECDSA
- case TPM_ALG_ECDSA:
-#endif // TPM_ALG_ECDSA
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
-#endif // TPM_ALG_SM2
-#ifdef TPM_ALG_ECSCHNORR
- case TPM_ALG_ECSCHNORR:
-#endif // TPM_ALG_ECSCHNORR
-#ifdef TPM_ALG_ECDAA
- case TPM_ALG_ECDAA:
-#endif // TPM_ALG_ECDAA
-#ifdef TPM_ALG_HMAC
- case TPM_ALG_HMAC:
-#endif // TPM_ALG_HMAC
+#ifdef TPM2_ALG_RSASSA
+ case TPM2_ALG_RSASSA:
+#endif // TPM2_ALG_RSASSA
+#ifdef TPM2_ALG_RSAPSS
+ case TPM2_ALG_RSAPSS:
+#endif // TPM2_ALG_RSAPSS
+#ifdef TPM2_ALG_ECDSA
+ case TPM2_ALG_ECDSA:
+#endif // TPM2_ALG_ECDSA
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
+#endif // TPM2_ALG_SM2
+#ifdef TPM2_ALG_ECSCHNORR
+ case TPM2_ALG_ECSCHNORR:
+#endif // TPM2_ALG_ECSCHNORR
+#ifdef TPM2_ALG_ECDAA
+ case TPM2_ALG_ECDAA:
+#endif // TPM2_ALG_ECDAA
+#ifdef TPM2_ALG_HMAC
+ case TPM2_ALG_HMAC:
+#endif // TPM2_ALG_HMAC
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_SCHEME;
+ return TPM2_RC_SCHEME;
default:
- return TPM_RC_SCHEME;
+ return TPM2_RC_SCHEME;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_SIG_SCHEME_Marshal changed to #define
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_ECDH
- case TPM_ALG_ECDH:
-#endif // TPM_ALG_ECDH
-#ifdef TPM_ALG_ECMQV
- case TPM_ALG_ECMQV:
-#endif // TPM_ALG_ECMQV
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
-#endif // TPM_ALG_SM2
+#ifdef TPM2_ALG_ECDH
+ case TPM2_ALG_ECDH:
+#endif // TPM2_ALG_ECDH
+#ifdef TPM2_ALG_ECMQV
+ case TPM2_ALG_ECMQV:
+#endif // TPM2_ALG_ECMQV
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
+#endif // TPM2_ALG_SM2
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_SCHEME;
+ return TPM2_RC_SCHEME;
default:
- return TPM_RC_SCHEME;
+ return TPM2_RC_SCHEME;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
- result = TPM_ST_Unmarshal((TPM_ST *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ST_Unmarshal((TPM2_ST *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_ST_NO_SESSIONS:
- case TPM_ST_SESSIONS:
+ case TPM2_ST_NO_SESSIONS:
+ case TPM2_ST_SESSIONS:
break;
default:
- return TPM_RC_BAD_TAG;
+ return TPM2_RC_BAD_TAG;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ST_COMMAND_TAG_Marshal not referenced
-TPM_RC
+TPM2_RC
TPMS_EMPTY_Unmarshal(
TPMS_EMPTY *target, BYTE **buffer, INT32 *size
)
@@ -1170,7 +1170,7 @@ TPMS_EMPTY_Unmarshal(
UNREFERENCED(target);
UNREFERENCED(buffer);
UNREFERENCED(size);
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -1192,36 +1192,36 @@ TPMS_EMPTY_Marshal(
// 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
)
{
switch(selector) {
-#ifdef TPM_ALG_SHA1
- case TPM_ALG_SHA1:
- return BYTE_Array_Unmarshal((BYTE *)(target->sha1), buffer, size, (INT32)SHA1_DIGEST_SIZE);
-#endif // TPM_ALG_SHA1
-#ifdef TPM_ALG_SHA256
- case TPM_ALG_SHA256:
- return BYTE_Array_Unmarshal((BYTE *)(target->sha256), buffer, size, (INT32)SHA256_DIGEST_SIZE);
-#endif // TPM_ALG_SHA256
-#ifdef TPM_ALG_SHA384
- case TPM_ALG_SHA384:
- return BYTE_Array_Unmarshal((BYTE *)(target->sha384), buffer, size, (INT32)SHA384_DIGEST_SIZE);
-#endif // TPM_ALG_SHA384
-#ifdef TPM_ALG_SHA512
- case TPM_ALG_SHA512:
- return BYTE_Array_Unmarshal((BYTE *)(target->sha512), buffer, size, (INT32)SHA512_DIGEST_SIZE);
-#endif // TPM_ALG_SHA512
-#ifdef TPM_ALG_SM3_256
- case TPM_ALG_SM3_256:
- return BYTE_Array_Unmarshal((BYTE *)(target->sm3_256), buffer, size, (INT32)SM3_256_DIGEST_SIZE);
-#endif // TPM_ALG_SM3_256
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#ifdef TPM2_ALG_SHA1
+ case TPM2_ALG_SHA1:
+ return BYTE_Array_Unmarshal((BYTE *)(target->sha1), buffer, size, (INT32)TPM2_SHA1_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA1
+#ifdef TPM2_ALG_SHA256
+ case TPM2_ALG_SHA256:
+ return BYTE_Array_Unmarshal((BYTE *)(target->sha256), buffer, size, (INT32)TPM2_SHA256_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA256
+#ifdef TPM2_ALG_SHA384
+ case TPM2_ALG_SHA384:
+ return BYTE_Array_Unmarshal((BYTE *)(target->sha384), buffer, size, (INT32)TPM2_SHA384_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA384
+#ifdef TPM2_ALG_SHA512
+ case TPM2_ALG_SHA512:
+ return BYTE_Array_Unmarshal((BYTE *)(target->sha512), buffer, size, (INT32)TPM2_SHA512_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA512
+#ifdef TPM2_ALG_SM3_256
+ case TPM2_ALG_SM3_256:
+ return BYTE_Array_Unmarshal((BYTE *)(target->sm3_256), buffer, size, (INT32)TPM2_SM3_256_DIGEST_SIZE);
+#endif // TPM2_ALG_SM3_256
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -1230,27 +1230,27 @@ TPMU_HA_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_SHA1
- case TPM_ALG_SHA1:
- return BYTE_Array_Marshal((BYTE *)(source->sha1), buffer, size, (INT32)SHA1_DIGEST_SIZE);
-#endif // TPM_ALG_SHA1
-#ifdef TPM_ALG_SHA256
- case TPM_ALG_SHA256:
- return BYTE_Array_Marshal((BYTE *)(source->sha256), buffer, size, (INT32)SHA256_DIGEST_SIZE);
-#endif // TPM_ALG_SHA256
-#ifdef TPM_ALG_SHA384
- case TPM_ALG_SHA384:
- return BYTE_Array_Marshal((BYTE *)(source->sha384), buffer, size, (INT32)SHA384_DIGEST_SIZE);
-#endif // TPM_ALG_SHA384
-#ifdef TPM_ALG_SHA512
- case TPM_ALG_SHA512:
- return BYTE_Array_Marshal((BYTE *)(source->sha512), buffer, size, (INT32)SHA512_DIGEST_SIZE);
-#endif // TPM_ALG_SHA512
-#ifdef TPM_ALG_SM3_256
- case TPM_ALG_SM3_256:
- return BYTE_Array_Marshal((BYTE *)(source->sm3_256), buffer, size, (INT32)SM3_256_DIGEST_SIZE);
-#endif // TPM_ALG_SM3_256
- case TPM_ALG_NULL:
+#ifdef TPM2_ALG_SHA1
+ case TPM2_ALG_SHA1:
+ return BYTE_Array_Marshal((BYTE *)(source->sha1), buffer, size, (INT32)TPM2_SHA1_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA1
+#ifdef TPM2_ALG_SHA256
+ case TPM2_ALG_SHA256:
+ return BYTE_Array_Marshal((BYTE *)(source->sha256), buffer, size, (INT32)TPM2_SHA256_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA256
+#ifdef TPM2_ALG_SHA384
+ case TPM2_ALG_SHA384:
+ return BYTE_Array_Marshal((BYTE *)(source->sha384), buffer, size, (INT32)TPM2_SHA384_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA384
+#ifdef TPM2_ALG_SHA512
+ case TPM2_ALG_SHA512:
+ return BYTE_Array_Marshal((BYTE *)(source->sha512), buffer, size, (INT32)TPM2_SHA512_DIGEST_SIZE);
+#endif // TPM2_ALG_SHA512
+#ifdef TPM2_ALG_SM3_256
+ case TPM2_ALG_SM3_256:
+ return BYTE_Array_Marshal((BYTE *)(source->sm3_256), buffer, size, (INT32)TPM2_SM3_256_DIGEST_SIZE);
+#endif // TPM2_ALG_SM3_256
+ case TPM2_ALG_NULL:
return 0;
}
return 0;
@@ -1258,14 +1258,14 @@ TPMU_HA_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hashAlg), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_HA_Unmarshal((TPMU_HA *)&(target->digest), buffer, size, (UINT32)target->hashAlg);
return result;
@@ -1284,21 +1284,21 @@ TPMT_HA_Marshal(
// Table 2:72 - Definition of TPM2B_DIGEST Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_DIGEST_Unmarshal(
TPM2B_DIGEST *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(TPMU_HA))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(TPMU_HA))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -1308,31 +1308,31 @@ TPM2B_DIGEST_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
// Table 2:73 - Definition of TPM2B_DATA Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_DATA_Unmarshal(
TPM2B_DATA *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(TPMT_HA))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(TPMT_HA))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -1342,11 +1342,11 @@ TPM2B_DATA_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
@@ -1370,21 +1370,21 @@ TPM2B_DATA_Marshal(
// Table 2:77 - Definition of TPM2B_EVENT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_EVENT_Unmarshal(
TPM2B_EVENT *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > 1024)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > 1024)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -1392,21 +1392,21 @@ TPM2B_EVENT_Unmarshal(
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_DIGEST_BUFFER)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_DIGEST_BUFFER)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -1416,31 +1416,31 @@ TPM2B_MAX_BUFFER_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_NV_BUFFER_SIZE)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_NV_BUFFER_SIZE)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -1450,31 +1450,31 @@ TPM2B_MAX_NV_BUFFER_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
// Table 2:80 - Definition of TPM2B_TIMEOUT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_TIMEOUT_Unmarshal(
TPM2B_TIMEOUT *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(UINT64))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(UINT64))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -1484,31 +1484,31 @@ TPM2B_TIMEOUT_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
// Table 2:81 - Definition of TPM2B_IV Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_IV_Unmarshal(
TPM2B_IV *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_SYM_BLOCK_SIZE)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_SYM_BLOCK_SIZE)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -1518,11 +1518,11 @@ TPM2B_IV_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
@@ -1531,21 +1531,21 @@ TPM2B_IV_Marshal(
// Table 2:83 - Definition of TPM2B_NAME Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_NAME_Unmarshal(
TPM2B_NAME *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(TPMU_NAME))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.name), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(TPMU_NAME))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->name), buffer, size, (INT32)(target->size));
return result;
}
@@ -1555,11 +1555,11 @@ TPM2B_NAME_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.name), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->name), buffer, size, (INT32)(source->size)));
return result;
}
@@ -1570,22 +1570,22 @@ TPM2B_NAME_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hash), buffer, size, 0);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = UINT8_Unmarshal((UINT8 *)&(target->sizeofSelect), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
- if( (target->sizeofSelect < PCR_SELECT_MIN))
- return TPM_RC_VALUE;
- if((target->sizeofSelect) > PCR_SELECT_MAX)
- return TPM_RC_VALUE;
+ if( (target->sizeofSelect < TPM2_PT_PCR_SELECT_MIN))
+ return TPM2_RC_VALUE;
+ if((target->sizeofSelect) > TPM2_PCR_SELECT_MAX)
+ return TPM2_RC_VALUE;
result = BYTE_Array_Unmarshal((BYTE *)(target->pcrSelect), buffer, size, (INT32)(target->sizeofSelect));
return result;
}
@@ -1604,19 +1604,19 @@ TPMS_PCR_SELECTION_Marshal(
// 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
)
{
- TPM_RC result;
- result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ST_Unmarshal((TPM2_ST *)&(target->tag), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if( ((target->tag) != TPM_ST_CREATION))
- return TPM_RC_TAG;
+ if( ((target->tag) != TPM2_ST_CREATION))
+ return TPM2_RC_TAG;
result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size);
return result;
@@ -1628,7 +1628,7 @@ TPMT_TK_CREATION_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size));
+ result = (UINT16)(result + TPM_ST_Marshal((TPM2_ST *)&(source->tag), buffer, size));
result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size));
result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size));
return result;
@@ -1636,19 +1636,19 @@ TPMT_TK_CREATION_Marshal(
// 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
)
{
- TPM_RC result;
- result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ST_Unmarshal((TPM2_ST *)&(target->tag), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if( ((target->tag) != TPM_ST_VERIFIED))
- return TPM_RC_TAG;
+ if( ((target->tag) != TPM2_ST_VERIFIED))
+ return TPM2_RC_TAG;
result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size);
return result;
@@ -1660,7 +1660,7 @@ TPMT_TK_VERIFIED_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size));
+ result = (UINT16)(result + TPM_ST_Marshal((TPM2_ST *)&(source->tag), buffer, size));
result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size));
result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size));
return result;
@@ -1668,20 +1668,20 @@ TPMT_TK_VERIFIED_Marshal(
// 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
)
{
- TPM_RC result;
- result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ST_Unmarshal((TPM2_ST *)&(target->tag), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if( ((target->tag) != TPM_ST_AUTH_SIGNED)
- && ((target->tag) != TPM_ST_AUTH_SECRET))
- return TPM_RC_TAG;
+ if( ((target->tag) != TPM2_ST_AUTH_SIGNED)
+ && ((target->tag) != TPM2_ST_AUTH_SECRET))
+ return TPM2_RC_TAG;
result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size);
return result;
@@ -1693,7 +1693,7 @@ TPMT_TK_AUTH_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size));
+ result = (UINT16)(result + TPM_ST_Marshal((TPM2_ST *)&(source->tag), buffer, size));
result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size));
result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size));
return result;
@@ -1701,19 +1701,19 @@ TPMT_TK_AUTH_Marshal(
// 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
)
{
- TPM_RC result;
- result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ST_Unmarshal((TPM2_ST *)&(target->tag), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if( ((target->tag) != TPM_ST_HASHCHECK))
- return TPM_RC_TAG;
+ if( ((target->tag) != TPM2_ST_HASHCHECK))
+ return TPM2_RC_TAG;
result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size);
return result;
@@ -1725,7 +1725,7 @@ TPMT_TK_HASHCHECK_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size));
+ result = (UINT16)(result + TPM_ST_Marshal((TPM2_ST *)&(source->tag), buffer, size));
result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size));
result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size));
return result;
@@ -1740,7 +1740,7 @@ TPMS_ALG_PROPERTY_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM_ALG_ID *)&(source->alg), buffer, size));
+ result = (UINT16)(result + TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)&(source->alg), buffer, size));
result = (UINT16)(result + TPMA_ALGORITHM_Marshal((TPMA_ALGORITHM *)&(source->algProperties), buffer, size));
return result;
}
@@ -1754,7 +1754,7 @@ TPMS_TAGGED_PROPERTY_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_PT_Marshal((TPM_PT *)&(source->property), buffer, size));
+ result = (UINT16)(result + TPM_PT_Marshal((TPM2_PT *)&(source->property), buffer, size));
result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->value), buffer, size));
return result;
}
@@ -1768,7 +1768,7 @@ TPMS_TAGGED_PCR_SELECT_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_PT_Marshal((TPM_PT *)&(source->tag), buffer, size));
+ result = (UINT16)(result + TPM_PT_Marshal((TPM2_PT *)&(source->tag), buffer, size));
result = (UINT16)(result + UINT8_Marshal((UINT8 *)&(source->sizeofSelect), buffer, size));
result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->pcrSelect), buffer, size, (INT32)(source->sizeofSelect)));
return result;
@@ -1776,18 +1776,18 @@ TPMS_TAGGED_PCR_SELECT_Marshal(
// Table 2:95 - Definition of TPML_CC Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_CC_Unmarshal(
TPML_CC *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
- if((target->count) > MAX_CAP_CC)
- return TPM_RC_SIZE;
- result = TPM_CC_Array_Unmarshal((TPM_CC *)(target->commandCodes), buffer, size, (INT32)(target->count));
+ if((target->count) > TPM2_MAX_CAP_CC)
+ return TPM2_RC_SIZE;
+ result = TPM_CC_Array_Unmarshal((TPM2_CC *)(target->commandCodes), buffer, size, (INT32)(target->count));
return result;
}
@@ -1798,7 +1798,7 @@ TPML_CC_Marshal(
{
UINT16 result = 0;
result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size));
- result = (UINT16)(result + TPM_CC_Array_Marshal((TPM_CC *)(source->commandCodes), buffer, size, (INT32)(source->count)));
+ result = (UINT16)(result + TPM_CC_Array_Marshal((TPM2_CC *)(source->commandCodes), buffer, size, (INT32)(source->count)));
return result;
}
@@ -1818,18 +1818,18 @@ TPML_CCA_Marshal(
// Table 2:97 - Definition of TPML_ALG Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_ALG_Unmarshal(
TPML_ALG *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
- if((target->count) > MAX_ALG_LIST_SIZE)
- return TPM_RC_SIZE;
- result = TPM_ALG_ID_Array_Unmarshal((TPM_ALG_ID *)(target->algorithms), buffer, size, (INT32)(target->count));
+ if((target->count) > TPM2_MAX_ALG_LIST_SIZE)
+ return TPM2_RC_SIZE;
+ result = TPM_ALG_ID_Array_Unmarshal((TPM2_ALG_ID *)(target->algorithms), buffer, size, (INT32)(target->count));
return result;
}
@@ -1840,7 +1840,7 @@ TPML_ALG_Marshal(
{
UINT16 result = 0;
result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size));
- result = (UINT16)(result + TPM_ALG_ID_Array_Marshal((TPM_ALG_ID *)(source->algorithms), buffer, size, (INT32)(source->count)));
+ result = (UINT16)(result + TPM_ALG_ID_Array_Marshal((TPM2_ALG_ID *)(source->algorithms), buffer, size, (INT32)(source->count)));
return result;
}
@@ -1854,25 +1854,25 @@ TPML_HANDLE_Marshal(
{
UINT16 result = 0;
result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size));
- result = (UINT16)(result + TPM_HANDLE_Array_Marshal((TPM_HANDLE *)(source->handle), buffer, size, (INT32)(source->count)));
+ result = (UINT16)(result + TPM_HANDLE_Array_Marshal((TPM2_HANDLE *)(source->handle), buffer, size, (INT32)(source->count)));
return result;
}
// Table 2:99 - Definition of TPML_DIGEST Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPML_DIGEST_Unmarshal(
TPML_DIGEST *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
if( (target->count < 2))
- return TPM_RC_SIZE;
+ return TPM2_RC_SIZE;
if((target->count) > 8)
- return TPM_RC_SIZE;
+ return TPM2_RC_SIZE;
result = TPM2B_DIGEST_Array_Unmarshal((TPM2B_DIGEST *)(target->digests), buffer, size, (INT32)(target->count));
return result;
}
@@ -1890,21 +1890,21 @@ TPML_DIGEST_Marshal(
// 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
+ TPML_DIGEST_VALUES *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
if((target->count) > HASH_COUNT)
- return TPM_RC_SIZE;
+ return TPM2_RC_SIZE;
result = TPMT_HA_Array_Unmarshal((TPMT_HA *)(target->digests), buffer, size, 0, (INT32)(target->count));
return result;
}
-
+*/
UINT16
TPML_DIGEST_VALUES_Marshal(
TPML_DIGEST_VALUES *source, BYTE **buffer, INT32 *size
@@ -1923,17 +1923,17 @@ TPML_DIGEST_VALUES_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
if((target->count) > HASH_COUNT)
- return TPM_RC_SIZE;
+ return TPM2_RC_SIZE;
result = TPMS_PCR_SELECTION_Array_Unmarshal((TPMS_PCR_SELECTION *)(target->pcrSelections), buffer, size, (INT32)(target->count));
return result;
}
@@ -1993,7 +1993,7 @@ TPML_TAGGED_PCR_PROPERTY_Marshal(
// 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(
@@ -2002,11 +2002,11 @@ TPML_ECC_CURVE_Marshal(
{
UINT16 result = 0;
result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size));
- result = (UINT16)(result + TPM_ECC_CURVE_Array_Marshal((TPM_ECC_CURVE *)(source->eccCurves), buffer, size, (INT32)(source->count)));
+ result = (UINT16)(result + TPM_ECC_CURVE_Array_Marshal((TPM2_ECC_CURVE *)(source->eccCurves), buffer, size, (INT32)(source->count)));
return result;
}
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
#ifdef ME11_SIM
UINT16
@@ -2036,28 +2036,28 @@ TPMU_CAPABILITIES_Marshal(
)
{
switch(selector) {
- case TPM_CAP_ALGS:
+ case TPM2_CAP_ALGS:
return TPML_ALG_PROPERTY_Marshal((TPML_ALG_PROPERTY *)&(source->algorithms), buffer, size);
- case TPM_CAP_HANDLES:
+ case TPM2_CAP_HANDLES:
return TPML_HANDLE_Marshal((TPML_HANDLE *)&(source->handles), buffer, size);
- case TPM_CAP_COMMANDS:
+ case TPM2_CAP_COMMANDS:
return TPML_CCA_Marshal((TPML_CCA *)&(source->command), buffer, size);
- case TPM_CAP_PP_COMMANDS:
+ case TPM2_CAP_PP_COMMANDS:
return TPML_CC_Marshal((TPML_CC *)&(source->ppCommands), buffer, size);
- case TPM_CAP_AUDIT_COMMANDS:
+ case TPM2_CAP_AUDIT_COMMANDS:
return TPML_CC_Marshal((TPML_CC *)&(source->auditCommands), buffer, size);
- case TPM_CAP_PCRS:
+ case TPM2_CAP_PCRS:
return TPML_PCR_SELECTION_Marshal((TPML_PCR_SELECTION *)&(source->assignedPCR), buffer, size);
- case TPM_CAP_TPM_PROPERTIES:
+ case TPM2_CAP_TPM_PROPERTIES:
return TPML_TAGGED_TPM_PROPERTY_Marshal((TPML_TAGGED_TPM_PROPERTY *)&(source->tpmProperties), buffer, size);
- case TPM_CAP_PCR_PROPERTIES:
+ case TPM2_CAP_PCR_PROPERTIES:
return TPML_TAGGED_PCR_PROPERTY_Marshal((TPML_TAGGED_PCR_PROPERTY *)&(source->pcrProperties), buffer, size);
-#ifdef TPM_ALG_ECC
- case TPM_CAP_ECC_CURVES:
+#ifdef TPM2_ALG_ECC
+ case TPM2_CAP_ECC_CURVES:
return TPML_ECC_CURVE_Marshal((TPML_ECC_CURVE *)&(source->eccCurves), buffer, size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
#ifdef ME11_SIM
- case TPM_CAP_VENDOR_PROPERTY:
+ case TPM2_CAP_VENDOR_PROPERTY:
return INTEL_PROPERTY_Marshal((INTEL_PROPERTY *)&(source->intelProperty), buffer, size);
#endif
}
@@ -2073,7 +2073,7 @@ TPMS_CAPABILITY_DATA_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_CAP_Marshal((TPM_CAP *)&(source->capability), buffer, size));
+ result = (UINT16)(result + TPM_CAP_Marshal((TPM2_CAP *)&(source->capability), buffer, size));
result = (UINT16)(result + TPMU_CAPABILITIES_Marshal((TPMU_CAPABILITIES *)&(source->data), buffer, size, (UINT32)source->capability));
return result;
}
@@ -2160,7 +2160,7 @@ TPMS_COMMAND_AUDIT_INFO_Marshal(
{
UINT16 result = 0;
result = (UINT16)(result + UINT64_Marshal((UINT64 *)&(source->auditCounter), buffer, size));
- result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM_ALG_ID *)&(source->digestAlg), buffer, size));
+ result = (UINT16)(result + TPM2_ALG_ID_Marshal((TPM2_ALG_ID *)&(source->digestAlg), buffer, size));
result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->auditDigest), buffer, size));
result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->commandDigest), buffer, size));
return result;
@@ -2223,19 +2223,19 @@ TPMU_ATTEST_Marshal(
)
{
switch(selector) {
- case TPM_ST_ATTEST_CERTIFY:
+ case TPM2_ST_ATTEST_CERTIFY:
return TPMS_CERTIFY_INFO_Marshal((TPMS_CERTIFY_INFO *)&(source->certify), buffer, size);
- case TPM_ST_ATTEST_CREATION:
+ case TPM2_ST_ATTEST_CREATION:
return TPMS_CREATION_INFO_Marshal((TPMS_CREATION_INFO *)&(source->creation), buffer, size);
- case TPM_ST_ATTEST_QUOTE:
+ case TPM2_ST_ATTEST_QUOTE:
return TPMS_QUOTE_INFO_Marshal((TPMS_QUOTE_INFO *)&(source->quote), buffer, size);
- case TPM_ST_ATTEST_COMMAND_AUDIT:
+ case TPM2_ST_ATTEST_COMMAND_AUDIT:
return TPMS_COMMAND_AUDIT_INFO_Marshal((TPMS_COMMAND_AUDIT_INFO *)&(source->commandAudit), buffer, size);
- case TPM_ST_ATTEST_SESSION_AUDIT:
+ case TPM2_ST_ATTEST_SESSION_AUDIT:
return TPMS_SESSION_AUDIT_INFO_Marshal((TPMS_SESSION_AUDIT_INFO *)&(source->sessionAudit), buffer, size);
- case TPM_ST_ATTEST_TIME:
+ case TPM2_ST_ATTEST_TIME:
return TPMS_TIME_ATTEST_INFO_Marshal((TPMS_TIME_ATTEST_INFO *)&(source->time), buffer, size);
- case TPM_ST_ATTEST_NV:
+ case TPM2_ST_ATTEST_NV:
return TPMS_NV_CERTIFY_INFO_Marshal((TPMS_NV_CERTIFY_INFO *)&(source->nv), buffer, size);
}
return 0;
@@ -2250,7 +2250,7 @@ TPMS_ATTEST_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_GENERATED_Marshal((TPM_GENERATED *)&(source->magic), buffer, size));
+ result = (UINT16)(result + TPM_GENERATED_Marshal((TPM2_GENERATED *)&(source->magic), buffer, size));
result = (UINT16)(result + TPMI_ST_ATTEST_Marshal((TPMI_ST_ATTEST *)&(source->type), buffer, size));
result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->qualifiedSigner), buffer, size));
result = (UINT16)(result + TPM2B_DATA_Marshal((TPM2B_DATA *)&(source->extraData), buffer, size));
@@ -2269,11 +2269,11 @@ TPM2B_ATTEST_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.attestationData), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->attestationData), buffer, size, (INT32)(source->size)));
return result;
}
@@ -2289,106 +2289,106 @@ TPM2B_ATTEST_Marshal(
// 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
)
{
- TPM_RC result;
- result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_KEY_BITS_Unmarshal((TPM2_KEY_BITS *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
case 128:
case 256:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_AES_KEY_BITS_Marshal changed to #define
-#endif // TPM_ALG_AES
+#endif // TPM2_ALG_AES
// 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
)
{
- TPM_RC result;
- result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_KEY_BITS_Unmarshal((TPM2_KEY_BITS *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
case 128:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_SM4_KEY_BITS_Marshal changed to #define
-#endif // TPM_ALG_SM4
+#endif // TPM2_ALG_SM4
// Table 2:124 - Definition of TPMI_CAMELLIA_KEY_BITS Type (TypeTable)
-#ifdef TPM_ALG_CAMELLIA
-TPM_RC
+#ifdef TPM2_ALG_CAMELLIA
+TPM2_RC
TPMI_CAMELLIA_KEY_BITS_Unmarshal(
- TPMI_CAMELLIA_KEY_BITS *target, BYTE **buffer, INT32 *size
+ TPMI_TPM2_CAMELLIA_KEY_BITS *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_KEY_BITS_Unmarshal((TPM2_KEY_BITS *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
case 128:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_CAMELLIA_KEY_BITS_Marshal changed to #define
-#endif // TPM_ALG_CAMELLIA
+#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
)
{
switch(selector) {
-#ifdef TPM_ALG_AES
- case TPM_ALG_AES:
+#ifdef TPM2_ALG_AES
+ case TPM2_ALG_AES:
return TPMI_AES_KEY_BITS_Unmarshal((TPMI_AES_KEY_BITS *)&(target->aes), buffer, size);
-#endif // TPM_ALG_AES
-#ifdef TPM_ALG_SM4
- case TPM_ALG_SM4:
+#endif // TPM2_ALG_AES
+#ifdef TPM2_ALG_SM4
+ case TPM2_ALG_SM4:
return TPMI_SM4_KEY_BITS_Unmarshal((TPMI_SM4_KEY_BITS *)&(target->sm4), buffer, size);
-#endif // TPM_ALG_SM4
-#ifdef TPM_ALG_CAMELLIA
- case TPM_ALG_CAMELLIA:
- return TPMI_CAMELLIA_KEY_BITS_Unmarshal((TPMI_CAMELLIA_KEY_BITS *)&(target->camellia), buffer, size);
-#endif // TPM_ALG_CAMELLIA
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
+#endif // TPM2_ALG_SM4
+#ifdef TPM2_ALG_CAMELLIA
+ case TPM2_ALG_CAMELLIA:
+ return TPMI_CAMELLIA_KEY_BITS_Unmarshal((TPMI_TPM2_CAMELLIA_KEY_BITS *)&(target->camellia), buffer, size);
+#endif // TPM2_ALG_CAMELLIA
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
return TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->exclusiveOr
), buffer, size, 0);
-#endif // TPM_ALG_XOR
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#endif // TPM2_ALG_XOR
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -2397,24 +2397,24 @@ TPMU_SYM_KEY_BITS_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_AES
- case TPM_ALG_AES:
+#ifdef TPM2_ALG_AES
+ case TPM2_ALG_AES:
return TPMI_AES_KEY_BITS_Marshal((TPMI_AES_KEY_BITS *)&(source->aes), buffer, size);
-#endif // TPM_ALG_AES
-#ifdef TPM_ALG_SM4
- case TPM_ALG_SM4:
+#endif // TPM2_ALG_AES
+#ifdef TPM2_ALG_SM4
+ case TPM2_ALG_SM4:
return TPMI_SM4_KEY_BITS_Marshal((TPMI_SM4_KEY_BITS *)&(source->sm4), buffer, size);
-#endif // TPM_ALG_SM4
-#ifdef TPM_ALG_CAMELLIA
- case TPM_ALG_CAMELLIA:
- return TPMI_CAMELLIA_KEY_BITS_Marshal((TPMI_CAMELLIA_KEY_BITS *)&(source->camellia), buffer, size);
-#endif // TPM_ALG_CAMELLIA
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
+#endif // TPM2_ALG_SM4
+#ifdef TPM2_ALG_CAMELLIA
+ case TPM2_ALG_CAMELLIA:
+ return TPMI_CAMELLIA_KEY_BITS_Marshal((TPMI_TPM2_CAMELLIA_KEY_BITS *)&(source->camellia), buffer, size);
+#endif // TPM2_ALG_CAMELLIA
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
return TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->exclusiveOr
), buffer, size);
-#endif // TPM_ALG_XOR
- case TPM_ALG_NULL:
+#endif // TPM2_ALG_XOR
+ case TPM2_ALG_NULL:
return 0;
}
return 0;
@@ -2422,32 +2422,32 @@ TPMU_SYM_KEY_BITS_Marshal(
// 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
)
{
switch(selector) {
-#ifdef TPM_ALG_AES
- case TPM_ALG_AES:
+#ifdef TPM2_ALG_AES
+ case TPM2_ALG_AES:
return TPMI_ALG_SYM_MODE_Unmarshal((TPMI_ALG_SYM_MODE *)&(target->aes), buffer, size, 1);
-#endif // TPM_ALG_AES
-#ifdef TPM_ALG_SM4
- case TPM_ALG_SM4:
+#endif // TPM2_ALG_AES
+#ifdef TPM2_ALG_SM4
+ case TPM2_ALG_SM4:
return TPMI_ALG_SYM_MODE_Unmarshal((TPMI_ALG_SYM_MODE *)&(target->sm4), buffer, size, 1);
-#endif // TPM_ALG_SM4
-#ifdef TPM_ALG_CAMELLIA
- case TPM_ALG_CAMELLIA:
+#endif // TPM2_ALG_SM4
+#ifdef TPM2_ALG_CAMELLIA
+ case TPM2_ALG_CAMELLIA:
return TPMI_ALG_SYM_MODE_Unmarshal((TPMI_ALG_SYM_MODE *)&(target->camellia), buffer, size, 1);
-#endif // TPM_ALG_CAMELLIA
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
- return TPM_RC_SUCCESS;
-#endif // TPM_ALG_XOR
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#endif // TPM2_ALG_CAMELLIA
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
+ return TPM2_RC_SUCCESS;
+#endif // TPM2_ALG_XOR
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -2456,23 +2456,23 @@ TPMU_SYM_MODE_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_AES
- case TPM_ALG_AES:
+#ifdef TPM2_ALG_AES
+ case TPM2_ALG_AES:
return TPMI_ALG_SYM_MODE_Marshal((TPMI_ALG_SYM_MODE *)&(source->aes), buffer, size);
-#endif // TPM_ALG_AES
-#ifdef TPM_ALG_SM4
- case TPM_ALG_SM4:
+#endif // TPM2_ALG_AES
+#ifdef TPM2_ALG_SM4
+ case TPM2_ALG_SM4:
return TPMI_ALG_SYM_MODE_Marshal((TPMI_ALG_SYM_MODE *)&(source->sm4), buffer, size);
-#endif // TPM_ALG_SM4
-#ifdef TPM_ALG_CAMELLIA
- case TPM_ALG_CAMELLIA:
+#endif // TPM2_ALG_SM4
+#ifdef TPM2_ALG_CAMELLIA
+ case TPM2_ALG_CAMELLIA:
return TPMI_ALG_SYM_MODE_Marshal((TPMI_ALG_SYM_MODE *)&(source->camellia), buffer, size);
-#endif // TPM_ALG_CAMELLIA
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
+#endif // TPM2_ALG_CAMELLIA
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
return 0;
-#endif // TPM_ALG_XOR
- case TPM_ALG_NULL:
+#endif // TPM2_ALG_XOR
+ case TPM2_ALG_NULL:
return 0;
}
return 0;
@@ -2480,17 +2480,17 @@ TPMU_SYM_MODE_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_SYM_Unmarshal((TPMI_ALG_SYM *)&(target->algorithm), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SYM_KEY_BITS_Unmarshal((TPMU_SYM_KEY_BITS *)&(target->keyBits), buffer, size, (UINT32)target->algorithm);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SYM_MODE_Unmarshal((TPMU_SYM_MODE *)&(target->mode), buffer, size, (UINT32)target->algorithm);
return result;
@@ -2500,17 +2500,17 @@ TPMT_SYM_DEF_Unmarshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_SYM_OBJECT_Unmarshal((TPMI_ALG_SYM_OBJECT *)&(target->algorithm), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SYM_KEY_BITS_Unmarshal((TPMU_SYM_KEY_BITS *)&(target->keyBits), buffer, size, (UINT32)target->algorithm);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SYM_MODE_Unmarshal((TPMU_SYM_MODE *)&(target->mode), buffer, size, (UINT32)target->algorithm);
return result;
@@ -2530,21 +2530,21 @@ TPMT_SYM_DEF_OBJECT_Marshal(
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_SYM_KEY_BYTES)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_SYM_KEY_BYTES)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -2554,11 +2554,11 @@ TPM2B_SYM_KEY_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
@@ -2569,21 +2569,21 @@ TPM2B_SYM_KEY_Marshal(
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_SYM_DATA)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_SYM_DATA)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -2593,24 +2593,24 @@ TPM2B_SENSITIVE_DATA_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPM2B_AUTH_Unmarshal((TPM2B_AUTH *)&(target->userAuth), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_SENSITIVE_DATA_Unmarshal((TPM2B_SENSITIVE_DATA *)&(target->data), buffer, size);
return result;
@@ -2620,25 +2620,25 @@ TPMS_SENSITIVE_CREATE_Unmarshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 startSize;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size is zero, then the required structure is missing
- if(target->t.size == 0)
- return TPM_RC_SIZE;
+ if(target->size == 0)
+ return TPM2_RC_SIZE;
startSize = *size;
- result = TPMS_SENSITIVE_CREATE_Unmarshal((TPMS_SENSITIVE_CREATE *)&(target->t.sensitive), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = TPMS_SENSITIVE_CREATE_Unmarshal((TPMS_SENSITIVE_CREATE *)&(target->sensitive), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if(target->t.size != (startSize - *size)) return TPM_RC_SIZE;
- return TPM_RC_SUCCESS;
+ if(target->size != (startSize - *size)) return TPM2_RC_SIZE;
+ return TPM2_RC_SUCCESS;
}
// TPM2B_SENSITIVE_CREATE_Marshal not referenced
@@ -2650,15 +2650,15 @@ TPM2B_SENSITIVE_CREATE_Unmarshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hashAlg), buffer, size, 0);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = UINT16_Unmarshal((UINT16 *)&(target->count), buffer, size);
return result;
@@ -2675,35 +2675,35 @@ TPMS_SCHEME_ECDAA_Marshal(
return result;
}
-#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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_HMAC
- case TPM_ALG_HMAC:
-#endif // TPM_ALG_HMAC
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
-#endif // TPM_ALG_XOR
+#ifdef TPM2_ALG_HMAC
+ case TPM2_ALG_HMAC:
+#endif // TPM2_ALG_HMAC
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
+#endif // TPM2_ALG_XOR
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_KEYEDHASH_SCHEME_Marshal changed to #define
@@ -2716,14 +2716,14 @@ TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hashAlg), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMI_ALG_KDF_Unmarshal((TPMI_ALG_KDF *)&(target->kdf), buffer, size, 1);
return result;
@@ -2742,25 +2742,25 @@ TPMS_SCHEME_XOR_Marshal(
// 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
)
{
switch(selector) {
-#ifdef TPM_ALG_HMAC
- case TPM_ALG_HMAC:
+#ifdef TPM2_ALG_HMAC
+ case TPM2_ALG_HMAC:
return TPMS_SCHEME_HMAC_Unmarshal((TPMS_SCHEME_HMAC *)&(target->hmac), buffer, size);
-#endif // TPM_ALG_HMAC
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
+#endif // TPM2_ALG_HMAC
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
return TPMS_SCHEME_XOR_Unmarshal((TPMS_SCHEME_XOR *)&(target->exclusiveOr
), buffer, size, 1);
-#endif // TPM_ALG_XOR
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#endif // TPM2_ALG_XOR
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -2769,16 +2769,16 @@ TPMU_SCHEME_KEYEDHASH_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_HMAC
- case TPM_ALG_HMAC:
+#ifdef TPM2_ALG_HMAC
+ case TPM2_ALG_HMAC:
return TPMS_SCHEME_HMAC_Marshal((TPMS_SCHEME_HMAC *)&(source->hmac), buffer, size);
-#endif // TPM_ALG_HMAC
-#ifdef TPM_ALG_XOR
- case TPM_ALG_XOR:
+#endif // TPM2_ALG_HMAC
+#ifdef TPM2_ALG_XOR
+ case TPM2_ALG_XOR:
return TPMS_SCHEME_XOR_Marshal((TPMS_SCHEME_XOR *)&(source->exclusiveOr
), buffer, size);
-#endif // TPM_ALG_XOR
- case TPM_ALG_NULL:
+#endif // TPM2_ALG_XOR
+ case TPM2_ALG_NULL:
return 0;
}
return 0;
@@ -2786,14 +2786,14 @@ TPMU_SCHEME_KEYEDHASH_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal((TPMI_ALG_KEYEDHASH_SCHEME *)&(target->scheme), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SCHEME_KEYEDHASH_Unmarshal((TPMU_SCHEME_KEYEDHASH *)&(target->details), buffer, size, (UINT32)target->scheme);
return result;
@@ -2812,98 +2812,98 @@ TPMT_KEYEDHASH_SCHEME_Marshal(
// 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
// TPMS_SIG_SCHEME_RSASSA_Unmarshal changed to #define
// TPMS_SIG_SCHEME_RSASSA_Marshal changed to #define
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// TPMS_SCHEME_HASH definition from table 2:142
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
// TPMS_SIG_SCHEME_RSAPSS_Unmarshal changed to #define
// TPMS_SIG_SCHEME_RSAPSS_Marshal changed to #define
-#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
// TPMS_SIG_SCHEME_ECDSA_Unmarshal changed to #define
// TPMS_SIG_SCHEME_ECDSA_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:143
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SIG_SCHEME_SM2_Unmarshal changed to #define
// TPMS_SIG_SCHEME_SM2_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:143
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal changed to #define
// TPMS_SIG_SCHEME_ECSCHNORR_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_ECDAA definition from table 2:143
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SIG_SCHEME_ECDAA_Unmarshal changed to #define
// TPMS_SIG_SCHEME_ECDAA_Marshal changed to #define
-#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
)
{
switch(selector) {
-#ifdef TPM_ALG_RSASSA
- case TPM_ALG_RSASSA:
+#ifdef TPM2_ALG_RSASSA
+ case TPM2_ALG_RSASSA:
return TPMS_SIG_SCHEME_RSASSA_Unmarshal((TPMS_SIG_SCHEME_RSASSA *)&(target->rsassa), buffer, size);
-#endif // TPM_ALG_RSASSA
-#ifdef TPM_ALG_RSAPSS
- case TPM_ALG_RSAPSS:
+#endif // TPM2_ALG_RSASSA
+#ifdef TPM2_ALG_RSAPSS
+ case TPM2_ALG_RSAPSS:
return TPMS_SIG_SCHEME_RSAPSS_Unmarshal((TPMS_SIG_SCHEME_RSAPSS *)&(target->rsapss), buffer, size);
-#endif // TPM_ALG_RSAPSS
-#ifdef TPM_ALG_ECDSA
- case TPM_ALG_ECDSA:
+#endif // TPM2_ALG_RSAPSS
+#ifdef TPM2_ALG_ECDSA
+ case TPM2_ALG_ECDSA:
return TPMS_SIG_SCHEME_ECDSA_Unmarshal((TPMS_SIG_SCHEME_ECDSA *)&(target->ecdsa), buffer, size);
-#endif // TPM_ALG_ECDSA
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
+#endif // TPM2_ALG_ECDSA
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
return TPMS_SIG_SCHEME_SM2_Unmarshal((TPMS_SIG_SCHEME_SM2 *)&(target->sm2), buffer, size);
-#endif // TPM_ALG_SM2
-#ifdef TPM_ALG_ECSCHNORR
- case TPM_ALG_ECSCHNORR:
+#endif // TPM2_ALG_SM2
+#ifdef TPM2_ALG_ECSCHNORR
+ case TPM2_ALG_ECSCHNORR:
return TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal((TPMS_SIG_SCHEME_ECSCHNORR *)&(target->ecschnorr), buffer, size);
-#endif // TPM_ALG_ECSCHNORR
-#ifdef TPM_ALG_ECDAA
- case TPM_ALG_ECDAA:
+#endif // TPM2_ALG_ECSCHNORR
+#ifdef TPM2_ALG_ECDAA
+ case TPM2_ALG_ECDAA:
return TPMS_SIG_SCHEME_ECDAA_Unmarshal((TPMS_SIG_SCHEME_ECDAA *)&(target->ecdaa), buffer, size);
-#endif // TPM_ALG_ECDAA
-#ifdef TPM_ALG_HMAC
- case TPM_ALG_HMAC:
+#endif // TPM2_ALG_ECDAA
+#ifdef TPM2_ALG_HMAC
+ case TPM2_ALG_HMAC:
return TPMS_SCHEME_HMAC_Unmarshal((TPMS_SCHEME_HMAC *)&(target->hmac), buffer, size);
-#endif // TPM_ALG_HMAC
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#endif // TPM2_ALG_HMAC
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_SIG_SCHEME_Unmarshal((TPMI_ALG_SIG_SCHEME *)&(target->scheme), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SIG_SCHEME_Unmarshal((TPMU_SIG_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme);
return result;
@@ -2913,33 +2913,33 @@ TPMT_SIG_SCHEME_Unmarshal(
// 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
// TPMS_ENC_SCHEME_OAEP_Unmarshal changed to #define
// TPMS_ENC_SCHEME_OAEP_Marshal changed to #define
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// TPMS_EMPTY definition from table 2:146
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
// TPMS_ENC_SCHEME_RSAES_Unmarshal changed to #define
// TPMS_ENC_SCHEME_RSAES_Marshal changed to #define
-#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
// TPMS_KEY_SCHEME_ECDH_Unmarshal changed to #define
// TPMS_KEY_SCHEME_ECDH_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SCHEME_HASH definition from table 2:147
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_KEY_SCHEME_ECMQV_Unmarshal changed to #define
// TPMS_KEY_SCHEME_ECMQV_Marshal changed to #define
-#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)
@@ -2958,32 +2958,32 @@ TPMT_SIG_SCHEME_Unmarshal(
// 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
)
{
switch(selector) {
-#ifdef TPM_ALG_MGF1
- case TPM_ALG_MGF1:
+#ifdef TPM2_ALG_MGF1
+ case TPM2_ALG_MGF1:
return TPMS_SCHEME_MGF1_Unmarshal((TPMS_SCHEME_MGF1 *)&(target->mgf1), buffer, size);
-#endif // TPM_ALG_MGF1
-#ifdef TPM_ALG_KDF1_SP800_56A
- case TPM_ALG_KDF1_SP800_56A:
+#endif // TPM2_ALG_MGF1
+#ifdef TPM2_ALG_KDF1_SP800_56A
+ case TPM2_ALG_KDF1_SP800_56A:
return TPMS_SCHEME_KDF1_SP800_56A_Unmarshal((TPMS_SCHEME_KDF1_SP800_56A *)&(target->kdf1_sp800_56a), buffer, size);
-#endif // TPM_ALG_KDF1_SP800_56A
-#ifdef TPM_ALG_KDF2
- case TPM_ALG_KDF2:
+#endif // TPM2_ALG_KDF1_SP800_56A
+#ifdef TPM2_ALG_KDF2
+ case TPM2_ALG_KDF2:
return TPMS_SCHEME_KDF2_Unmarshal((TPMS_SCHEME_KDF2 *)&(target->kdf2), buffer, size);
-#endif // TPM_ALG_KDF2
-#ifdef TPM_ALG_KDF1_SP800_108
- case TPM_ALG_KDF1_SP800_108:
+#endif // TPM2_ALG_KDF2
+#ifdef TPM2_ALG_KDF1_SP800_108
+ case TPM2_ALG_KDF1_SP800_108:
return TPMS_SCHEME_KDF1_SP800_108_Unmarshal((TPMS_SCHEME_KDF1_SP800_108 *)&(target->kdf1_sp800_108), buffer, size);
-#endif // TPM_ALG_KDF1_SP800_108
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#endif // TPM2_ALG_KDF1_SP800_108
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -2992,23 +2992,23 @@ TPMU_KDF_SCHEME_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_MGF1
- case TPM_ALG_MGF1:
+#ifdef TPM2_ALG_MGF1
+ case TPM2_ALG_MGF1:
return TPMS_SCHEME_MGF1_Marshal((TPMS_SCHEME_MGF1 *)&(source->mgf1), buffer, size);
-#endif // TPM_ALG_MGF1
-#ifdef TPM_ALG_KDF1_SP800_56A
- case TPM_ALG_KDF1_SP800_56A:
+#endif // TPM2_ALG_MGF1
+#ifdef TPM2_ALG_KDF1_SP800_56A
+ case TPM2_ALG_KDF1_SP800_56A:
return TPMS_SCHEME_KDF1_SP800_56A_Marshal((TPMS_SCHEME_KDF1_SP800_56A *)&(source->kdf1_sp800_56a), buffer, size);
-#endif // TPM_ALG_KDF1_SP800_56A
-#ifdef TPM_ALG_KDF2
- case TPM_ALG_KDF2:
+#endif // TPM2_ALG_KDF1_SP800_56A
+#ifdef TPM2_ALG_KDF2
+ case TPM2_ALG_KDF2:
return TPMS_SCHEME_KDF2_Marshal((TPMS_SCHEME_KDF2 *)&(source->kdf2), buffer, size);
-#endif // TPM_ALG_KDF2
-#ifdef TPM_ALG_KDF1_SP800_108
- case TPM_ALG_KDF1_SP800_108:
+#endif // TPM2_ALG_KDF2
+#ifdef TPM2_ALG_KDF1_SP800_108
+ case TPM2_ALG_KDF1_SP800_108:
return TPMS_SCHEME_KDF1_SP800_108_Marshal((TPMS_SCHEME_KDF1_SP800_108 *)&(source->kdf1_sp800_108), buffer, size);
-#endif // TPM_ALG_KDF1_SP800_108
- case TPM_ALG_NULL:
+#endif // TPM2_ALG_KDF1_SP800_108
+ case TPM2_ALG_NULL:
return 0;
}
return 0;
@@ -3016,14 +3016,14 @@ TPMU_KDF_SCHEME_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_KDF_Unmarshal((TPMI_ALG_KDF *)&(target->scheme), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_KDF_SCHEME_Unmarshal((TPMU_KDF_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme);
return result;
@@ -3047,56 +3047,56 @@ TPMT_KDF_SCHEME_Marshal(
// 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
)
{
switch(selector) {
-#ifdef TPM_ALG_ECDH
- case TPM_ALG_ECDH:
+#ifdef TPM2_ALG_ECDH
+ case TPM2_ALG_ECDH:
return TPMS_KEY_SCHEME_ECDH_Unmarshal((TPMS_KEY_SCHEME_ECDH *)&(target->ecdh), buffer, size);
-#endif // TPM_ALG_ECDH
-#ifdef TPM_ALG_ECMQV
- case TPM_ALG_ECMQV:
+#endif // TPM2_ALG_ECDH
+#ifdef TPM2_ALG_ECMQV
+ case TPM2_ALG_ECMQV:
return TPMS_KEY_SCHEME_ECMQV_Unmarshal((TPMS_KEY_SCHEME_ECMQV *)&(target->ecmqv), buffer, size);
-#endif // TPM_ALG_ECMQV
-#ifdef TPM_ALG_RSASSA
- case TPM_ALG_RSASSA:
+#endif // TPM2_ALG_ECMQV
+#ifdef TPM2_ALG_RSASSA
+ case TPM2_ALG_RSASSA:
return TPMS_SIG_SCHEME_RSASSA_Unmarshal((TPMS_SIG_SCHEME_RSASSA *)&(target->rsassa), buffer, size);
-#endif // TPM_ALG_RSASSA
-#ifdef TPM_ALG_RSAPSS
- case TPM_ALG_RSAPSS:
+#endif // TPM2_ALG_RSASSA
+#ifdef TPM2_ALG_RSAPSS
+ case TPM2_ALG_RSAPSS:
return TPMS_SIG_SCHEME_RSAPSS_Unmarshal((TPMS_SIG_SCHEME_RSAPSS *)&(target->rsapss), buffer, size);
-#endif // TPM_ALG_RSAPSS
-#ifdef TPM_ALG_ECDSA
- case TPM_ALG_ECDSA:
+#endif // TPM2_ALG_RSAPSS
+#ifdef TPM2_ALG_ECDSA
+ case TPM2_ALG_ECDSA:
return TPMS_SIG_SCHEME_ECDSA_Unmarshal((TPMS_SIG_SCHEME_ECDSA *)&(target->ecdsa), buffer, size);
-#endif // TPM_ALG_ECDSA
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
+#endif // TPM2_ALG_ECDSA
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
return TPMS_SIG_SCHEME_SM2_Unmarshal((TPMS_SIG_SCHEME_SM2 *)&(target->sm2), buffer, size);
-#endif // TPM_ALG_SM2
-#ifdef TPM_ALG_ECSCHNORR
- case TPM_ALG_ECSCHNORR:
+#endif // TPM2_ALG_SM2
+#ifdef TPM2_ALG_ECSCHNORR
+ case TPM2_ALG_ECSCHNORR:
return TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal((TPMS_SIG_SCHEME_ECSCHNORR *)&(target->ecschnorr), buffer, size);
-#endif // TPM_ALG_ECSCHNORR
-#ifdef TPM_ALG_ECDAA
- case TPM_ALG_ECDAA:
+#endif // TPM2_ALG_ECSCHNORR
+#ifdef TPM2_ALG_ECDAA
+ case TPM2_ALG_ECDAA:
return TPMS_SIG_SCHEME_ECDAA_Unmarshal((TPMS_SIG_SCHEME_ECDAA *)&(target->ecdaa), buffer, size);
-#endif // TPM_ALG_ECDAA
-#ifdef TPM_ALG_OAEP
- case TPM_ALG_OAEP:
+#endif // TPM2_ALG_ECDAA
+#ifdef TPM2_ALG_OAEP
+ case TPM2_ALG_OAEP:
return TPMS_ENC_SCHEME_OAEP_Unmarshal((TPMS_ENC_SCHEME_OAEP *)&(target->oaep), buffer, size);
-#endif // TPM_ALG_OAEP
-#ifdef TPM_ALG_RSAES
- case TPM_ALG_RSAES:
+#endif // TPM2_ALG_OAEP
+#ifdef TPM2_ALG_RSAES
+ case TPM2_ALG_RSAES:
return TPMS_ENC_SCHEME_RSAES_Unmarshal((TPMS_ENC_SCHEME_RSAES *)&(target->rsaes), buffer, size);
-#endif // TPM_ALG_RSAES
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#endif // TPM2_ALG_RSAES
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -3105,47 +3105,47 @@ TPMU_ASYM_SCHEME_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_ECDH
- case TPM_ALG_ECDH:
+#ifdef TPM2_ALG_ECDH
+ case TPM2_ALG_ECDH:
return TPMS_KEY_SCHEME_ECDH_Marshal((TPMS_KEY_SCHEME_ECDH *)&(source->ecdh), buffer, size);
-#endif // TPM_ALG_ECDH
-#ifdef TPM_ALG_ECMQV
- case TPM_ALG_ECMQV:
+#endif // TPM2_ALG_ECDH
+#ifdef TPM2_ALG_ECMQV
+ case TPM2_ALG_ECMQV:
return TPMS_KEY_SCHEME_ECMQV_Marshal((TPMS_KEY_SCHEME_ECMQV *)&(source->ecmqv), buffer, size);
-#endif // TPM_ALG_ECMQV
-#ifdef TPM_ALG_RSASSA
- case TPM_ALG_RSASSA:
+#endif // TPM2_ALG_ECMQV
+#ifdef TPM2_ALG_RSASSA
+ case TPM2_ALG_RSASSA:
return TPMS_SIG_SCHEME_RSASSA_Marshal((TPMS_SIG_SCHEME_RSASSA *)&(source->rsassa), buffer, size);
-#endif // TPM_ALG_RSASSA
-#ifdef TPM_ALG_RSAPSS
- case TPM_ALG_RSAPSS:
+#endif // TPM2_ALG_RSASSA
+#ifdef TPM2_ALG_RSAPSS
+ case TPM2_ALG_RSAPSS:
return TPMS_SIG_SCHEME_RSAPSS_Marshal((TPMS_SIG_SCHEME_RSAPSS *)&(source->rsapss), buffer, size);
-#endif // TPM_ALG_RSAPSS
-#ifdef TPM_ALG_ECDSA
- case TPM_ALG_ECDSA:
+#endif // TPM2_ALG_RSAPSS
+#ifdef TPM2_ALG_ECDSA
+ case TPM2_ALG_ECDSA:
return TPMS_SIG_SCHEME_ECDSA_Marshal((TPMS_SIG_SCHEME_ECDSA *)&(source->ecdsa), buffer, size);
-#endif // TPM_ALG_ECDSA
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
+#endif // TPM2_ALG_ECDSA
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
return TPMS_SIG_SCHEME_SM2_Marshal((TPMS_SIG_SCHEME_SM2 *)&(source->sm2), buffer, size);
-#endif // TPM_ALG_SM2
-#ifdef TPM_ALG_ECSCHNORR
- case TPM_ALG_ECSCHNORR:
+#endif // TPM2_ALG_SM2
+#ifdef TPM2_ALG_ECSCHNORR
+ case TPM2_ALG_ECSCHNORR:
return TPMS_SIG_SCHEME_ECSCHNORR_Marshal((TPMS_SIG_SCHEME_ECSCHNORR *)&(source->ecschnorr), buffer, size);
-#endif // TPM_ALG_ECSCHNORR
-#ifdef TPM_ALG_ECDAA
- case TPM_ALG_ECDAA:
+#endif // TPM2_ALG_ECSCHNORR
+#ifdef TPM2_ALG_ECDAA
+ case TPM2_ALG_ECDAA:
return TPMS_SIG_SCHEME_ECDAA_Marshal((TPMS_SIG_SCHEME_ECDAA *)&(source->ecdaa), buffer, size);
-#endif // TPM_ALG_ECDAA
-#ifdef TPM_ALG_OAEP
- case TPM_ALG_OAEP:
+#endif // TPM2_ALG_ECDAA
+#ifdef TPM2_ALG_OAEP
+ case TPM2_ALG_OAEP:
return TPMS_ENC_SCHEME_OAEP_Marshal((TPMS_ENC_SCHEME_OAEP *)&(source->oaep), buffer, size);
-#endif // TPM_ALG_OAEP
-#ifdef TPM_ALG_RSAES
- case TPM_ALG_RSAES:
+#endif // TPM2_ALG_OAEP
+#ifdef TPM2_ALG_RSAES
+ case TPM2_ALG_RSAES:
return TPMS_ENC_SCHEME_RSAES_Marshal((TPMS_ENC_SCHEME_RSAES *)&(source->rsaes), buffer, size);
-#endif // TPM_ALG_RSAES
- case TPM_ALG_NULL:
+#endif // TPM2_ALG_RSAES
+ case TPM2_ALG_NULL:
return 0;
}
return 0;
@@ -3158,54 +3158,54 @@ TPMU_ASYM_SCHEME_Marshal(
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_OAEP
- case TPM_ALG_OAEP:
-#endif // TPM_ALG_OAEP
-#ifdef TPM_ALG_RSASSA
- case TPM_ALG_RSASSA:
-#endif // TPM_ALG_RSASSA
-#ifdef TPM_ALG_RSAPSS
- case TPM_ALG_RSAPSS:
-#endif // TPM_ALG_RSAPSS
-#ifdef TPM_ALG_RSAES
- case TPM_ALG_RSAES:
-#endif // TPM_ALG_RSAES
+#ifdef TPM2_ALG_OAEP
+ case TPM2_ALG_OAEP:
+#endif // TPM2_ALG_OAEP
+#ifdef TPM2_ALG_RSASSA
+ case TPM2_ALG_RSASSA:
+#endif // TPM2_ALG_RSASSA
+#ifdef TPM2_ALG_RSAPSS
+ case TPM2_ALG_RSAPSS:
+#endif // TPM2_ALG_RSAPSS
+#ifdef TPM2_ALG_RSAES
+ case TPM2_ALG_RSAES:
+#endif // TPM2_ALG_RSAES
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_RSA_SCHEME_Marshal changed to #define
-#endif // TPM_ALG_RSA
+#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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_RSA_SCHEME_Unmarshal((TPMI_ALG_RSA_SCHEME *)&(target->scheme), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_ASYM_SCHEME_Unmarshal((TPMU_ASYM_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme);
return result;
@@ -3222,78 +3222,78 @@ TPMT_RSA_SCHEME_Marshal(
return result;
}
-#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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM2_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_OAEP
- case TPM_ALG_OAEP:
-#endif // TPM_ALG_OAEP
-#ifdef TPM_ALG_RSAES
- case TPM_ALG_RSAES:
-#endif // TPM_ALG_RSAES
+#ifdef TPM2_ALG_OAEP
+ case TPM2_ALG_OAEP:
+#endif // TPM2_ALG_OAEP
+#ifdef TPM2_ALG_RSAES
+ case TPM2_ALG_RSAES:
+#endif // TPM2_ALG_RSAES
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_RSA_DECRYPT_Unmarshal((TPMI_ALG_RSA_DECRYPT *)&(target->scheme), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_ASYM_SCHEME_Unmarshal((TPMU_ASYM_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme);
return result;
}
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_RSA_KEY_BYTES)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_RSA_KEY_BYTES)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -3303,59 +3303,59 @@ TPM2B_PUBLIC_KEY_RSA_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
-#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
)
{
- TPM_RC result;
- result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_KEY_BITS_Unmarshal((TPM2_KEY_BITS *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
case 1024:
case 2048:
break;
default:
- return TPM_RC_VALUE;
+ return TPM2_RC_VALUE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_RSA_KEY_BITS_Marshal changed to #define
-#endif // TPM_ALG_RSA
+#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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_RSA_KEY_BYTES/2)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_RSA_KEY_BYTES/2)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -3365,34 +3365,34 @@ TPM2B_PRIVATE_KEY_RSA_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
-#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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > MAX_ECC_KEY_BYTES)
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > TPM2_MAX_ECC_KEY_BYTES)
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -3402,27 +3402,27 @@ TPM2B_ECC_PARAMETER_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
-#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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->x), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->y), buffer, size);
return result;
@@ -3439,30 +3439,30 @@ TPMS_ECC_POINT_Marshal(
return result;
}
-#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
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 startSize;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size is zero, then the required structure is missing
- if(target->t.size == 0)
- return TPM_RC_SIZE;
+ if(target->size == 0)
+ return TPM2_RC_SIZE;
startSize = *size;
- result = TPMS_ECC_POINT_Unmarshal((TPMS_ECC_POINT *)&(target->t.point), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = TPMS_ECC_POINT_Unmarshal((TPMS_ECC_POINT *)&(target->point), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if(target->t.size != (startSize - *size)) return TPM_RC_SIZE;
- return TPM_RC_SUCCESS;
+ if(target->size != (startSize - *size)) return TPM2_RC_SIZE;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -3475,101 +3475,101 @@ TPM2B_ECC_POINT_Marshal(
// Advance buffer pointer by cononical size of a UINT16
*buffer += 2;
// Marshal the structure
- result = (UINT16)(result + TPMS_ECC_POINT_Marshal((TPMS_ECC_POINT *)&(source->t.point), buffer, size));
+ result = (UINT16)(result + TPMS_ECC_POINT_Marshal((TPMS_ECC_POINT *)&(source->point), buffer, size));
// Marshal the size
result = (UINT16)(result + UINT16_Marshal(&result, &sizeField, size));
return result;
}
-#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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_ECDSA
- case TPM_ALG_ECDSA:
-#endif // TPM_ALG_ECDSA
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
-#endif // TPM_ALG_SM2
-#ifdef TPM_ALG_ECSCHNORR
- case TPM_ALG_ECSCHNORR:
-#endif // TPM_ALG_ECSCHNORR
-#ifdef TPM_ALG_ECDAA
- case TPM_ALG_ECDAA:
-#endif // TPM_ALG_ECDAA
-#ifdef TPM_ALG_ECDH
- case TPM_ALG_ECDH:
-#endif // TPM_ALG_ECDH
-#ifdef TPM_ALG_ECMQV
- case TPM_ALG_ECMQV:
-#endif // TPM_ALG_ECMQV
+#ifdef TPM2_ALG_ECDSA
+ case TPM2_ALG_ECDSA:
+#endif // TPM2_ALG_ECDSA
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
+#endif // TPM2_ALG_SM2
+#ifdef TPM2_ALG_ECSCHNORR
+ case TPM2_ALG_ECSCHNORR:
+#endif // TPM2_ALG_ECSCHNORR
+#ifdef TPM2_ALG_ECDAA
+ case TPM2_ALG_ECDAA:
+#endif // TPM2_ALG_ECDAA
+#ifdef TPM2_ALG_ECDH
+ case TPM2_ALG_ECDH:
+#endif // TPM2_ALG_ECDH
+#ifdef TPM2_ALG_ECMQV
+ case TPM2_ALG_ECMQV:
+#endif // TPM2_ALG_ECMQV
break;
- case TPM_ALG_NULL:
+ case TPM2_ALG_NULL:
if (flag)
break;
- return TPM_RC_SCHEME;
+ return TPM2_RC_SCHEME;
default:
- return TPM_RC_SCHEME;
+ return TPM2_RC_SCHEME;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_ECC_SCHEME_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#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
)
{
- TPM_RC result;
- result = TPM_ECC_CURVE_Unmarshal((TPM_ECC_CURVE *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ECC_CURVE_Unmarshal((TPM2_ECC_CURVE *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
- case TPM_ECC_BN_P256:
- case TPM_ECC_NIST_P256:
+ case TPM2_ECC_BN_P256:
+ case TPM2_ECC_NIST_P256:
#if defined ME11_SIM
#elif defined INTEL_SMX
- case TPM_ECC_SM2_P256:
+ case TPM2_ECC_SM2_P256:
#else
- case TPM_ECC_NIST_P384:
+ case TPM2_ECC_NIST_P384:
#endif
break;
default:
- return TPM_RC_CURVE;
+ return TPM2_RC_CURVE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ECC_CURVE_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_ECC_SCHEME_Unmarshal((TPMI_ALG_ECC_SCHEME *)&(target->scheme), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_ASYM_SCHEME_Unmarshal((TPMU_ASYM_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme);
return result;
@@ -3586,11 +3586,11 @@ TPMT_ECC_SCHEME_Marshal(
return result;
}
-#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(
@@ -3598,7 +3598,7 @@ TPMS_ALGORITHM_DETAIL_ECC_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + TPM_ECC_CURVE_Marshal((TPM_ECC_CURVE *)&(source->curveID), buffer, size));
+ result = (UINT16)(result + TPM_ECC_CURVE_Marshal((TPM2_ECC_CURVE *)&(source->curveID), buffer, size));
result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->keySize), buffer, size));
result = (UINT16)(result + TPMT_KDF_SCHEME_Marshal((TPMT_KDF_SCHEME *)&(source->kdf), buffer, size));
result = (UINT16)(result + TPMT_ECC_SCHEME_Marshal((TPMT_ECC_SCHEME *)&(source->sign), buffer, size));
@@ -3612,19 +3612,19 @@ TPMS_ALGORITHM_DETAIL_ECC_Marshal(
return result;
}
-#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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hash), buffer, size, 0);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_PUBLIC_KEY_RSA_Unmarshal((TPM2B_PUBLIC_KEY_RSA *)&(target->sig), buffer, size);
return result;
@@ -3641,37 +3641,37 @@ TPMS_SIGNATURE_RSA_Marshal(
return result;
}
-#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
// TPMS_SIGNATURE_RSASSA_Unmarshal changed to #define
// TPMS_SIGNATURE_RSASSA_Marshal changed to #define
-#endif // TPM_ALG_RSA
+#endif // TPM2_ALG_RSA
// TPMS_SIGNATURE_RSA definition from table 2:169
-#ifdef TPM_ALG_RSA
+#ifdef TPM2_ALG_RSA
// TPMS_SIGNATURE_RSAPSS_Unmarshal changed to #define
// TPMS_SIGNATURE_RSAPSS_Marshal changed to #define
-#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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hash), buffer, size, 0);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->signatureR), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->signatureS), buffer, size);
return result;
@@ -3689,73 +3689,73 @@ TPMS_SIGNATURE_ECC_Marshal(
return result;
}
-#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
// TPMS_SIGNATURE_ECDSA_Unmarshal changed to #define
// TPMS_SIGNATURE_ECDSA_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SIGNATURE_ECC definition from table 2:171
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SIGNATURE_SM2_Unmarshal changed to #define
// TPMS_SIGNATURE_SM2_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SIGNATURE_ECC definition from table 2:171
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SIGNATURE_ECSCHNORR_Unmarshal changed to #define
// TPMS_SIGNATURE_ECSCHNORR_Marshal changed to #define
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
// TPMS_SIGNATURE_ECC definition from table 2:171
-#ifdef TPM_ALG_ECC
+#ifdef TPM2_ALG_ECC
// TPMS_SIGNATURE_ECDAA_Unmarshal changed to #define
// TPMS_SIGNATURE_ECDAA_Marshal changed to #define
-#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
)
{
switch(selector) {
-#ifdef TPM_ALG_RSASSA
- case TPM_ALG_RSASSA:
+#ifdef TPM2_ALG_RSASSA
+ case TPM2_ALG_RSASSA:
return TPMS_SIGNATURE_RSASSA_Unmarshal((TPMS_SIGNATURE_RSASSA *)&(target->rsassa), buffer, size);
-#endif // TPM_ALG_RSASSA
-#ifdef TPM_ALG_RSAPSS
- case TPM_ALG_RSAPSS:
+#endif // TPM2_ALG_RSASSA
+#ifdef TPM2_ALG_RSAPSS
+ case TPM2_ALG_RSAPSS:
return TPMS_SIGNATURE_RSAPSS_Unmarshal((TPMS_SIGNATURE_RSAPSS *)&(target->rsapss), buffer, size);
-#endif // TPM_ALG_RSAPSS
-#ifdef TPM_ALG_ECDSA
- case TPM_ALG_ECDSA:
+#endif // TPM2_ALG_RSAPSS
+#ifdef TPM2_ALG_ECDSA
+ case TPM2_ALG_ECDSA:
return TPMS_SIGNATURE_ECDSA_Unmarshal((TPMS_SIGNATURE_ECDSA *)&(target->ecdsa), buffer, size);
-#endif // TPM_ALG_ECDSA
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
+#endif // TPM2_ALG_ECDSA
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
return TPMS_SIGNATURE_SM2_Unmarshal((TPMS_SIGNATURE_SM2 *)&(target->sm2), buffer, size);
-#endif // TPM_ALG_SM2
-#ifdef TPM_ALG_ECSCHNORR
- case TPM_ALG_ECSCHNORR:
+#endif // TPM2_ALG_SM2
+#ifdef TPM2_ALG_ECSCHNORR
+ case TPM2_ALG_ECSCHNORR:
return TPMS_SIGNATURE_ECSCHNORR_Unmarshal((TPMS_SIGNATURE_ECSCHNORR *)&(target->ecschnorr), buffer, size);
-#endif // TPM_ALG_ECSCHNORR
-#ifdef TPM_ALG_ECDAA
- case TPM_ALG_ECDAA:
+#endif // TPM2_ALG_ECSCHNORR
+#ifdef TPM2_ALG_ECDAA
+ case TPM2_ALG_ECDAA:
return TPMS_SIGNATURE_ECDAA_Unmarshal((TPMS_SIGNATURE_ECDAA *)&(target->ecdaa), buffer, size);
-#endif // TPM_ALG_ECDAA
-#ifdef TPM_ALG_HMAC
- case TPM_ALG_HMAC:
+#endif // TPM2_ALG_ECDAA
+#ifdef TPM2_ALG_HMAC
+ case TPM2_ALG_HMAC:
return TPMT_HA_Unmarshal((TPMT_HA *)&(target->hmac), buffer, size, 0);
-#endif // TPM_ALG_HMAC
- case TPM_ALG_NULL:
- return TPM_RC_SUCCESS;
+#endif // TPM2_ALG_HMAC
+ case TPM2_ALG_NULL:
+ return TPM2_RC_SUCCESS;
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -3764,35 +3764,35 @@ TPMU_SIGNATURE_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_RSASSA
- case TPM_ALG_RSASSA:
+#ifdef TPM2_ALG_RSASSA
+ case TPM2_ALG_RSASSA:
return TPMS_SIGNATURE_RSASSA_Marshal((TPMS_SIGNATURE_RSASSA *)&(source->rsassa), buffer, size);
-#endif // TPM_ALG_RSASSA
-#ifdef TPM_ALG_RSAPSS
- case TPM_ALG_RSAPSS:
+#endif // TPM2_ALG_RSASSA
+#ifdef TPM2_ALG_RSAPSS
+ case TPM2_ALG_RSAPSS:
return TPMS_SIGNATURE_RSAPSS_Marshal((TPMS_SIGNATURE_RSAPSS *)&(source->rsapss), buffer, size);
-#endif // TPM_ALG_RSAPSS
-#ifdef TPM_ALG_ECDSA
- case TPM_ALG_ECDSA:
+#endif // TPM2_ALG_RSAPSS
+#ifdef TPM2_ALG_ECDSA
+ case TPM2_ALG_ECDSA:
return TPMS_SIGNATURE_ECDSA_Marshal((TPMS_SIGNATURE_ECDSA *)&(source->ecdsa), buffer, size);
-#endif // TPM_ALG_ECDSA
-#ifdef TPM_ALG_SM2
- case TPM_ALG_SM2:
+#endif // TPM2_ALG_ECDSA
+#ifdef TPM2_ALG_SM2
+ case TPM2_ALG_SM2:
return TPMS_SIGNATURE_SM2_Marshal((TPMS_SIGNATURE_SM2 *)&(source->sm2), buffer, size);
-#endif // TPM_ALG_SM2
-#ifdef TPM_ALG_ECSCHNORR
- case TPM_ALG_ECSCHNORR:
+#endif // TPM2_ALG_SM2
+#ifdef TPM2_ALG_ECSCHNORR
+ case TPM2_ALG_ECSCHNORR:
return TPMS_SIGNATURE_ECSCHNORR_Marshal((TPMS_SIGNATURE_ECSCHNORR *)&(source->ecschnorr), buffer, size);
-#endif // TPM_ALG_ECSCHNORR
-#ifdef TPM_ALG_ECDAA
- case TPM_ALG_ECDAA:
+#endif // TPM2_ALG_ECSCHNORR
+#ifdef TPM2_ALG_ECDAA
+ case TPM2_ALG_ECDAA:
return TPMS_SIGNATURE_ECDAA_Marshal((TPMS_SIGNATURE_ECDAA *)&(source->ecdaa), buffer, size);
-#endif // TPM_ALG_ECDAA
-#ifdef TPM_ALG_HMAC
- case TPM_ALG_HMAC:
+#endif // TPM2_ALG_ECDAA
+#ifdef TPM2_ALG_HMAC
+ case TPM2_ALG_HMAC:
return TPMT_HA_Marshal((TPMT_HA *)&(source->hmac), buffer, size);
-#endif // TPM_ALG_HMAC
- case TPM_ALG_NULL:
+#endif // TPM2_ALG_HMAC
+ case TPM2_ALG_NULL:
return 0;
}
return 0;
@@ -3800,14 +3800,14 @@ TPMU_SIGNATURE_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_SIG_SCHEME_Unmarshal((TPMI_ALG_SIG_SCHEME *)&(target->sigAlg), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SIGNATURE_Unmarshal((TPMU_SIGNATURE *)&(target->signature), buffer, size, (UINT32)target->sigAlg);
return result;
@@ -3831,21 +3831,21 @@ TPMT_SIGNATURE_Marshal(
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(TPMU_ENCRYPTED_SECRET))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.secret), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(TPMU_ENCRYPTED_SECRET))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->secret), buffer, size, (INT32)(target->size));
return result;
}
@@ -3855,73 +3855,73 @@ TPM2B_ENCRYPTED_SECRET_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.secret), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->secret), buffer, size, (INT32)(source->size)));
return result;
}
// 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
)
{
- TPM_RC result;
- result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = TPM_ALG_ID_Unmarshal((TPM2_ALG_ID *)target, buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
switch (*target) {
-#ifdef TPM_ALG_SYMCIPHER
- case TPM_ALG_SYMCIPHER:
-#endif // TPM_ALG_SYMCIPHER
-#ifdef TPM_ALG_RSA
- case TPM_ALG_RSA:
-#endif // TPM_ALG_RSA
-#ifdef TPM_ALG_ECC
- case TPM_ALG_ECC:
-#endif // TPM_ALG_ECC
-#ifdef TPM_ALG_KEYEDHASH
- case TPM_ALG_KEYEDHASH:
-#endif // TPM_ALG_KEYEDHASH
+#ifdef TPM2_ALG_SYMCIPHER
+ case TPM2_ALG_SYMCIPHER:
+#endif // TPM2_ALG_SYMCIPHER
+#ifdef TPM2_ALG_RSA
+ case TPM2_ALG_RSA:
+#endif // TPM2_ALG_RSA
+#ifdef TPM2_ALG_ECC
+ case TPM2_ALG_ECC:
+#endif // TPM2_ALG_ECC
+#ifdef TPM2_ALG_KEYEDHASH
+ case TPM2_ALG_KEYEDHASH:
+#endif // TPM2_ALG_KEYEDHASH
break;
default:
- return TPM_RC_TYPE;
+ return TPM2_RC_TYPE;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
// TPMI_ALG_PUBLIC_Marshal changed to #define
// 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
)
{
switch(selector) {
-#ifdef TPM_ALG_KEYEDHASH
- case TPM_ALG_KEYEDHASH:
+#ifdef TPM2_ALG_KEYEDHASH
+ case TPM2_ALG_KEYEDHASH:
return TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->keyedHash), buffer, size);
-#endif // TPM_ALG_KEYEDHASH
-#ifdef TPM_ALG_SYMCIPHER
- case TPM_ALG_SYMCIPHER:
+#endif // TPM2_ALG_KEYEDHASH
+#ifdef TPM2_ALG_SYMCIPHER
+ case TPM2_ALG_SYMCIPHER:
return TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->sym), buffer, size);
-#endif // TPM_ALG_SYMCIPHER
-#ifdef TPM_ALG_RSA
- case TPM_ALG_RSA:
+#endif // TPM2_ALG_SYMCIPHER
+#ifdef TPM2_ALG_RSA
+ case TPM2_ALG_RSA:
return TPM2B_PUBLIC_KEY_RSA_Unmarshal((TPM2B_PUBLIC_KEY_RSA *)&(target->rsa), buffer, size);
-#endif // TPM_ALG_RSA
-#ifdef TPM_ALG_ECC
- case TPM_ALG_ECC:
+#endif // TPM2_ALG_RSA
+#ifdef TPM2_ALG_ECC
+ case TPM2_ALG_ECC:
return TPMS_ECC_POINT_Unmarshal((TPMS_ECC_POINT *)&(target->ecc), buffer, size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -3930,22 +3930,22 @@ TPMU_PUBLIC_ID_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_KEYEDHASH
- case TPM_ALG_KEYEDHASH:
+#ifdef TPM2_ALG_KEYEDHASH
+ case TPM2_ALG_KEYEDHASH:
return TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->keyedHash), buffer, size);
-#endif // TPM_ALG_KEYEDHASH
-#ifdef TPM_ALG_SYMCIPHER
- case TPM_ALG_SYMCIPHER:
+#endif // TPM2_ALG_KEYEDHASH
+#ifdef TPM2_ALG_SYMCIPHER
+ case TPM2_ALG_SYMCIPHER:
return TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->sym), buffer, size);
-#endif // TPM_ALG_SYMCIPHER
-#ifdef TPM_ALG_RSA
- case TPM_ALG_RSA:
+#endif // TPM2_ALG_SYMCIPHER
+#ifdef TPM2_ALG_RSA
+ case TPM2_ALG_RSA:
return TPM2B_PUBLIC_KEY_RSA_Marshal((TPM2B_PUBLIC_KEY_RSA *)&(source->rsa), buffer, size);
-#endif // TPM_ALG_RSA
-#ifdef TPM_ALG_ECC
- case TPM_ALG_ECC:
+#endif // TPM2_ALG_RSA
+#ifdef TPM2_ALG_ECC
+ case TPM2_ALG_ECC:
return TPMS_ECC_POINT_Marshal((TPMS_ECC_POINT *)&(source->ecc), buffer, size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
}
return 0;
}
@@ -3962,21 +3962,21 @@ TPMU_PUBLIC_ID_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMT_SYM_DEF_OBJECT_Unmarshal((TPMT_SYM_DEF_OBJECT *)&(target->symmetric), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMT_RSA_SCHEME_Unmarshal((TPMT_RSA_SCHEME *)&(target->scheme), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMI_RSA_KEY_BITS_Unmarshal((TPMI_RSA_KEY_BITS *)&(target->keyBits), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = UINT32_Unmarshal((UINT32 *)&(target->exponent), buffer, size);
return result;
@@ -3995,25 +3995,25 @@ TPMS_RSA_PARMS_Marshal(
return result;
}
-#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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMT_SYM_DEF_OBJECT_Unmarshal((TPMT_SYM_DEF_OBJECT *)&(target->symmetric), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMT_ECC_SCHEME_Unmarshal((TPMT_ECC_SCHEME *)&(target->scheme), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMI_ECC_CURVE_Unmarshal((TPMI_ECC_CURVE *)&(target->curveID), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMT_KDF_SCHEME_Unmarshal((TPMT_KDF_SCHEME *)&(target->kdf), buffer, size, 1);
return result;
@@ -4032,34 +4032,34 @@ TPMS_ECC_PARMS_Marshal(
return result;
}
-#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
)
{
switch(selector) {
-#ifdef TPM_ALG_KEYEDHASH
- case TPM_ALG_KEYEDHASH:
+#ifdef TPM2_ALG_KEYEDHASH
+ case TPM2_ALG_KEYEDHASH:
return TPMS_KEYEDHASH_PARMS_Unmarshal((TPMS_KEYEDHASH_PARMS *)&(target->keyedHashDetail), buffer, size);
-#endif // TPM_ALG_KEYEDHASH
-#ifdef TPM_ALG_SYMCIPHER
- case TPM_ALG_SYMCIPHER:
+#endif // TPM2_ALG_KEYEDHASH
+#ifdef TPM2_ALG_SYMCIPHER
+ case TPM2_ALG_SYMCIPHER:
return TPMS_SYMCIPHER_PARMS_Unmarshal((TPMS_SYMCIPHER_PARMS *)&(target->symDetail), buffer, size);
-#endif // TPM_ALG_SYMCIPHER
-#ifdef TPM_ALG_RSA
- case TPM_ALG_RSA:
+#endif // TPM2_ALG_SYMCIPHER
+#ifdef TPM2_ALG_RSA
+ case TPM2_ALG_RSA:
return TPMS_RSA_PARMS_Unmarshal((TPMS_RSA_PARMS *)&(target->rsaDetail), buffer, size);
-#endif // TPM_ALG_RSA
-#ifdef TPM_ALG_ECC
- case TPM_ALG_ECC:
+#endif // TPM2_ALG_RSA
+#ifdef TPM2_ALG_ECC
+ case TPM2_ALG_ECC:
return TPMS_ECC_PARMS_Unmarshal((TPMS_ECC_PARMS *)&(target->eccDetail), buffer, size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -4068,36 +4068,36 @@ TPMU_PUBLIC_PARMS_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_KEYEDHASH
- case TPM_ALG_KEYEDHASH:
+#ifdef TPM2_ALG_KEYEDHASH
+ case TPM2_ALG_KEYEDHASH:
return TPMS_KEYEDHASH_PARMS_Marshal((TPMS_KEYEDHASH_PARMS *)&(source->keyedHashDetail), buffer, size);
-#endif // TPM_ALG_KEYEDHASH
-#ifdef TPM_ALG_SYMCIPHER
- case TPM_ALG_SYMCIPHER:
+#endif // TPM2_ALG_KEYEDHASH
+#ifdef TPM2_ALG_SYMCIPHER
+ case TPM2_ALG_SYMCIPHER:
return TPMS_SYMCIPHER_PARMS_Marshal((TPMS_SYMCIPHER_PARMS *)&(source->symDetail), buffer, size);
-#endif // TPM_ALG_SYMCIPHER
-#ifdef TPM_ALG_RSA
- case TPM_ALG_RSA:
+#endif // TPM2_ALG_SYMCIPHER
+#ifdef TPM2_ALG_RSA
+ case TPM2_ALG_RSA:
return TPMS_RSA_PARMS_Marshal((TPMS_RSA_PARMS *)&(source->rsaDetail), buffer, size);
-#endif // TPM_ALG_RSA
-#ifdef TPM_ALG_ECC
- case TPM_ALG_ECC:
+#endif // TPM2_ALG_RSA
+#ifdef TPM2_ALG_ECC
+ case TPM2_ALG_ECC:
return TPMS_ECC_PARMS_Marshal((TPMS_ECC_PARMS *)&(source->eccDetail), buffer, size);
-#endif // TPM_ALG_ECC
+#endif // TPM2_ALG_ECC
}
return 0;
}
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_PUBLIC_Unmarshal((TPMI_ALG_PUBLIC *)&(target->type), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_PUBLIC_PARMS_Unmarshal((TPMU_PUBLIC_PARMS *)&(target->parameters), buffer, size, (UINT32)target->type);
return result;
@@ -4107,26 +4107,26 @@ TPMT_PUBLIC_PARMS_Unmarshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_PUBLIC_Unmarshal((TPMI_ALG_PUBLIC *)&(target->type), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->nameAlg), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMA_OBJECT_Unmarshal((TPMA_OBJECT *)&(target->objectAttributes), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->authPolicy), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_PUBLIC_PARMS_Unmarshal((TPMU_PUBLIC_PARMS *)&(target->parameters), buffer, size, (UINT32)target->type);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_PUBLIC_ID_Unmarshal((TPMU_PUBLIC_ID *)&(target->unique), buffer, size, (UINT32)target->type);
return result;
@@ -4149,25 +4149,25 @@ TPMT_PUBLIC_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 startSize;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size is zero, then the required structure is missing
- if(target->t.size == 0)
- return TPM_RC_SIZE;
+ if(target->size == 0)
+ return TPM2_RC_SIZE;
startSize = *size;
- result = TPMT_PUBLIC_Unmarshal((TPMT_PUBLIC *)&(target->t.publicArea), buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ result = TPMT_PUBLIC_Unmarshal((TPMT_PUBLIC *)&(target->publicArea), buffer, size, flag);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if(target->t.size != (startSize - *size)) return TPM_RC_SIZE;
- return TPM_RC_SUCCESS;
+ if(target->size != (startSize - *size)) return TPM2_RC_SIZE;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -4180,7 +4180,7 @@ TPM2B_PUBLIC_Marshal(
// Advance buffer pointer by cononical size of a UINT16
*buffer += 2;
// Marshal the structure
- result = (UINT16)(result + TPMT_PUBLIC_Marshal((TPMT_PUBLIC *)&(source->t.publicArea), buffer, size));
+ result = (UINT16)(result + TPMT_PUBLIC_Marshal((TPMT_PUBLIC *)&(source->publicArea), buffer, size));
// Marshal the size
result = (UINT16)(result + UINT16_Marshal(&result, &sizeField, size));
return result;
@@ -4193,30 +4193,30 @@ TPM2B_PUBLIC_Marshal(
// 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
)
{
switch(selector) {
-#ifdef TPM_ALG_RSA
- case TPM_ALG_RSA:
+#ifdef TPM2_ALG_RSA
+ case TPM2_ALG_RSA:
return TPM2B_PRIVATE_KEY_RSA_Unmarshal((TPM2B_PRIVATE_KEY_RSA *)&(target->rsa), buffer, size);
-#endif // TPM_ALG_RSA
-#ifdef TPM_ALG_ECC
- case TPM_ALG_ECC:
+#endif // TPM2_ALG_RSA
+#ifdef TPM2_ALG_ECC
+ case TPM2_ALG_ECC:
return TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->ecc), buffer, size);
-#endif // TPM_ALG_ECC
-#ifdef TPM_ALG_KEYEDHASH
- case TPM_ALG_KEYEDHASH:
+#endif // TPM2_ALG_ECC
+#ifdef TPM2_ALG_KEYEDHASH
+ case TPM2_ALG_KEYEDHASH:
return TPM2B_SENSITIVE_DATA_Unmarshal((TPM2B_SENSITIVE_DATA *)&(target->bits), buffer, size);
-#endif // TPM_ALG_KEYEDHASH
-#ifdef TPM_ALG_SYMCIPHER
- case TPM_ALG_SYMCIPHER:
+#endif // TPM2_ALG_KEYEDHASH
+#ifdef TPM2_ALG_SYMCIPHER
+ case TPM2_ALG_SYMCIPHER:
return TPM2B_SYM_KEY_Unmarshal((TPM2B_SYM_KEY *)&(target->sym), buffer, size);
-#endif // TPM_ALG_SYMCIPHER
+#endif // TPM2_ALG_SYMCIPHER
}
- return TPM_RC_SELECTOR;
+ return TPM2_RC_SELECTOR;
}
UINT16
@@ -4225,42 +4225,42 @@ TPMU_SENSITIVE_COMPOSITE_Marshal(
)
{
switch(selector) {
-#ifdef TPM_ALG_RSA
- case TPM_ALG_RSA:
+#ifdef TPM2_ALG_RSA
+ case TPM2_ALG_RSA:
return TPM2B_PRIVATE_KEY_RSA_Marshal((TPM2B_PRIVATE_KEY_RSA *)&(source->rsa), buffer, size);
-#endif // TPM_ALG_RSA
-#ifdef TPM_ALG_ECC
- case TPM_ALG_ECC:
+#endif // TPM2_ALG_RSA
+#ifdef TPM2_ALG_ECC
+ case TPM2_ALG_ECC:
return TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->ecc), buffer, size);
-#endif // TPM_ALG_ECC
-#ifdef TPM_ALG_KEYEDHASH
- case TPM_ALG_KEYEDHASH:
+#endif // TPM2_ALG_ECC
+#ifdef TPM2_ALG_KEYEDHASH
+ case TPM2_ALG_KEYEDHASH:
return TPM2B_SENSITIVE_DATA_Marshal((TPM2B_SENSITIVE_DATA *)&(source->bits), buffer, size);
-#endif // TPM_ALG_KEYEDHASH
-#ifdef TPM_ALG_SYMCIPHER
- case TPM_ALG_SYMCIPHER:
+#endif // TPM2_ALG_KEYEDHASH
+#ifdef TPM2_ALG_SYMCIPHER
+ case TPM2_ALG_SYMCIPHER:
return TPM2B_SYM_KEY_Marshal((TPM2B_SYM_KEY *)&(source->sym), buffer, size);
-#endif // TPM_ALG_SYMCIPHER
+#endif // TPM2_ALG_SYMCIPHER
}
return 0;
}
// Table 2:188 - Definition of TPMT_SENSITIVE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMT_SENSITIVE_Unmarshal(
TPMT_SENSITIVE *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_ALG_PUBLIC_Unmarshal((TPMI_ALG_PUBLIC *)&(target->sensitiveType), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_AUTH_Unmarshal((TPM2B_AUTH *)&(target->authValue), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->seedValue), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMU_SENSITIVE_COMPOSITE_Unmarshal((TPMU_SENSITIVE_COMPOSITE *)&(target->sensitive), buffer, size, (UINT32)target->sensitiveType);
return result;
@@ -4281,25 +4281,25 @@ TPMT_SENSITIVE_Marshal(
// Table 2:189 - Definition of TPM2B_SENSITIVE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_SENSITIVE_Unmarshal(
TPM2B_SENSITIVE *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 startSize;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
startSize = *size;
- result = TPMT_SENSITIVE_Unmarshal((TPMT_SENSITIVE *)&(target->t.sensitiveArea), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = TPMT_SENSITIVE_Unmarshal((TPMT_SENSITIVE *)&(target->sensitiveArea), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if(target->t.size != (startSize - *size)) return TPM_RC_SIZE;
- return TPM_RC_SUCCESS;
+ if(target->size != (startSize - *size)) return TPM2_RC_SIZE;
+ return TPM2_RC_SUCCESS;
}
// TPM2B_SENSITIVE_Marshal not referenced
@@ -4311,21 +4311,21 @@ TPM2B_SENSITIVE_Unmarshal(
// Table 2:191 - Definition of TPM2B_PRIVATE Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPM2B_PRIVATE_Unmarshal(
TPM2B_PRIVATE *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(_PRIVATE))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(_PRIVATE))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -4335,11 +4335,11 @@ TPM2B_PRIVATE_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
@@ -4350,21 +4350,21 @@ TPM2B_PRIVATE_Marshal(
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(_ID_OBJECT))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.credential), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(_ID_OBJECT))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->credential), buffer, size, (INT32)(target->size));
return result;
}
@@ -4374,63 +4374,63 @@ TPM2B_ID_OBJECT_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.credential), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->credential), buffer, size, (INT32)(source->size)));
return result;
}
-// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT32_Unmarshal((UINT32 *)target, buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
if(*((UINT32 *)target) & (UINT32)0x01f00380)
- return TPM_RC_RESERVED_BITS;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_RESERVED_BITS;
+ return TPM2_RC_SUCCESS;
}
// TPMA_NV_Marshal changed to #define
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
result = TPMI_RH_NV_INDEX_Unmarshal((TPMI_RH_NV_INDEX *)&(target->nvIndex), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->nameAlg), buffer, size, 0);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMA_NV_Unmarshal((TPMA_NV *)&(target->attributes), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->authPolicy), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = UINT16_Unmarshal((UINT16 *)&(target->dataSize), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
if( (target->dataSize> MAX_NV_INDEX_SIZE))
- return TPM_RC_SIZE;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SIZE;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -4449,25 +4449,25 @@ TPMS_NV_PUBLIC_Marshal(
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 startSize;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size is zero, then the required structure is missing
- if(target->t.size == 0)
- return TPM_RC_SIZE;
+ if(target->size == 0)
+ return TPM2_RC_SIZE;
startSize = *size;
- result = TPMS_NV_PUBLIC_Unmarshal((TPMS_NV_PUBLIC *)&(target->t.nvPublic), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = TPMS_NV_PUBLIC_Unmarshal((TPMS_NV_PUBLIC *)&(target->nvPublic), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
- if(target->t.size != (startSize - *size)) return TPM_RC_SIZE;
- return TPM_RC_SUCCESS;
+ if(target->size != (startSize - *size)) return TPM2_RC_SIZE;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -4480,7 +4480,7 @@ TPM2B_NV_PUBLIC_Marshal(
// Advance buffer pointer by cononical size of a UINT16
*buffer += 2;
// Marshal the structure
- result = (UINT16)(result + TPMS_NV_PUBLIC_Marshal((TPMS_NV_PUBLIC *)&(source->t.nvPublic), buffer, size));
+ result = (UINT16)(result + TPMS_NV_PUBLIC_Marshal((TPMS_NV_PUBLIC *)&(source->nvPublic), buffer, size));
// Marshal the size
result = (UINT16)(result + UINT16_Marshal(&result, &sizeField, size));
return result;
@@ -4498,21 +4498,21 @@ TPM2B_NV_PUBLIC_Marshal(
// 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
)
{
- TPM_RC result;
- result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ TPM2_RC result;
+ result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(target->t.size == 0)
- return TPM_RC_SUCCESS;
- if((target->t.size) > sizeof(TPMS_CONTEXT_DATA))
- return TPM_RC_SIZE;
- result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size));
+ if(target->size == 0)
+ return TPM2_RC_SUCCESS;
+ if((target->size) > sizeof(TPMS_CONTEXT_DATA))
+ return TPM2_RC_SIZE;
+ result = BYTE_Array_Unmarshal((BYTE *)(target->buffer), buffer, size, (INT32)(target->size));
return result;
}
@@ -4522,30 +4522,30 @@ TPM2B_CONTEXT_DATA_Marshal(
)
{
UINT16 result = 0;
- result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size));
+ result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->size), buffer, size));
// if size equal to 0, the rest of the structure is a zero buffer. Stop processing
- if(source->t.size == 0)
+ if(source->size == 0)
return result;
- result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size)));
+ result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->buffer), buffer, size, (INT32)(source->size)));
return result;
}
// Table 2:201 - Definition of TPMS_CONTEXT Structure (StructureTable)
-TPM_RC
+TPM2_RC
TPMS_CONTEXT_Unmarshal(
TPMS_CONTEXT *target, BYTE **buffer, INT32 *size
)
{
- TPM_RC result;
+ TPM2_RC result;
result = UINT64_Unmarshal((UINT64 *)&(target->sequence), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMI_DH_CONTEXT_Unmarshal((TPMI_DH_CONTEXT *)&(target->savedHandle), buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
result = TPM2B_CONTEXT_DATA_Unmarshal((TPM2B_CONTEXT_DATA *)&(target->contextBlob), buffer, size);
return result;
@@ -4576,7 +4576,7 @@ TPMS_CREATION_DATA_Marshal(
result = (UINT16)(result + TPML_PCR_SELECTION_Marshal((TPML_PCR_SELECTION *)&(source->pcrSelect), buffer, size));
result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->pcrDigest), buffer, size));
result = (UINT16)(result + TPMA_LOCALITY_Marshal((TPMA_LOCALITY *)&(source->locality), buffer, size));
- result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM_ALG_ID *)&(source->parentNameAlg), buffer, size));
+ result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM2_ALG_ID *)&(source->parentNameAlg), buffer, size));
result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->parentName), buffer, size));
result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->parentQualifiedName), buffer, size));
result = (UINT16)(result + TPM2B_DATA_Marshal((TPM2B_DATA *)&(source->outsideInfo), buffer, size));
@@ -4596,7 +4596,7 @@ TPM2B_CREATION_DATA_Marshal(
// Advance buffer pointer by cononical size of a UINT16
*buffer += 2;
// Marshal the structure
- result = (UINT16)(result + TPMS_CREATION_DATA_Marshal((TPMS_CREATION_DATA *)&(source->t.creationData), buffer, size));
+ result = (UINT16)(result + TPMS_CREATION_DATA_Marshal((TPMS_CREATION_DATA *)&(source->creationData), buffer, size));
// Marshal the size
result = (UINT16)(result + UINT16_Marshal(&result, &sizeField, size));
return result;
@@ -4633,19 +4633,19 @@ TPMS_ALG_PROPERTY_Array_Marshal(
}
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 i;
for(i = 0; i < count; i++) {
result = TPMS_PCR_SELECTION_Unmarshal(&target[i], buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -4662,19 +4662,19 @@ TPMS_PCR_SELECTION_Array_Marshal(
}
// 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
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 i;
for(i = 0; i < count; i++) {
result = TPMT_HA_Unmarshal(&target[i], buffer, size, flag);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -4691,19 +4691,19 @@ TPMT_HA_Array_Marshal(
}
// Array Marshal/Unmarshal for BYTE
-TPM_RC
+TPM2_RC
BYTE_Array_Unmarshal(
BYTE *target, BYTE **buffer, INT32 *size, INT32 count
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 i;
for(i = 0; i < count; i++) {
result = BYTE_Unmarshal(&target[i], buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -4723,7 +4723,7 @@ BYTE_Array_Marshal(
// TPM_HANDLE_Array_Unmarshal not referenced
UINT16
TPM_HANDLE_Array_Marshal(
- TPM_HANDLE *source, BYTE **buffer, INT32 *size, INT32 count
+ TPM2_HANDLE *source, BYTE **buffer, INT32 *size, INT32 count
)
{
UINT16 result = 0;
@@ -4764,12 +4764,12 @@ TPMS_TAGGED_PCR_SELECT_Array_Marshal(
return result;
}
-// 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
+ TPM2_ECC_CURVE *source, BYTE **buffer, INT32 *size, INT32 count
)
{
UINT16 result = 0;
@@ -4780,21 +4780,21 @@ TPM_ECC_CURVE_Array_Marshal(
return result;
}
-#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
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 i;
for(i = 0; i < count; i++) {
result = TPM2B_DIGEST_Unmarshal(&target[i], buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
@@ -4810,25 +4810,25 @@ TPM2B_DIGEST_Array_Marshal(
return result;
}
-// Array Marshal/Unmarshal for TPM_CC
-TPM_RC
+// Array Marshal/Unmarshal for TPM2_CC
+TPM2_RC
TPM_CC_Array_Unmarshal(
- TPM_CC *target, BYTE **buffer, INT32 *size, INT32 count
+ TPM2_CC *target, BYTE **buffer, INT32 *size, INT32 count
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 i;
for(i = 0; i < count; i++) {
result = TPM_CC_Unmarshal(&target[i], buffer, size);
- if(result != TPM_RC_SUCCESS)
+ if(result != TPM2_RC_SUCCESS)
return result;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
TPM_CC_Array_Marshal(
- TPM_CC *source, BYTE **buffer, INT32 *size, INT32 count
+ TPM2_CC *source, BYTE **buffer, INT32 *size, INT32 count
)
{
UINT16 result = 0;
@@ -4839,32 +4839,33 @@ TPM_CC_Array_Marshal(
return result;
}
-// Array Marshal/Unmarshal for TPM_ALG_ID
-TPM_RC
+// Array Marshal/Unmarshal for TPM2_ALG_ID
+TPM2_RC
TPM_ALG_ID_Array_Unmarshal(
- TPM_ALG_ID *target, BYTE **buffer, INT32 *size, INT32 count
+ TPM2_ALG_ID *target, BYTE **buffer, INT32 *size, INT32 count
)
{
- TPM_RC result;
+ TPM2_RC result;
INT32 i;
for(i = 0; i < count; i++) {
- result = TPM_ALG_ID_Unmarshal(&target[i], buffer, size);
- if(result != TPM_RC_SUCCESS)
+ result = TPM2_ALG_ID_Unmarshal(&target[i], buffer, size);
+ if(result != TPM2_RC_SUCCESS)
return result;
}
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
UINT16
TPM_ALG_ID_Array_Marshal(
- TPM_ALG_ID *source, BYTE **buffer, INT32 *size, INT32 count
+ TPM2_ALG_ID *source, BYTE **buffer, INT32 *size, INT32 count
)
{
UINT16 result = 0;
INT32 i;
for(i = 0; i < count; i++) {
- result = (UINT16)(result + TPM_ALG_ID_Marshal(&source[i], buffer, size));
+ result = (UINT16)(result + TPM2_ALG_ID_Marshal(&source[i], buffer, size));
}
return result;
}
+
diff --git a/tpm-util/duplicate/sampleMakefile b/tpm-util/duplicate/sampleMakefile
index d3745d8..f54ee2b 100644
--- a/tpm-util/duplicate/sampleMakefile
+++ b/tpm-util/duplicate/sampleMakefile
@@ -6,8 +6,8 @@ AR = ar
LDDFLAGS += -fPIC
ARFLAGS = -rc
-TSS_DIR?=/tpm2-tss
-OPENSSL_DIR?=/usr/local/bin/openssl
+TSS_DIR?=/tpm2-tss2
+OPENSSL_DIR?=/usr/local/ssl
OUTPUT=ossl_tpm_duplicate
@@ -18,10 +18,9 @@ OBJS= util.o \
main.o
-CFLAGS += -g -fPIC -I./include -I${TSS_DIR}/include/ -I$(TSS_DIR)/sysapi/include #-I${OPENSSL_DIR}/include/
+CFLAGS += -g -fPIC -I./include -I${TSS_DIR}/include -I$(TSS_DIR)/sysapi/include -I${OPENSSL_DIR}/include
-
-LDFLAGS += -ldl -L/usr/local/lib/ -lsapi -ltcti-device -ltcti-tabrmd
+LDFLAGS += -ldl -L/usr/local/lib -L${OPENSSL_DIR}/lib -ltss2-tcti-tabrmd -ltss2-mu
LIBS = -lpthread -lcrypto -lssl
diff --git a/tpm-util/duplicate/tpm_duplication_aux.c b/tpm-util/duplicate/tpm_duplication_aux.c
index 2baf3ac..c5fa94c 100644
--- a/tpm-util/duplicate/tpm_duplication_aux.c
+++ b/tpm-util/duplicate/tpm_duplication_aux.c
@@ -55,15 +55,13 @@ void TPMT_SENSITIVE_TO_TPM2B(TPMT_SENSITIVE *source, TPM2B_SENSITIVE *target)
runner = buff;
size = sizeof(TPM2B_SENSITIVE);
TPM2B_SENSITIVE_Unmarshal(target, &runner, &size);
-
-
}
void TPM2B_SENSITIVE_TO_TPMT(TPM2B_SENSITIVE *source, TPMT_SENSITIVE *target)
{
BYTE buffer[1024], *runner = buffer;
int size = 1024;
- TPMT_SENSITIVE_Marshal(&(source->t.sensitiveArea), &runner, &size);
+ TPMT_SENSITIVE_Marshal(&(source->sensitiveArea), &runner, &size);
runner = buffer;
size = sizeof(*target);
@@ -75,7 +73,7 @@ void TPM2B_PUBLIC_TO_TPMT(TPM2B_PUBLIC *source, TPMT_PUBLIC *target)
{
BYTE buffer[1024], *runner = buffer;
int size = 1024;
- TPMT_PUBLIC_Marshal(&(source->t.publicArea), &runner, &size);
+ TPMT_PUBLIC_Marshal(&(source->publicArea), &runner, &size);
runner = buffer;
size = sizeof(*target);
@@ -84,21 +82,17 @@ void TPM2B_PUBLIC_TO_TPMT(TPM2B_PUBLIC *source, TPMT_PUBLIC *target)
}
-TPM2B_NAME * GetName(TPMI_ALG_HASH hashAlg, TPM2B_PUBLIC *obj, TPM2B_NAME *outName)
+TPM2B_NAME * GetName(TPMI_ALG_HASH hashAlg, TPM2B_PUBLIC *obj)
{
int size_in =1024;
BYTE buff[1024] = {0};
BYTE* runner = buff;
UINT16 toHashSize = TPM2B_PUBLIC_Marshal(obj, &runner, &size_in) ;
-
- runner = outName->b.buffer;
size_in = 2;
- outName->b.size = TPM_ALG_ID_Marshal(&hashAlg, &runner , &size_in) + 32;
+ size = TPM2_ALG_ID_Marshal(&hashAlg, &runner , &size_in) + 32;
SHA256(buff+2, toHashSize-2, runner);
-
- return outName;
}
@@ -107,8 +101,8 @@ void CreateDuplicationBlob2B(
TPM2B_PUBLIC_KEY_RSA *protector,
TPM2B_PUBLIC * public2B,
TPM2B_SENSITIVE *sens2B,
- 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,
@@ -147,8 +141,8 @@ void CreateDuplicationBlob(
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,
@@ -156,33 +150,32 @@ void CreateDuplicationBlob(
{
memset((void*)outDuplicate, 0, sizeof(TPM2B_PRIVATE));
memset((void*)encSymSeed, 0, sizeof(TPM2B_ENCRYPTED_SECRET));
- TPM2B_SYM_KEY outerWrapper;
+ TPM2B outerWrapper;
TPM2B NULL_2B = {0};
- TPM2B_NAME swkName = {{0}};
-
+ TPM2B swkName = {0};
- TPM2B_PUBLIC public2B = {{0}};
- TPM2B_SENSITIVE sens2B = {{0}};
+ TPM2B_PUBLIC public2B = {0};
+ TPM2B_SENSITIVE sens2B = {0};
INT32 size_in = 0;
- TPM2B_MAX_BUFFER encSensitive = {{0}};
+ TPM2B encSensitive = {0};
if(generateInSymSeed)
{
- RAND_bytes(plainSymSeed->b.buffer, 16);
- plainSymSeed->b.size = 16;
+ RAND_bytes(plainSymSeed->buffer, 16);
+ plainSymSeed->size = 16;
}
if(generateEncryptionKey)
{
- RAND_bytes(encryptionKey->b.buffer, 16);
- encryptionKey->b.size = 16;
+ RAND_bytes(encryptionKey.buffer, 16);
+ encryptionKey.size = 16;
}
// Preparing marshaled publicPortion:
TPMT_PUBLIC_TO_TPM2B(publicPortion, &public2B);
// calculating name:
- GetName(TPM_ALG_SHA256, &(public2B), &swkName);
+ GetName(TPM2_ALG_SHA256, &(public2B));
// preparing marshaled sensitive:
TPMT_SENSITIVE_TO_TPM2B(sens, &sens2B);
@@ -190,19 +183,19 @@ void CreateDuplicationBlob(
//preparing encSensitive
{
UINT16 tempUint16;
- TPM2B_SYM_KEY IV = {0};
- IV.b.size = 16;
- TPM2B_MAX_BUFFER innerData = {0};
+ TPM2B IV = {0};
+ IV.size = 16;
+ TPM2B innerData = {0};
BYTE innerIntegrity[34] = {0}, toHash[1024] = {0};
size_in = 1024;
BYTE* runner = toHash;
- UINT16_Marshal(&(sens2B.b.size), &runner, &size_in);
+ UINT16_Marshal(&(sens2B.size), &runner, &size_in);
TPMT_SENSITIVE_Marshal(sens, &runner, &size_in);
- memcpy(runner, swkName.b.buffer, swkName.b.size );
- runner += swkName.b.size;
+ memcpy(runner, swkName.buffer, swkName.size );
+ runner += swkName.size;
SHA256(toHash, runner - toHash, innerIntegrity+2);
@@ -210,59 +203,59 @@ void CreateDuplicationBlob(
tempUint16 = 32;
UINT16_Marshal(&tempUint16, &runner, &size_in);
- memcpy(innerData.b.buffer, innerIntegrity, 34);
- runner = innerData.b.buffer + 34;
+ memcpy(innerData.buffer, innerIntegrity, 34);
+ runner = innerData.buffer + 34;
size_in = 1024;
- UINT16_Marshal(&(sens2B.b.size), &runner, &size_in);
+ UINT16_Marshal(&(sens2B.size), &runner, &size_in);
TPMT_SENSITIVE_Marshal(sens, &runner, &size_in);
- innerData.b.size = sens2B.b.size + 36;
+ innerData.size = sens2B.size + 36;
- AES_128_CFB_enc_dec(&(innerData.b), &(encSensitive.b), &(encryptionKey->b), &(IV.b), NULL, 1);
+ AES_128_CFB_enc_dec(&(innerData), &(encSensitive), &(encryptionKey), &(IV), NULL, 1);
}
// outer integrity
{
- TPM2B_SYM_KEY IV = {{0}};
- TPM2B_DIGEST hmacKey = {{0}};
- TPM2B_DIGEST outerHmac = {{0}};
- TPM2B_MAX_BUFFER dupSensitive = {{0}};
- TPM2B_MAX_BUFFER dataToHmac = {{0}};
+ const TPM2B IV;
+ TPM2B_DIGEST hmacKey = {0};
+ TPM2B_DIGEST outerHmac = {0};
+ TPM2B dupSensitive = {0};
+ TPM2B_MAX_BUFFER dataToHmac = {0};
BYTE * runner = NULL;
- IV.b.size = 16;
+ //IV.size = 16;
- KDFa(TPM_ALG_SHA256, &(plainSymSeed->b), "STORAGE", &(swkName.b), &NULL_2B, 128 , (TPM2B_MAX_BUFFER*) &outerWrapper);
+ KDFa(TPM2_ALG_SHA256, (plainSymSeed), "STORAGE", &(swkName), &NULL_2B, 128 , (TPM2B_MAX_BUFFER*) &outerWrapper);
- AES_128_CFB_enc_dec(&(encSensitive.b), &(dupSensitive.b), &(outerWrapper.b), &(IV.b), NULL, 1);
+ AES_128_CFB_enc_dec(&(encSensitive), &(dupSensitive), &(outerWrapper), &(IV), NULL, 1);
- KDFa(TPM_ALG_SHA256, &(plainSymSeed->b), "INTEGRITY", &NULL_2B, &NULL_2B, 32*8,(TPM2B_MAX_BUFFER*) &(hmacKey.b));
+ KDFa(TPM2_ALG_SHA256, (plainSymSeed), "INTEGRITY", &NULL_2B, &NULL_2B, 32*8,(TPM2B_MAX_BUFFER*) &(hmacKey));
- memcpy(dataToHmac.b.buffer, dupSensitive.b.buffer, dupSensitive.b.size);
- memcpy(dataToHmac.b.buffer + dupSensitive.b.size, swkName.b.buffer, swkName.b.size);
- dataToHmac.b.size = dupSensitive.b.size + swkName.b.size;
+ memcpy(dataToHmac.buffer, dupSensitive.buffer, dupSensitive.size);
+ memcpy(dataToHmac.buffer + dupSensitive.size, swkName.buffer, swkName.size);
+ dataToHmac.size = dupSensitive.size + swkName.size;
- HMAC(EVP_sha256(), hmacKey.b.buffer, hmacKey.b.size, dataToHmac.b.buffer, dataToHmac.b.size,
- outerHmac.b.buffer, (UINT32*) &size_in);
+ HMAC(EVP_sha256(), hmacKey.buffer, hmacKey.size, dataToHmac.buffer, dataToHmac.size,
+ outerHmac.buffer, (UINT32*) &size_in);
- outerHmac.b.size = size_in;
+ outerHmac.size = size_in;
- runner = outDuplicate->b.buffer;
+ runner = outDuplicate->buffer;
size_in = sizeof(*outDuplicate) - 2;
- outDuplicate->b.size = TPM2B_DIGEST_Marshal(&outerHmac, &runner, &size_in);
+ outDuplicate->size = TPM2B_DIGEST_Marshal(&outerHmac, &runner, &size_in);
- memcpy(runner, dupSensitive.b.buffer, dupSensitive.b.size);
- outDuplicate->b.size += dupSensitive.b.size;
+ memcpy(runner, dupSensitive.buffer, dupSensitive.size);
+ outDuplicate->size += dupSensitive.size;
}
// Encrypting seed with RSA pub:
- TPM2B_DATA encodingParams = {{0}};
- encodingParams.b.size = 10;
- memcpy(encodingParams.b.buffer, "DUPLICATE", 10);
+ TPM2B_DATA encodingParams = {0};
+ encodingParams.size = 10;
+ memcpy(encodingParams.buffer, "DUPLICATE", 10);
RSA_OAEP_Enc((TPM2B_PUBLIC_KEY_RSA*)plainSymSeed, (TPM2B_PUBLIC_KEY_RSA*)encSymSeed, protector, &encodingParams);
@@ -386,31 +379,30 @@ void CreateSwDataObject(
);
/* Fill TPM Sensitive data */
- outSens->sensitiveType = TPM_ALG_RSA;
+ outSens->sensitiveType = TPM2_ALG_RSA;
- outSens->authValue.b.size = authSize;
- memcpy(outSens->authValue.b.buffer, auth, authSize);
+ outSens->authValue.size = authSize;
+ memcpy(outSens->authValue.buffer, auth, authSize);
- outSens->seedValue.b.size = 32;
- memcpy(outSens->seedValue.b.buffer, seed, 32);
+ outSens->seedValue.size = 32;
+ memcpy(outSens->seedValue.buffer, seed, 32);
- outSens->sensitive.bits.b.size = p_size;
- memcpy(outSens->sensitive.bits.b.buffer, p_bytes, p_size);
+ outSens->sensitive.bits.size = p_size;
+ memcpy(outSens->sensitive.bits.buffer, p_bytes, p_size);
/* Fill TPM Public portion */
- outPublic->type = TPM_ALG_RSA;
- outPublic->nameAlg = TPM_ALG_SHA256;
- outPublic->objectAttributes.val = 0;
+ outPublic->type = TPM2_ALG_RSA;
+ outPublic->nameAlg = TPM2_ALG_SHA256;
+ outPublic->objectAttributes = 0;
//outPublic->objectAttributes.val |= TPMA_OBJECT_RESTRICTED;
- outPublic->objectAttributes.val |= TPMA_OBJECT_USERWITHAUTH;
- outPublic->objectAttributes.val |= TPMA_OBJECT_SIGN;
- outPublic->authPolicy.t.size = 0;
+ outPublic->objectAttributes |= TPMA_OBJECT_USERWITHAUTH;
+ outPublic->objectAttributes |= TPMA_OBJECT_SIGN_ENCRYPT;
+ outPublic->authPolicy.size = 0;
/* Table 182 - Definition of TPMU_PUBLIC_PARMS Union <IN/OUT, S> */
- outPublic->parameters.rsaDetail.symmetric.algorithm = TPM_ALG_NULL;
- outPublic->parameters.rsaDetail.scheme.scheme = TPM_ALG_NULL;
+ outPublic->parameters.rsaDetail.symmetric.algorithm = TPM2_ALG_NULL;
+ outPublic->parameters.rsaDetail.scheme.scheme = TPM2_ALG_NULL;
//outPublic->parameters.rsaDetail.scheme.details.rsassa.hashAlg = TPM_ALG_SHA256;
-
outPublic->parameters.rsaDetail.keyBits = BYTES_TO_BITS(n_size);;
printf("outPublic->parameters.rsaDetail.keyBits: %d \n", outPublic->parameters.rsaDetail.keyBits);
@@ -419,54 +411,53 @@ void CreateSwDataObject(
outPublic->parameters.rsaDetail.exponent = tmp_val;
printf("outPublic->parameters.rsaDetail.exponent: 0x%x \n", outPublic->parameters.rsaDetail.exponent);
- outPublic->unique.rsa.t.size = n_size;
- memcpy(outPublic->unique.rsa.t.buffer, n_bytes, n_size);
- printf("outPublic->unique.rsa.t.size: %d \n", outPublic->unique.rsa.t.size);
+ outPublic->unique.rsa.size = n_size;
+ memcpy(outPublic->unique.rsa.buffer, n_bytes, n_size);
+ printf("outPublic->unique.rsa.size: %d \n", outPublic->unique.rsa.size);
if(( policyDigestSize > 0) && (policyDigest != NULL) )
{
- memcpy(outPublic->authPolicy.b.buffer, policyDigest, policyDigestSize);
- outPublic->authPolicy.b.size = policyDigestSize;
+ memcpy(outPublic->authPolicy.buffer, policyDigest, policyDigestSize);
+ outPublic->authPolicy.size = policyDigestSize;
}
}
-
else if( (dataToSeal != NULL) && (dataSize > 0) )
{
/* Symmetric Key Creation */
- outSens->authValue.b.size = authSize;
- memcpy(outSens->authValue.b.buffer, auth, authSize);
+ outSens->authValue.size = authSize;
+ memcpy(outSens->authValue.buffer, auth, authSize);
- outSens->seedValue.b.size = 32;
- memcpy(outSens->seedValue.b.buffer, seed, 32);
+ outSens->seedValue.size = 32;
+ memcpy(outSens->seedValue.buffer, seed, 32);
- outSens->sensitive.bits.b.size = dataSize;
- memcpy(outSens->sensitive.bits.b.buffer, dataToSeal, dataSize);
+ outSens->sensitive.bits.size = dataSize;
+ memcpy(outSens->sensitive.bits.buffer, dataToSeal, dataSize);
- outSens->sensitiveType = TPM_ALG_KEYEDHASH;
+ outSens->sensitiveType = TPM2_ALG_KEYEDHASH;
- outPublic->objectAttributes.val = 0;
- outPublic->objectAttributes.adminWithPolicy = 1;
- outPublic->nameAlg = TPM_ALG_SHA256;
- memcpy(outPublic->unique.keyedHash.b.buffer, dataToSeal, dataSize);
- outPublic->unique.keyedHash.b.size = dataSize;
+ outPublic->objectAttributes = 0;
+ outPublic->objectAttributes = 1;
+ outPublic->nameAlg = TPM2_ALG_SHA256;
+ memcpy(outPublic->unique.keyedHash.buffer, dataToSeal, dataSize);
+ outPublic->unique.keyedHash.size = dataSize;
if(( policyDigestSize > 0) && (policyDigest != NULL) )
{
- memcpy(outPublic->authPolicy.b.buffer, policyDigest, policyDigestSize);
- outPublic->authPolicy.b.size = policyDigestSize;
+ memcpy(outPublic->authPolicy.buffer, policyDigest, policyDigestSize);
+ outPublic->authPolicy.size = policyDigestSize;
}
- outPublic->type = TPM_ALG_KEYEDHASH;
- outPublic->nameAlg = TPM_ALG_SHA256;
+ outPublic->type = TPM2_ALG_KEYEDHASH;
+ outPublic->nameAlg = TPM2_ALG_SHA256;
- outPublic->parameters.keyedHashDetail.scheme.scheme = TPM_ALG_NULL;
- outPublic->parameters.keyedHashDetail.scheme.details.hmac.hashAlg = TPM_ALG_NULL;
+ outPublic->parameters.keyedHashDetail.scheme.scheme = TPM2_ALG_NULL;
+ outPublic->parameters.keyedHashDetail.scheme.details.hmac.hashAlg = TPM2_ALG_NULL;
- memcpy(hash_buffer.b.buffer, seed, 32);
- memcpy(hash_buffer.b.buffer+32, dataToSeal, dataSize);
- SHA256(hash_buffer.b.buffer, 32+dataSize, outPublic->unique.keyedHash.b.buffer);
- outPublic->unique.keyedHash.b.size = 32;
+ memcpy(hash_buffer.buffer, seed, 32);
+ memcpy(hash_buffer.buffer+32, dataToSeal, dataSize);
+ SHA256(hash_buffer.buffer, 32+dataSize, outPublic->unique.keyedHash.buffer);
+ outPublic->unique.keyedHash.size = 32;
}
}
@@ -475,31 +466,31 @@ void CreateSwDataObject(
TSS2_RC swKeyDuplicate(
/* IN */
RSA* rsaKey, TPM2B_PUBLIC* parentKeyPublicPortion, UINT8* policyDigest, int digestSize,
- /* OUT */
- TPM2B_DATA* encryptionKey, TPM2B_PUBLIC *swKeyPublic, TPM2B_PRIVATE *swKeyPrivate, TPM2B_ENCRYPTED_SECRET *encSymSeed)
+ /* OUT */
+ TPM2B* encryptionKey, TPM2B_PUBLIC *swKeyPublic, TPM2B_PRIVATE *swKeyPrivate, TPM2B_ENCRYPTED_SECRET *encSymSeed)
{
- TPM_RC rval = TPM_RC_SUCCESS;
+ TPM2_RC rval = TPM2_RC_SUCCESS;
UINT8 auth[0];
TPM2B_SENSITIVE swKeySens;
- TPM2B_ENCRYPTED_SECRET plainSymSeed = {{0}};
- TPM2B_PUBLIC_KEY_RSA protectorRsaPub = {{0}};
+ TPM2B plainSymSeed = {0};
+ TPM2B_PUBLIC_KEY_RSA protectorRsaPub = {0};
INIT_SIMPLE_TPM2B_SIZE(swKeySens);
INIT_SIMPLE_TPM2B_SIZE(*swKeyPublic);
// Fill the protector data
- memcpy(protectorRsaPub.b.buffer, parentKeyPublicPortion->t.publicArea.unique.rsa.t.buffer, parentKeyPublicPortion->t.publicArea.unique.rsa.t.size);
- protectorRsaPub.b.size = parentKeyPublicPortion->t.publicArea.unique.rsa.t.size;
+ memcpy(protectorRsaPub.buffer, parentKeyPublicPortion->publicArea.unique.rsa.buffer, parentKeyPublicPortion->publicArea.unique.rsa.size);
+ protectorRsaPub.size = parentKeyPublicPortion->publicArea.unique.rsa.size;
// Fill Symmetric seed
- plainSymSeed.b.size = encryptionKey->b.size = 16;
- encSymSeed->b.size = 16;
+ plainSymSeed.size = encryptionKey->size = 16;
+ encSymSeed->size = 16;
// Create SW Data Object Public and Sensitive portions
CreateSwDataObject2B(auth, 0, rsaKey, policyDigest, digestSize, swKeyPublic, &swKeySens);
// Create Duplication blob needed for Import
- CreateDuplicationBlob2B( &protectorRsaPub, swKeyPublic, &swKeySens, &plainSymSeed, 0, encryptionKey, 1, swKeyPrivate, encSymSeed);
+ CreateDuplicationBlob2B( &protectorRsaPub, swKeyPublic, &swKeySens, &plainSymSeed, 0, *encryptionKey, 1, swKeyPrivate, encSymSeed);
return rval;
}
diff --git a/tpm-util/duplicate/util.c b/tpm-util/duplicate/util.c
index 6d5337f..af2d1c1 100644
--- a/tpm-util/duplicate/util.c
+++ b/tpm-util/duplicate/util.c
@@ -17,20 +17,20 @@
#include "util.h"
-TPM_RC ConcatSizedByteBuffer( TPM2B_MAX_BUFFER *result, TPM2B *addBuffer )
+TPM2_RC ConcatSizedByteBuffer( TPM2B_MAX_BUFFER *result, TPM2B *addBuffer )
{
int i;
- if( ( result->t.size + addBuffer->size ) > MAX_DIGEST_BUFFER )
+ if( ( result->size + addBuffer->size ) > TPM2_MAX_DIGEST_BUFFER )
return TSS2_SYS_RC_BAD_VALUE;
else
{
for( i = 0; i < addBuffer->size; i++ )
- result->t.buffer[i + result->t.size] = addBuffer->buffer[i];
+ result->buffer[i + result->size] = addBuffer->buffer[i];
- result->t.size += addBuffer->size;
+ result->size += addBuffer->size;
- return TPM_RC_SUCCESS;
+ return TPM2_RC_SUCCESS;
}
}
@@ -93,5 +93,3 @@ int loadDataFromFile(const char *fileName, UINT8 *buf, UINT16 *size)
fclose(f);
return 0;
}
-
-