iPXE
Tpm20.h
Go to the documentation of this file.
00001 /** @file
00002   TPM2.0 Specification data structures
00003   (Trusted Platform Module Library Specification, Family "2.0", Level 00, Revision 00.96,
00004   @http://www.trustedcomputinggroup.org/resources/tpm_library_specification)
00005 
00006   Check http://trustedcomputinggroup.org for latest specification updates.
00007 
00008 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved. <BR>
00009 This program and the accompanying materials
00010 are licensed and made available under the terms and conditions of the BSD License
00011 which accompanies this distribution.  The full text of the license may be found at
00012 http://opensource.org/licenses/bsd-license.php
00013 
00014 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00015 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00016 
00017 **/
00018 
00019 
00020 #ifndef _TPM20_H_
00021 #define _TPM20_H_
00022 
00023 FILE_LICENCE ( BSD3 );
00024 
00025 #include <ipxe/efi/IndustryStandard/Tpm12.h>
00026 
00027 #pragma pack (1)
00028 
00029 // Annex A Algorithm Constants
00030 
00031 // Table 205 - Defines for SHA1 Hash Values
00032 #define SHA1_DIGEST_SIZE 20
00033 #define SHA1_BLOCK_SIZE  64
00034 
00035 // Table 206 - Defines for SHA256 Hash Values
00036 #define SHA256_DIGEST_SIZE 32
00037 #define SHA256_BLOCK_SIZE  64
00038 
00039 // Table 207 - Defines for SHA384 Hash Values
00040 #define SHA384_DIGEST_SIZE 48
00041 #define SHA384_BLOCK_SIZE  128
00042 
00043 // Table 208 - Defines for SHA512 Hash Values
00044 #define SHA512_DIGEST_SIZE 64
00045 #define SHA512_BLOCK_SIZE  128
00046 
00047 // Table 209 - Defines for SM3_256 Hash Values
00048 #define SM3_256_DIGEST_SIZE 32
00049 #define SM3_256_BLOCK_SIZE  64
00050 
00051 // Table 210 - Defines for Architectural Limits Values
00052 #define MAX_SESSION_NUMBER 3
00053 
00054 // Annex B Implementation Definitions
00055 
00056 // Table 211 - Defines for Logic Values
00057 #define YES   1
00058 #define NO    0
00059 #define SET   1
00060 #define CLEAR 0
00061 
00062 // Table 215 - Defines for RSA Algorithm Constants
00063 #define MAX_RSA_KEY_BITS  2048
00064 #define MAX_RSA_KEY_BYTES ((MAX_RSA_KEY_BITS + 7) / 8)
00065 
00066 // Table 216 - Defines for ECC Algorithm Constants
00067 #define MAX_ECC_KEY_BITS  256
00068 #define MAX_ECC_KEY_BYTES ((MAX_ECC_KEY_BITS + 7) / 8)
00069 
00070 // Table 217 - Defines for AES Algorithm Constants
00071 #define MAX_AES_KEY_BITS         128
00072 #define MAX_AES_BLOCK_SIZE_BYTES 16
00073 #define MAX_AES_KEY_BYTES        ((MAX_AES_KEY_BITS + 7) / 8)
00074 
00075 // Table 218 - Defines for SM4 Algorithm Constants
00076 #define MAX_SM4_KEY_BITS         128
00077 #define MAX_SM4_BLOCK_SIZE_BYTES 16
00078 #define MAX_SM4_KEY_BYTES        ((MAX_SM4_KEY_BITS + 7) / 8)
00079 
00080 // Table 219 - Defines for Symmetric Algorithm Constants
00081 #define MAX_SYM_KEY_BITS   MAX_AES_KEY_BITS
00082 #define MAX_SYM_KEY_BYTES  MAX_AES_KEY_BYTES
00083 #define MAX_SYM_BLOCK_SIZE MAX_AES_BLOCK_SIZE_BYTES
00084 
00085 // Table 220 - Defines for Implementation Values
00086 typedef UINT16                        BSIZE;
00087 #define BUFFER_ALIGNMENT              4
00088 #define IMPLEMENTATION_PCR            24
00089 #define PLATFORM_PCR                  24
00090 #define DRTM_PCR                      17
00091 #define NUM_LOCALITIES                5
00092 #define MAX_HANDLE_NUM                3
00093 #define MAX_ACTIVE_SESSIONS           64
00094 typedef UINT16                        CONTEXT_SLOT;
00095 typedef UINT64                        CONTEXT_COUNTER;
00096 #define MAX_LOADED_SESSIONS           3
00097 #define MAX_SESSION_NUM               3
00098 #define MAX_LOADED_OBJECTS            3
00099 #define MIN_EVICT_OBJECTS             2
00100 #define PCR_SELECT_MIN                ((PLATFORM_PCR + 7) / 8)
00101 #define PCR_SELECT_MAX                ((IMPLEMENTATION_PCR + 7) / 8)
00102 #define NUM_POLICY_PCR_GROUP          1
00103 #define NUM_AUTHVALUE_PCR_GROUP       1
00104 #define MAX_CONTEXT_SIZE              4000
00105 #define MAX_DIGEST_BUFFER             1024
00106 #define MAX_NV_INDEX_SIZE             1024
00107 #define MAX_CAP_BUFFER                1024
00108 #define NV_MEMORY_SIZE                16384
00109 #define NUM_STATIC_PCR                16
00110 #define MAX_ALG_LIST_SIZE             64
00111 #define TIMER_PRESCALE                100000
00112 #define PRIMARY_SEED_SIZE             32
00113 #define CONTEXT_ENCRYPT_ALG           TPM_ALG_AES
00114 #define CONTEXT_ENCRYPT_KEY_BITS      MAX_SYM_KEY_BITS
00115 #define CONTEXT_ENCRYPT_KEY_BYTES     ((CONTEXT_ENCRYPT_KEY_BITS + 7) / 8)
00116 #define CONTEXT_INTEGRITY_HASH_ALG    TPM_ALG_SHA256
00117 #define CONTEXT_INTEGRITY_HASH_SIZE   SHA256_DIGEST_SIZE
00118 #define PROOF_SIZE                    CONTEXT_INTEGRITY_HASH_SIZE
00119 #define NV_CLOCK_UPDATE_INTERVAL      12
00120 #define NUM_POLICY_PCR                1
00121 #define MAX_COMMAND_SIZE              4096
00122 #define MAX_RESPONSE_SIZE             4096
00123 #define ORDERLY_BITS                  8
00124 #define MAX_ORDERLY_COUNT             ((1 << ORDERLY_BITS) - 1)
00125 #define ALG_ID_FIRST                  TPM_ALG_FIRST
00126 #define ALG_ID_LAST                   TPM_ALG_LAST
00127 #define MAX_SYM_DATA                  128
00128 #define MAX_RNG_ENTROPY_SIZE          64
00129 #define RAM_INDEX_SPACE               512
00130 #define RSA_DEFAULT_PUBLIC_EXPONENT   0x00010001
00131 #define CRT_FORMAT_RSA                YES
00132 #define PRIVATE_VENDOR_SPECIFIC_BYTES ((MAX_RSA_KEY_BYTES / 2) * ( 3 + CRT_FORMAT_RSA * 2))
00133 
00134 // Capability related MAX_ value
00135 #define MAX_CAP_DATA       (MAX_CAP_BUFFER - sizeof(TPM_CAP) - sizeof(UINT32))
00136 #define MAX_CAP_ALGS       (MAX_CAP_DATA / sizeof(TPMS_ALG_PROPERTY))
00137 #define MAX_CAP_HANDLES    (MAX_CAP_DATA / sizeof(TPM_HANDLE))
00138 #define MAX_CAP_CC         (MAX_CAP_DATA / sizeof(TPM_CC))
00139 #define MAX_TPM_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PROPERTY))
00140 #define MAX_PCR_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PCR_SELECT))
00141 #define MAX_ECC_CURVES     (MAX_CAP_DATA / sizeof(TPM_ECC_CURVE))
00142 
00143 //
00144 // Always set 5 here, because we want to support all hash algo in BIOS.
00145 //
00146 #define HASH_COUNT 5
00147 
00148 // 5 Base Types
00149 
00150 // Table 3 - Definition of Base Types
00151 typedef UINT8 BYTE;
00152 
00153 // Table 4 - Definition of Types for Documentation Clarity
00154 //
00155 // NOTE: Comment because it has same name as TPM1.2 (value is same, so not runtime issue)
00156 //
00157 //typedef UINT32 TPM_ALGORITHM_ID;
00158 //typedef UINT32 TPM_MODIFIER_INDICATOR;
00159 typedef UINT32 TPM_AUTHORIZATION_SIZE;
00160 typedef UINT32 TPM_PARAMETER_SIZE;
00161 typedef UINT16 TPM_KEY_SIZE;
00162 typedef UINT16 TPM_KEY_BITS;
00163 
00164 // 6 Constants
00165 
00166 // Table 6 - TPM_GENERATED Constants
00167 typedef UINT32 TPM_GENERATED;
00168 #define TPM_GENERATED_VALUE (TPM_GENERATED)(0xff544347)
00169 
00170 // Table 7 - TPM_ALG_ID Constants
00171 typedef UINT16 TPM_ALG_ID;
00172 //
00173 // NOTE: Comment some algo which has same name as TPM1.2 (value is same, so not runtime issue)
00174 //
00175 #define TPM_ALG_ERROR          (TPM_ALG_ID)(0x0000)
00176 #define TPM_ALG_FIRST          (TPM_ALG_ID)(0x0001)
00177 //#define TPM_ALG_RSA            (TPM_ALG_ID)(0x0001)
00178 //#define TPM_ALG_SHA            (TPM_ALG_ID)(0x0004)
00179 #define TPM_ALG_SHA1           (TPM_ALG_ID)(0x0004)
00180 //#define TPM_ALG_HMAC           (TPM_ALG_ID)(0x0005)
00181 #define TPM_ALG_AES            (TPM_ALG_ID)(0x0006)
00182 //#define TPM_ALG_MGF1           (TPM_ALG_ID)(0x0007)
00183 #define TPM_ALG_KEYEDHASH      (TPM_ALG_ID)(0x0008)
00184 //#define TPM_ALG_XOR            (TPM_ALG_ID)(0x000A)
00185 #define TPM_ALG_SHA256         (TPM_ALG_ID)(0x000B)
00186 #define TPM_ALG_SHA384         (TPM_ALG_ID)(0x000C)
00187 #define TPM_ALG_SHA512         (TPM_ALG_ID)(0x000D)
00188 #define TPM_ALG_NULL           (TPM_ALG_ID)(0x0010)
00189 #define TPM_ALG_SM3_256        (TPM_ALG_ID)(0x0012)
00190 #define TPM_ALG_SM4            (TPM_ALG_ID)(0x0013)
00191 #define TPM_ALG_RSASSA         (TPM_ALG_ID)(0x0014)
00192 #define TPM_ALG_RSAES          (TPM_ALG_ID)(0x0015)
00193 #define TPM_ALG_RSAPSS         (TPM_ALG_ID)(0x0016)
00194 #define TPM_ALG_OAEP           (TPM_ALG_ID)(0x0017)
00195 #define TPM_ALG_ECDSA          (TPM_ALG_ID)(0x0018)
00196 #define TPM_ALG_ECDH           (TPM_ALG_ID)(0x0019)
00197 #define TPM_ALG_ECDAA          (TPM_ALG_ID)(0x001A)
00198 #define TPM_ALG_SM2            (TPM_ALG_ID)(0x001B)
00199 #define TPM_ALG_ECSCHNORR      (TPM_ALG_ID)(0x001C)
00200 #define TPM_ALG_ECMQV          (TPM_ALG_ID)(0x001D)
00201 #define TPM_ALG_KDF1_SP800_56a (TPM_ALG_ID)(0x0020)
00202 #define TPM_ALG_KDF2           (TPM_ALG_ID)(0x0021)
00203 #define TPM_ALG_KDF1_SP800_108 (TPM_ALG_ID)(0x0022)
00204 #define TPM_ALG_ECC            (TPM_ALG_ID)(0x0023)
00205 #define TPM_ALG_SYMCIPHER      (TPM_ALG_ID)(0x0025)
00206 #define TPM_ALG_CTR            (TPM_ALG_ID)(0x0040)
00207 #define TPM_ALG_OFB            (TPM_ALG_ID)(0x0041)
00208 #define TPM_ALG_CBC            (TPM_ALG_ID)(0x0042)
00209 #define TPM_ALG_CFB            (TPM_ALG_ID)(0x0043)
00210 #define TPM_ALG_ECB            (TPM_ALG_ID)(0x0044)
00211 #define TPM_ALG_LAST           (TPM_ALG_ID)(0x0044)
00212 
00213 // Table 8 - TPM_ECC_CURVE Constants
00214 typedef UINT16 TPM_ECC_CURVE;
00215 #define TPM_ECC_NONE      (TPM_ECC_CURVE)(0x0000)
00216 #define TPM_ECC_NIST_P192 (TPM_ECC_CURVE)(0x0001)
00217 #define TPM_ECC_NIST_P224 (TPM_ECC_CURVE)(0x0002)
00218 #define TPM_ECC_NIST_P256 (TPM_ECC_CURVE)(0x0003)
00219 #define TPM_ECC_NIST_P384 (TPM_ECC_CURVE)(0x0004)
00220 #define TPM_ECC_NIST_P521 (TPM_ECC_CURVE)(0x0005)
00221 #define TPM_ECC_BN_P256   (TPM_ECC_CURVE)(0x0010)
00222 #define TPM_ECC_BN_P638   (TPM_ECC_CURVE)(0x0011)
00223 #define TPM_ECC_SM2_P256  (TPM_ECC_CURVE)(0x0020)
00224 
00225 // Table 11 - TPM_CC Constants (Numeric Order)
00226 typedef UINT32 TPM_CC;
00227 #define TPM_CC_FIRST                      (TPM_CC)(0x0000011F)
00228 #define TPM_CC_PP_FIRST                   (TPM_CC)(0x0000011F)
00229 #define TPM_CC_NV_UndefineSpaceSpecial    (TPM_CC)(0x0000011F)
00230 #define TPM_CC_EvictControl               (TPM_CC)(0x00000120)
00231 #define TPM_CC_HierarchyControl           (TPM_CC)(0x00000121)
00232 #define TPM_CC_NV_UndefineSpace           (TPM_CC)(0x00000122)
00233 #define TPM_CC_ChangeEPS                  (TPM_CC)(0x00000124)
00234 #define TPM_CC_ChangePPS                  (TPM_CC)(0x00000125)
00235 #define TPM_CC_Clear                      (TPM_CC)(0x00000126)
00236 #define TPM_CC_ClearControl               (TPM_CC)(0x00000127)
00237 #define TPM_CC_ClockSet                   (TPM_CC)(0x00000128)
00238 #define TPM_CC_HierarchyChangeAuth        (TPM_CC)(0x00000129)
00239 #define TPM_CC_NV_DefineSpace             (TPM_CC)(0x0000012A)
00240 #define TPM_CC_PCR_Allocate               (TPM_CC)(0x0000012B)
00241 #define TPM_CC_PCR_SetAuthPolicy          (TPM_CC)(0x0000012C)
00242 #define TPM_CC_PP_Commands                (TPM_CC)(0x0000012D)
00243 #define TPM_CC_SetPrimaryPolicy           (TPM_CC)(0x0000012E)
00244 #define TPM_CC_FieldUpgradeStart          (TPM_CC)(0x0000012F)
00245 #define TPM_CC_ClockRateAdjust            (TPM_CC)(0x00000130)
00246 #define TPM_CC_CreatePrimary              (TPM_CC)(0x00000131)
00247 #define TPM_CC_NV_GlobalWriteLock         (TPM_CC)(0x00000132)
00248 #define TPM_CC_PP_LAST                    (TPM_CC)(0x00000132)
00249 #define TPM_CC_GetCommandAuditDigest      (TPM_CC)(0x00000133)
00250 #define TPM_CC_NV_Increment               (TPM_CC)(0x00000134)
00251 #define TPM_CC_NV_SetBits                 (TPM_CC)(0x00000135)
00252 #define TPM_CC_NV_Extend                  (TPM_CC)(0x00000136)
00253 #define TPM_CC_NV_Write                   (TPM_CC)(0x00000137)
00254 #define TPM_CC_NV_WriteLock               (TPM_CC)(0x00000138)
00255 #define TPM_CC_DictionaryAttackLockReset  (TPM_CC)(0x00000139)
00256 #define TPM_CC_DictionaryAttackParameters (TPM_CC)(0x0000013A)
00257 #define TPM_CC_NV_ChangeAuth              (TPM_CC)(0x0000013B)
00258 #define TPM_CC_PCR_Event                  (TPM_CC)(0x0000013C)
00259 #define TPM_CC_PCR_Reset                  (TPM_CC)(0x0000013D)
00260 #define TPM_CC_SequenceComplete           (TPM_CC)(0x0000013E)
00261 #define TPM_CC_SetAlgorithmSet            (TPM_CC)(0x0000013F)
00262 #define TPM_CC_SetCommandCodeAuditStatus  (TPM_CC)(0x00000140)
00263 #define TPM_CC_FieldUpgradeData           (TPM_CC)(0x00000141)
00264 #define TPM_CC_IncrementalSelfTest        (TPM_CC)(0x00000142)
00265 #define TPM_CC_SelfTest                   (TPM_CC)(0x00000143)
00266 #define TPM_CC_Startup                    (TPM_CC)(0x00000144)
00267 #define TPM_CC_Shutdown                   (TPM_CC)(0x00000145)
00268 #define TPM_CC_StirRandom                 (TPM_CC)(0x00000146)
00269 #define TPM_CC_ActivateCredential         (TPM_CC)(0x00000147)
00270 #define TPM_CC_Certify                    (TPM_CC)(0x00000148)
00271 #define TPM_CC_PolicyNV                   (TPM_CC)(0x00000149)
00272 #define TPM_CC_CertifyCreation            (TPM_CC)(0x0000014A)
00273 #define TPM_CC_Duplicate                  (TPM_CC)(0x0000014B)
00274 #define TPM_CC_GetTime                    (TPM_CC)(0x0000014C)
00275 #define TPM_CC_GetSessionAuditDigest      (TPM_CC)(0x0000014D)
00276 #define TPM_CC_NV_Read                    (TPM_CC)(0x0000014E)
00277 #define TPM_CC_NV_ReadLock                (TPM_CC)(0x0000014F)
00278 #define TPM_CC_ObjectChangeAuth           (TPM_CC)(0x00000150)
00279 #define TPM_CC_PolicySecret               (TPM_CC)(0x00000151)
00280 #define TPM_CC_Rewrap                     (TPM_CC)(0x00000152)
00281 #define TPM_CC_Create                     (TPM_CC)(0x00000153)
00282 #define TPM_CC_ECDH_ZGen                  (TPM_CC)(0x00000154)
00283 #define TPM_CC_HMAC                       (TPM_CC)(0x00000155)
00284 #define TPM_CC_Import                     (TPM_CC)(0x00000156)
00285 #define TPM_CC_Load                       (TPM_CC)(0x00000157)
00286 #define TPM_CC_Quote                      (TPM_CC)(0x00000158)
00287 #define TPM_CC_RSA_Decrypt                (TPM_CC)(0x00000159)
00288 #define TPM_CC_HMAC_Start                 (TPM_CC)(0x0000015B)
00289 #define TPM_CC_SequenceUpdate             (TPM_CC)(0x0000015C)
00290 #define TPM_CC_Sign                       (TPM_CC)(0x0000015D)
00291 #define TPM_CC_Unseal                     (TPM_CC)(0x0000015E)
00292 #define TPM_CC_PolicySigned               (TPM_CC)(0x00000160)
00293 #define TPM_CC_ContextLoad                (TPM_CC)(0x00000161)
00294 #define TPM_CC_ContextSave                (TPM_CC)(0x00000162)
00295 #define TPM_CC_ECDH_KeyGen                (TPM_CC)(0x00000163)
00296 #define TPM_CC_EncryptDecrypt             (TPM_CC)(0x00000164)
00297 #define TPM_CC_FlushContext               (TPM_CC)(0x00000165)
00298 #define TPM_CC_LoadExternal               (TPM_CC)(0x00000167)
00299 #define TPM_CC_MakeCredential             (TPM_CC)(0x00000168)
00300 #define TPM_CC_NV_ReadPublic              (TPM_CC)(0x00000169)
00301 #define TPM_CC_PolicyAuthorize            (TPM_CC)(0x0000016A)
00302 #define TPM_CC_PolicyAuthValue            (TPM_CC)(0x0000016B)
00303 #define TPM_CC_PolicyCommandCode          (TPM_CC)(0x0000016C)
00304 #define TPM_CC_PolicyCounterTimer         (TPM_CC)(0x0000016D)
00305 #define TPM_CC_PolicyCpHash               (TPM_CC)(0x0000016E)
00306 #define TPM_CC_PolicyLocality             (TPM_CC)(0x0000016F)
00307 #define TPM_CC_PolicyNameHash             (TPM_CC)(0x00000170)
00308 #define TPM_CC_PolicyOR                   (TPM_CC)(0x00000171)
00309 #define TPM_CC_PolicyTicket               (TPM_CC)(0x00000172)
00310 #define TPM_CC_ReadPublic                 (TPM_CC)(0x00000173)
00311 #define TPM_CC_RSA_Encrypt                (TPM_CC)(0x00000174)
00312 #define TPM_CC_StartAuthSession           (TPM_CC)(0x00000176)
00313 #define TPM_CC_VerifySignature            (TPM_CC)(0x00000177)
00314 #define TPM_CC_ECC_Parameters             (TPM_CC)(0x00000178)
00315 #define TPM_CC_FirmwareRead               (TPM_CC)(0x00000179)
00316 #define TPM_CC_GetCapability              (TPM_CC)(0x0000017A)
00317 #define TPM_CC_GetRandom                  (TPM_CC)(0x0000017B)
00318 #define TPM_CC_GetTestResult              (TPM_CC)(0x0000017C)
00319 #define TPM_CC_Hash                       (TPM_CC)(0x0000017D)
00320 #define TPM_CC_PCR_Read                   (TPM_CC)(0x0000017E)
00321 #define TPM_CC_PolicyPCR                  (TPM_CC)(0x0000017F)
00322 #define TPM_CC_PolicyRestart              (TPM_CC)(0x00000180)
00323 #define TPM_CC_ReadClock                  (TPM_CC)(0x00000181)
00324 #define TPM_CC_PCR_Extend                 (TPM_CC)(0x00000182)
00325 #define TPM_CC_PCR_SetAuthValue           (TPM_CC)(0x00000183)
00326 #define TPM_CC_NV_Certify                 (TPM_CC)(0x00000184)
00327 #define TPM_CC_EventSequenceComplete      (TPM_CC)(0x00000185)
00328 #define TPM_CC_HashSequenceStart          (TPM_CC)(0x00000186)
00329 #define TPM_CC_PolicyPhysicalPresence     (TPM_CC)(0x00000187)
00330 #define TPM_CC_PolicyDuplicationSelect    (TPM_CC)(0x00000188)
00331 #define TPM_CC_PolicyGetDigest            (TPM_CC)(0x00000189)
00332 #define TPM_CC_TestParms                  (TPM_CC)(0x0000018A)
00333 #define TPM_CC_Commit                     (TPM_CC)(0x0000018B)
00334 #define TPM_CC_PolicyPassword             (TPM_CC)(0x0000018C)
00335 #define TPM_CC_ZGen_2Phase                (TPM_CC)(0x0000018D)
00336 #define TPM_CC_EC_Ephemeral               (TPM_CC)(0x0000018E)
00337 #define TPM_CC_LAST                       (TPM_CC)(0x0000018E)
00338 
00339 // Table 15 - TPM_RC Constants (Actions)
00340 typedef UINT32 TPM_RC;
00341 #define TPM_RC_SUCCESS           (TPM_RC)(0x000)
00342 #define TPM_RC_BAD_TAG           (TPM_RC)(0x030)
00343 #define RC_VER1                  (TPM_RC)(0x100)
00344 #define TPM_RC_INITIALIZE        (TPM_RC)(RC_VER1 + 0x000)
00345 #define TPM_RC_FAILURE           (TPM_RC)(RC_VER1 + 0x001)
00346 #define TPM_RC_SEQUENCE          (TPM_RC)(RC_VER1 + 0x003)
00347 #define TPM_RC_PRIVATE           (TPM_RC)(RC_VER1 + 0x00B)
00348 #define TPM_RC_HMAC              (TPM_RC)(RC_VER1 + 0x019)
00349 #define TPM_RC_DISABLED          (TPM_RC)(RC_VER1 + 0x020)
00350 #define TPM_RC_EXCLUSIVE         (TPM_RC)(RC_VER1 + 0x021)
00351 #define TPM_RC_AUTH_TYPE         (TPM_RC)(RC_VER1 + 0x024)
00352 #define TPM_RC_AUTH_MISSING      (TPM_RC)(RC_VER1 + 0x025)
00353 #define TPM_RC_POLICY            (TPM_RC)(RC_VER1 + 0x026)
00354 #define TPM_RC_PCR               (TPM_RC)(RC_VER1 + 0x027)
00355 #define TPM_RC_PCR_CHANGED       (TPM_RC)(RC_VER1 + 0x028)
00356 #define TPM_RC_UPGRADE           (TPM_RC)(RC_VER1 + 0x02D)
00357 #define TPM_RC_TOO_MANY_CONTEXTS (TPM_RC)(RC_VER1 + 0x02E)
00358 #define TPM_RC_AUTH_UNAVAILABLE  (TPM_RC)(RC_VER1 + 0x02F)
00359 #define TPM_RC_REBOOT            (TPM_RC)(RC_VER1 + 0x030)
00360 #define TPM_RC_UNBALANCED        (TPM_RC)(RC_VER1 + 0x031)
00361 #define TPM_RC_COMMAND_SIZE      (TPM_RC)(RC_VER1 + 0x042)
00362 #define TPM_RC_COMMAND_CODE      (TPM_RC)(RC_VER1 + 0x043)
00363 #define TPM_RC_AUTHSIZE          (TPM_RC)(RC_VER1 + 0x044)
00364 #define TPM_RC_AUTH_CONTEXT      (TPM_RC)(RC_VER1 + 0x045)
00365 #define TPM_RC_NV_RANGE          (TPM_RC)(RC_VER1 + 0x046)
00366 #define TPM_RC_NV_SIZE           (TPM_RC)(RC_VER1 + 0x047)
00367 #define TPM_RC_NV_LOCKED         (TPM_RC)(RC_VER1 + 0x048)
00368 #define TPM_RC_NV_AUTHORIZATION  (TPM_RC)(RC_VER1 + 0x049)
00369 #define TPM_RC_NV_UNINITIALIZED  (TPM_RC)(RC_VER1 + 0x04A)
00370 #define TPM_RC_NV_SPACE          (TPM_RC)(RC_VER1 + 0x04B)
00371 #define TPM_RC_NV_DEFINED        (TPM_RC)(RC_VER1 + 0x04C)
00372 #define TPM_RC_BAD_CONTEXT       (TPM_RC)(RC_VER1 + 0x050)
00373 #define TPM_RC_CPHASH            (TPM_RC)(RC_VER1 + 0x051)
00374 #define TPM_RC_PARENT            (TPM_RC)(RC_VER1 + 0x052)
00375 #define TPM_RC_NEEDS_TEST        (TPM_RC)(RC_VER1 + 0x053)
00376 #define TPM_RC_NO_RESULT         (TPM_RC)(RC_VER1 + 0x054)
00377 #define TPM_RC_SENSITIVE         (TPM_RC)(RC_VER1 + 0x055)
00378 #define RC_MAX_FM0               (TPM_RC)(RC_VER1 + 0x07F)
00379 #define RC_FMT1                  (TPM_RC)(0x080)
00380 #define TPM_RC_ASYMMETRIC        (TPM_RC)(RC_FMT1 + 0x001)
00381 #define TPM_RC_ATTRIBUTES        (TPM_RC)(RC_FMT1 + 0x002)
00382 #define TPM_RC_HASH              (TPM_RC)(RC_FMT1 + 0x003)
00383 #define TPM_RC_VALUE             (TPM_RC)(RC_FMT1 + 0x004)
00384 #define TPM_RC_HIERARCHY         (TPM_RC)(RC_FMT1 + 0x005)
00385 #define TPM_RC_KEY_SIZE          (TPM_RC)(RC_FMT1 + 0x007)
00386 #define TPM_RC_MGF               (TPM_RC)(RC_FMT1 + 0x008)
00387 #define TPM_RC_MODE              (TPM_RC)(RC_FMT1 + 0x009)
00388 #define TPM_RC_TYPE              (TPM_RC)(RC_FMT1 + 0x00A)
00389 #define TPM_RC_HANDLE            (TPM_RC)(RC_FMT1 + 0x00B)
00390 #define TPM_RC_KDF               (TPM_RC)(RC_FMT1 + 0x00C)
00391 #define TPM_RC_RANGE             (TPM_RC)(RC_FMT1 + 0x00D)
00392 #define TPM_RC_AUTH_FAIL         (TPM_RC)(RC_FMT1 + 0x00E)
00393 #define TPM_RC_NONCE             (TPM_RC)(RC_FMT1 + 0x00F)
00394 #define TPM_RC_PP                (TPM_RC)(RC_FMT1 + 0x010)
00395 #define TPM_RC_SCHEME            (TPM_RC)(RC_FMT1 + 0x012)
00396 #define TPM_RC_SIZE              (TPM_RC)(RC_FMT1 + 0x015)
00397 #define TPM_RC_SYMMETRIC         (TPM_RC)(RC_FMT1 + 0x016)
00398 #define TPM_RC_TAG               (TPM_RC)(RC_FMT1 + 0x017)
00399 #define TPM_RC_SELECTOR          (TPM_RC)(RC_FMT1 + 0x018)
00400 #define TPM_RC_INSUFFICIENT      (TPM_RC)(RC_FMT1 + 0x01A)
00401 #define TPM_RC_SIGNATURE         (TPM_RC)(RC_FMT1 + 0x01B)
00402 #define TPM_RC_KEY               (TPM_RC)(RC_FMT1 + 0x01C)
00403 #define TPM_RC_POLICY_FAIL       (TPM_RC)(RC_FMT1 + 0x01D)
00404 #define TPM_RC_INTEGRITY         (TPM_RC)(RC_FMT1 + 0x01F)
00405 #define TPM_RC_TICKET            (TPM_RC)(RC_FMT1 + 0x020)
00406 #define TPM_RC_RESERVED_BITS     (TPM_RC)(RC_FMT1 + 0x021)
00407 #define TPM_RC_BAD_AUTH          (TPM_RC)(RC_FMT1 + 0x022)
00408 #define TPM_RC_EXPIRED           (TPM_RC)(RC_FMT1 + 0x023)
00409 #define TPM_RC_POLICY_CC         (TPM_RC)(RC_FMT1 + 0x024 )
00410 #define TPM_RC_BINDING           (TPM_RC)(RC_FMT1 + 0x025)
00411 #define TPM_RC_CURVE             (TPM_RC)(RC_FMT1 + 0x026)
00412 #define TPM_RC_ECC_POINT         (TPM_RC)(RC_FMT1 + 0x027)
00413 #define RC_WARN                  (TPM_RC)(0x900)
00414 #define TPM_RC_CONTEXT_GAP       (TPM_RC)(RC_WARN + 0x001)
00415 #define TPM_RC_OBJECT_MEMORY     (TPM_RC)(RC_WARN + 0x002)
00416 #define TPM_RC_SESSION_MEMORY    (TPM_RC)(RC_WARN + 0x003)
00417 #define TPM_RC_MEMORY            (TPM_RC)(RC_WARN + 0x004)
00418 #define TPM_RC_SESSION_HANDLES   (TPM_RC)(RC_WARN + 0x005)
00419 #define TPM_RC_OBJECT_HANDLES    (TPM_RC)(RC_WARN + 0x006)
00420 #define TPM_RC_LOCALITY          (TPM_RC)(RC_WARN + 0x007)
00421 #define TPM_RC_YIELDED           (TPM_RC)(RC_WARN + 0x008)
00422 #define TPM_RC_CANCELED          (TPM_RC)(RC_WARN + 0x009)
00423 #define TPM_RC_TESTING           (TPM_RC)(RC_WARN + 0x00A)
00424 #define TPM_RC_REFERENCE_H0      (TPM_RC)(RC_WARN + 0x010)
00425 #define TPM_RC_REFERENCE_H1      (TPM_RC)(RC_WARN + 0x011)
00426 #define TPM_RC_REFERENCE_H2      (TPM_RC)(RC_WARN + 0x012)
00427 #define TPM_RC_REFERENCE_H3      (TPM_RC)(RC_WARN + 0x013)
00428 #define TPM_RC_REFERENCE_H4      (TPM_RC)(RC_WARN + 0x014)
00429 #define TPM_RC_REFERENCE_H5      (TPM_RC)(RC_WARN + 0x015)
00430 #define TPM_RC_REFERENCE_H6      (TPM_RC)(RC_WARN + 0x016)
00431 #define TPM_RC_REFERENCE_S0      (TPM_RC)(RC_WARN + 0x018)
00432 #define TPM_RC_REFERENCE_S1      (TPM_RC)(RC_WARN + 0x019)
00433 #define TPM_RC_REFERENCE_S2      (TPM_RC)(RC_WARN + 0x01A)
00434 #define TPM_RC_REFERENCE_S3      (TPM_RC)(RC_WARN + 0x01B)
00435 #define TPM_RC_REFERENCE_S4      (TPM_RC)(RC_WARN + 0x01C)
00436 #define TPM_RC_REFERENCE_S5      (TPM_RC)(RC_WARN + 0x01D)
00437 #define TPM_RC_REFERENCE_S6      (TPM_RC)(RC_WARN + 0x01E)
00438 #define TPM_RC_NV_RATE           (TPM_RC)(RC_WARN + 0x020)
00439 #define TPM_RC_LOCKOUT           (TPM_RC)(RC_WARN + 0x021)
00440 #define TPM_RC_RETRY             (TPM_RC)(RC_WARN + 0x022)
00441 #define TPM_RC_NV_UNAVAILABLE    (TPM_RC)(RC_WARN + 0x023)
00442 #define TPM_RC_NOT_USED          (TPM_RC)(RC_WARN + 0x7F)
00443 #define TPM_RC_H                 (TPM_RC)(0x000)
00444 #define TPM_RC_P                 (TPM_RC)(0x040)
00445 #define TPM_RC_S                 (TPM_RC)(0x800)
00446 #define TPM_RC_1                 (TPM_RC)(0x100)
00447 #define TPM_RC_2                 (TPM_RC)(0x200)
00448 #define TPM_RC_3                 (TPM_RC)(0x300)
00449 #define TPM_RC_4                 (TPM_RC)(0x400)
00450 #define TPM_RC_5                 (TPM_RC)(0x500)
00451 #define TPM_RC_6                 (TPM_RC)(0x600)
00452 #define TPM_RC_7                 (TPM_RC)(0x700)
00453 #define TPM_RC_8                 (TPM_RC)(0x800)
00454 #define TPM_RC_9                 (TPM_RC)(0x900)
00455 #define TPM_RC_A                 (TPM_RC)(0xA00)
00456 #define TPM_RC_B                 (TPM_RC)(0xB00)
00457 #define TPM_RC_C                 (TPM_RC)(0xC00)
00458 #define TPM_RC_D                 (TPM_RC)(0xD00)
00459 #define TPM_RC_E                 (TPM_RC)(0xE00)
00460 #define TPM_RC_F                 (TPM_RC)(0xF00)
00461 #define TPM_RC_N_MASK            (TPM_RC)(0xF00)
00462 
00463 // Table 16 - TPM_CLOCK_ADJUST Constants
00464 typedef INT8 TPM_CLOCK_ADJUST;
00465 #define TPM_CLOCK_COARSE_SLOWER (TPM_CLOCK_ADJUST)(-3)
00466 #define TPM_CLOCK_MEDIUM_SLOWER (TPM_CLOCK_ADJUST)(-2)
00467 #define TPM_CLOCK_FINE_SLOWER   (TPM_CLOCK_ADJUST)(-1)
00468 #define TPM_CLOCK_NO_CHANGE     (TPM_CLOCK_ADJUST)(0)
00469 #define TPM_CLOCK_FINE_FASTER   (TPM_CLOCK_ADJUST)(1)
00470 #define TPM_CLOCK_MEDIUM_FASTER (TPM_CLOCK_ADJUST)(2)
00471 #define TPM_CLOCK_COARSE_FASTER (TPM_CLOCK_ADJUST)(3)
00472 
00473 // Table 17 - TPM_EO Constants
00474 typedef UINT16 TPM_EO;
00475 #define TPM_EO_EQ          (TPM_EO)(0x0000)
00476 #define TPM_EO_NEQ         (TPM_EO)(0x0001)
00477 #define TPM_EO_SIGNED_GT   (TPM_EO)(0x0002)
00478 #define TPM_EO_UNSIGNED_GT (TPM_EO)(0x0003)
00479 #define TPM_EO_SIGNED_LT   (TPM_EO)(0x0004)
00480 #define TPM_EO_UNSIGNED_LT (TPM_EO)(0x0005)
00481 #define TPM_EO_SIGNED_GE   (TPM_EO)(0x0006)
00482 #define TPM_EO_UNSIGNED_GE (TPM_EO)(0x0007)
00483 #define TPM_EO_SIGNED_LE   (TPM_EO)(0x0008)
00484 #define TPM_EO_UNSIGNED_LE (TPM_EO)(0x0009)
00485 #define TPM_EO_BITSET      (TPM_EO)(0x000A)
00486 #define TPM_EO_BITCLEAR    (TPM_EO)(0x000B)
00487 
00488 // Table 18 - TPM_ST Constants
00489 typedef UINT16 TPM_ST;
00490 #define TPM_ST_RSP_COMMAND          (TPM_ST)(0x00C4)
00491 #define TPM_ST_NULL                 (TPM_ST)(0X8000)
00492 #define TPM_ST_NO_SESSIONS          (TPM_ST)(0x8001)
00493 #define TPM_ST_SESSIONS             (TPM_ST)(0x8002)
00494 #define TPM_ST_ATTEST_NV            (TPM_ST)(0x8014)
00495 #define TPM_ST_ATTEST_COMMAND_AUDIT (TPM_ST)(0x8015)
00496 #define TPM_ST_ATTEST_SESSION_AUDIT (TPM_ST)(0x8016)
00497 #define TPM_ST_ATTEST_CERTIFY       (TPM_ST)(0x8017)
00498 #define TPM_ST_ATTEST_QUOTE         (TPM_ST)(0x8018)
00499 #define TPM_ST_ATTEST_TIME          (TPM_ST)(0x8019)
00500 #define TPM_ST_ATTEST_CREATION      (TPM_ST)(0x801A)
00501 #define TPM_ST_CREATION             (TPM_ST)(0x8021)
00502 #define TPM_ST_VERIFIED             (TPM_ST)(0x8022)
00503 #define TPM_ST_AUTH_SECRET          (TPM_ST)(0x8023)
00504 #define TPM_ST_HASHCHECK            (TPM_ST)(0x8024)
00505 #define TPM_ST_AUTH_SIGNED          (TPM_ST)(0x8025)
00506 #define TPM_ST_FU_MANIFEST          (TPM_ST)(0x8029)
00507 
00508 // Table 19 - TPM_SU Constants
00509 typedef UINT16 TPM_SU;
00510 #define TPM_SU_CLEAR (TPM_SU)(0x0000)
00511 #define TPM_SU_STATE (TPM_SU)(0x0001)
00512 
00513 // Table 20 - TPM_SE Constants
00514 typedef UINT8 TPM_SE;
00515 #define TPM_SE_HMAC   (TPM_SE)(0x00)
00516 #define TPM_SE_POLICY (TPM_SE)(0x01)
00517 #define TPM_SE_TRIAL  (TPM_SE)(0x03)
00518 
00519 // Table 21 - TPM_CAP Constants
00520 typedef UINT32 TPM_CAP;
00521 #define TPM_CAP_FIRST           (TPM_CAP)(0x00000000)
00522 #define TPM_CAP_ALGS            (TPM_CAP)(0x00000000)
00523 #define TPM_CAP_HANDLES         (TPM_CAP)(0x00000001)
00524 #define TPM_CAP_COMMANDS        (TPM_CAP)(0x00000002)
00525 #define TPM_CAP_PP_COMMANDS     (TPM_CAP)(0x00000003)
00526 #define TPM_CAP_AUDIT_COMMANDS  (TPM_CAP)(0x00000004)
00527 #define TPM_CAP_PCRS            (TPM_CAP)(0x00000005)
00528 #define TPM_CAP_TPM_PROPERTIES  (TPM_CAP)(0x00000006)
00529 #define TPM_CAP_PCR_PROPERTIES  (TPM_CAP)(0x00000007)
00530 #define TPM_CAP_ECC_CURVES      (TPM_CAP)(0x00000008)
00531 #define TPM_CAP_LAST            (TPM_CAP)(0x00000008)
00532 #define TPM_CAP_VENDOR_PROPERTY (TPM_CAP)(0x00000100)
00533 
00534 // Table 22 - TPM_PT Constants
00535 typedef UINT32 TPM_PT;
00536 #define TPM_PT_NONE                (TPM_PT)(0x00000000)
00537 #define PT_GROUP                   (TPM_PT)(0x00000100)
00538 #define PT_FIXED                   (TPM_PT)(PT_GROUP * 1)
00539 #define TPM_PT_FAMILY_INDICATOR    (TPM_PT)(PT_FIXED + 0)
00540 #define TPM_PT_LEVEL               (TPM_PT)(PT_FIXED + 1)
00541 #define TPM_PT_REVISION            (TPM_PT)(PT_FIXED + 2)
00542 #define TPM_PT_DAY_OF_YEAR         (TPM_PT)(PT_FIXED + 3)
00543 #define TPM_PT_YEAR                (TPM_PT)(PT_FIXED + 4)
00544 #define TPM_PT_MANUFACTURER        (TPM_PT)(PT_FIXED + 5)
00545 #define TPM_PT_VENDOR_STRING_1     (TPM_PT)(PT_FIXED + 6)
00546 #define TPM_PT_VENDOR_STRING_2     (TPM_PT)(PT_FIXED + 7)
00547 #define TPM_PT_VENDOR_STRING_3     (TPM_PT)(PT_FIXED + 8)
00548 #define TPM_PT_VENDOR_STRING_4     (TPM_PT)(PT_FIXED + 9)
00549 #define TPM_PT_VENDOR_TPM_TYPE     (TPM_PT)(PT_FIXED + 10)
00550 #define TPM_PT_FIRMWARE_VERSION_1  (TPM_PT)(PT_FIXED + 11)
00551 #define TPM_PT_FIRMWARE_VERSION_2  (TPM_PT)(PT_FIXED + 12)
00552 #define TPM_PT_INPUT_BUFFER        (TPM_PT)(PT_FIXED + 13)
00553 #define TPM_PT_HR_TRANSIENT_MIN    (TPM_PT)(PT_FIXED + 14)
00554 #define TPM_PT_HR_PERSISTENT_MIN   (TPM_PT)(PT_FIXED + 15)
00555 #define TPM_PT_HR_LOADED_MIN       (TPM_PT)(PT_FIXED + 16)
00556 #define TPM_PT_ACTIVE_SESSIONS_MAX (TPM_PT)(PT_FIXED + 17)
00557 #define TPM_PT_PCR_COUNT           (TPM_PT)(PT_FIXED + 18)
00558 #define TPM_PT_PCR_SELECT_MIN      (TPM_PT)(PT_FIXED + 19)
00559 #define TPM_PT_CONTEXT_GAP_MAX     (TPM_PT)(PT_FIXED + 20)
00560 #define TPM_PT_NV_COUNTERS_MAX     (TPM_PT)(PT_FIXED + 22)
00561 #define TPM_PT_NV_INDEX_MAX        (TPM_PT)(PT_FIXED + 23)
00562 #define TPM_PT_MEMORY              (TPM_PT)(PT_FIXED + 24)
00563 #define TPM_PT_CLOCK_UPDATE        (TPM_PT)(PT_FIXED + 25)
00564 #define TPM_PT_CONTEXT_HASH        (TPM_PT)(PT_FIXED + 26)
00565 #define TPM_PT_CONTEXT_SYM         (TPM_PT)(PT_FIXED + 27)
00566 #define TPM_PT_CONTEXT_SYM_SIZE    (TPM_PT)(PT_FIXED + 28)
00567 #define TPM_PT_ORDERLY_COUNT       (TPM_PT)(PT_FIXED + 29)
00568 #define TPM_PT_MAX_COMMAND_SIZE    (TPM_PT)(PT_FIXED + 30)
00569 #define TPM_PT_MAX_RESPONSE_SIZE   (TPM_PT)(PT_FIXED + 31)
00570 #define TPM_PT_MAX_DIGEST          (TPM_PT)(PT_FIXED + 32)
00571 #define TPM_PT_MAX_OBJECT_CONTEXT  (TPM_PT)(PT_FIXED + 33)
00572 #define TPM_PT_MAX_SESSION_CONTEXT (TPM_PT)(PT_FIXED + 34)
00573 #define TPM_PT_PS_FAMILY_INDICATOR (TPM_PT)(PT_FIXED + 35)
00574 #define TPM_PT_PS_LEVEL            (TPM_PT)(PT_FIXED + 36)
00575 #define TPM_PT_PS_REVISION         (TPM_PT)(PT_FIXED + 37)
00576 #define TPM_PT_PS_DAY_OF_YEAR      (TPM_PT)(PT_FIXED + 38)
00577 #define TPM_PT_PS_YEAR             (TPM_PT)(PT_FIXED + 39)
00578 #define TPM_PT_SPLIT_MAX           (TPM_PT)(PT_FIXED + 40)
00579 #define TPM_PT_TOTAL_COMMANDS      (TPM_PT)(PT_FIXED + 41)
00580 #define TPM_PT_LIBRARY_COMMANDS    (TPM_PT)(PT_FIXED + 42)
00581 #define TPM_PT_VENDOR_COMMANDS     (TPM_PT)(PT_FIXED + 43)
00582 #define PT_VAR                     (TPM_PT)(PT_GROUP * 2)
00583 #define TPM_PT_PERMANENT           (TPM_PT)(PT_VAR + 0)
00584 #define TPM_PT_STARTUP_CLEAR       (TPM_PT)(PT_VAR + 1)
00585 #define TPM_PT_HR_NV_INDEX         (TPM_PT)(PT_VAR + 2)
00586 #define TPM_PT_HR_LOADED           (TPM_PT)(PT_VAR + 3)
00587 #define TPM_PT_HR_LOADED_AVAIL     (TPM_PT)(PT_VAR + 4)
00588 #define TPM_PT_HR_ACTIVE           (TPM_PT)(PT_VAR + 5)
00589 #define TPM_PT_HR_ACTIVE_AVAIL     (TPM_PT)(PT_VAR + 6)
00590 #define TPM_PT_HR_TRANSIENT_AVAIL  (TPM_PT)(PT_VAR + 7)
00591 #define TPM_PT_HR_PERSISTENT       (TPM_PT)(PT_VAR + 8)
00592 #define TPM_PT_HR_PERSISTENT_AVAIL (TPM_PT)(PT_VAR + 9)
00593 #define TPM_PT_NV_COUNTERS         (TPM_PT)(PT_VAR + 10)
00594 #define TPM_PT_NV_COUNTERS_AVAIL   (TPM_PT)(PT_VAR + 11)
00595 #define TPM_PT_ALGORITHM_SET       (TPM_PT)(PT_VAR + 12)
00596 #define TPM_PT_LOADED_CURVES       (TPM_PT)(PT_VAR + 13)
00597 #define TPM_PT_LOCKOUT_COUNTER     (TPM_PT)(PT_VAR + 14)
00598 #define TPM_PT_MAX_AUTH_FAIL       (TPM_PT)(PT_VAR + 15)
00599 #define TPM_PT_LOCKOUT_INTERVAL    (TPM_PT)(PT_VAR + 16)
00600 #define TPM_PT_LOCKOUT_RECOVERY    (TPM_PT)(PT_VAR + 17)
00601 #define TPM_PT_NV_WRITE_RECOVERY   (TPM_PT)(PT_VAR + 18)
00602 #define TPM_PT_AUDIT_COUNTER_0     (TPM_PT)(PT_VAR + 19)
00603 #define TPM_PT_AUDIT_COUNTER_1     (TPM_PT)(PT_VAR + 20)
00604 
00605 // Table 23 - TPM_PT_PCR Constants
00606 typedef UINT32 TPM_PT_PCR;
00607 #define TPM_PT_PCR_FIRST        (TPM_PT_PCR)(0x00000000)
00608 #define TPM_PT_PCR_SAVE         (TPM_PT_PCR)(0x00000000)
00609 #define TPM_PT_PCR_EXTEND_L0    (TPM_PT_PCR)(0x00000001)
00610 #define TPM_PT_PCR_RESET_L0     (TPM_PT_PCR)(0x00000002)
00611 #define TPM_PT_PCR_EXTEND_L1    (TPM_PT_PCR)(0x00000003)
00612 #define TPM_PT_PCR_RESET_L1     (TPM_PT_PCR)(0x00000004)
00613 #define TPM_PT_PCR_EXTEND_L2    (TPM_PT_PCR)(0x00000005)
00614 #define TPM_PT_PCR_RESET_L2     (TPM_PT_PCR)(0x00000006)
00615 #define TPM_PT_PCR_EXTEND_L3    (TPM_PT_PCR)(0x00000007)
00616 #define TPM_PT_PCR_RESET_L3     (TPM_PT_PCR)(0x00000008)
00617 #define TPM_PT_PCR_EXTEND_L4    (TPM_PT_PCR)(0x00000009)
00618 #define TPM_PT_PCR_RESET_L4     (TPM_PT_PCR)(0x0000000A)
00619 #define TPM_PT_PCR_NO_INCREMENT (TPM_PT_PCR)(0x00000011)
00620 #define TPM_PT_PCR_DRTM_RESET   (TPM_PT_PCR)(0x00000012)
00621 #define TPM_PT_PCR_POLICY       (TPM_PT_PCR)(0x00000013)
00622 #define TPM_PT_PCR_AUTH         (TPM_PT_PCR)(0x00000014)
00623 #define TPM_PT_PCR_LAST         (TPM_PT_PCR)(0x00000014)
00624 
00625 // Table 24 - TPM_PS Constants
00626 typedef UINT32 TPM_PS;
00627 #define TPM_PS_MAIN           (TPM_PS)(0x00000000)
00628 #define TPM_PS_PC             (TPM_PS)(0x00000001)
00629 #define TPM_PS_PDA            (TPM_PS)(0x00000002)
00630 #define TPM_PS_CELL_PHONE     (TPM_PS)(0x00000003)
00631 #define TPM_PS_SERVER         (TPM_PS)(0x00000004)
00632 #define TPM_PS_PERIPHERAL     (TPM_PS)(0x00000005)
00633 #define TPM_PS_TSS            (TPM_PS)(0x00000006)
00634 #define TPM_PS_STORAGE        (TPM_PS)(0x00000007)
00635 #define TPM_PS_AUTHENTICATION (TPM_PS)(0x00000008)
00636 #define TPM_PS_EMBEDDED       (TPM_PS)(0x00000009)
00637 #define TPM_PS_HARDCOPY       (TPM_PS)(0x0000000A)
00638 #define TPM_PS_INFRASTRUCTURE (TPM_PS)(0x0000000B)
00639 #define TPM_PS_VIRTUALIZATION (TPM_PS)(0x0000000C)
00640 #define TPM_PS_TNC            (TPM_PS)(0x0000000D)
00641 #define TPM_PS_MULTI_TENANT   (TPM_PS)(0x0000000E)
00642 #define TPM_PS_TC             (TPM_PS)(0x0000000F)
00643 
00644 // 7 Handles
00645 
00646 // Table 25 - Handles Types
00647 //
00648 // NOTE: Comment because it has same name as TPM1.2 (value is same, so not runtime issue)
00649 //
00650 //typedef UINT32    TPM_HANDLE;
00651 
00652 // Table 26 - TPM_HT Constants
00653 typedef UINT8 TPM_HT;
00654 #define TPM_HT_PCR            (TPM_HT)(0x00)
00655 #define TPM_HT_NV_INDEX       (TPM_HT)(0x01)
00656 #define TPM_HT_HMAC_SESSION   (TPM_HT)(0x02)
00657 #define TPM_HT_LOADED_SESSION (TPM_HT)(0x02)
00658 #define TPM_HT_POLICY_SESSION (TPM_HT)(0x03)
00659 #define TPM_HT_ACTIVE_SESSION (TPM_HT)(0x03)
00660 #define TPM_HT_PERMANENT      (TPM_HT)(0x40)
00661 #define TPM_HT_TRANSIENT      (TPM_HT)(0x80)
00662 #define TPM_HT_PERSISTENT     (TPM_HT)(0x81)
00663 
00664 // Table 27 - TPM_RH Constants
00665 typedef UINT32 TPM_RH;
00666 #define TPM_RH_FIRST       (TPM_RH)(0x40000000)
00667 #define TPM_RH_SRK         (TPM_RH)(0x40000000)
00668 #define TPM_RH_OWNER       (TPM_RH)(0x40000001)
00669 #define TPM_RH_REVOKE      (TPM_RH)(0x40000002)
00670 #define TPM_RH_TRANSPORT   (TPM_RH)(0x40000003)
00671 #define TPM_RH_OPERATOR    (TPM_RH)(0x40000004)
00672 #define TPM_RH_ADMIN       (TPM_RH)(0x40000005)
00673 #define TPM_RH_EK          (TPM_RH)(0x40000006)
00674 #define TPM_RH_NULL        (TPM_RH)(0x40000007)
00675 #define TPM_RH_UNASSIGNED  (TPM_RH)(0x40000008)
00676 #define TPM_RS_PW          (TPM_RH)(0x40000009)
00677 #define TPM_RH_LOCKOUT     (TPM_RH)(0x4000000A)
00678 #define TPM_RH_ENDORSEMENT (TPM_RH)(0x4000000B)
00679 #define TPM_RH_PLATFORM    (TPM_RH)(0x4000000C)
00680 #define TPM_RH_PLATFORM_NV (TPM_RH)(0x4000000D)
00681 #define TPM_RH_AUTH_00     (TPM_RH)(0x40000010)
00682 #define TPM_RH_AUTH_FF     (TPM_RH)(0x4000010F)
00683 #define TPM_RH_LAST        (TPM_RH)(0x4000010F)
00684 
00685 // Table 28 - TPM_HC Constants
00686 typedef TPM_HANDLE TPM_HC;
00687 #define HR_HANDLE_MASK       (TPM_HC)(0x00FFFFFF)
00688 #define HR_RANGE_MASK        (TPM_HC)(0xFF000000)
00689 #define HR_SHIFT             (TPM_HC)(24)
00690 #define HR_PCR               (TPM_HC)((TPM_HC)TPM_HT_PCR << HR_SHIFT)
00691 #define HR_HMAC_SESSION      (TPM_HC)((TPM_HC)TPM_HT_HMAC_SESSION << HR_SHIFT)
00692 #define HR_POLICY_SESSION    (TPM_HC)((TPM_HC)TPM_HT_POLICY_SESSION << HR_SHIFT)
00693 #define HR_TRANSIENT         (TPM_HC)((TPM_HC)TPM_HT_TRANSIENT << HR_SHIFT)
00694 #define HR_PERSISTENT        (TPM_HC)((TPM_HC)TPM_HT_PERSISTENT << HR_SHIFT)
00695 #define HR_NV_INDEX          (TPM_HC)((TPM_HC)TPM_HT_NV_INDEX << HR_SHIFT)
00696 #define HR_PERMANENT         (TPM_HC)((TPM_HC)TPM_HT_PERMANENT << HR_SHIFT)
00697 #define PCR_FIRST            (TPM_HC)(HR_PCR + 0)
00698 #define PCR_LAST             (TPM_HC)(PCR_FIRST + IMPLEMENTATION_PCR - 1)
00699 #define HMAC_SESSION_FIRST   (TPM_HC)(HR_HMAC_SESSION + 0)
00700 #define HMAC_SESSION_LAST    (TPM_HC)(HMAC_SESSION_FIRST + MAX_ACTIVE_SESSIONS - 1)
00701 #define LOADED_SESSION_FIRST (TPM_HC)(HMAC_SESSION_FIRST)
00702 #define LOADED_SESSION_LAST  (TPM_HC)(HMAC_SESSION_LAST)
00703 #define POLICY_SESSION_FIRST (TPM_HC)(HR_POLICY_SESSION + 0)
00704 #define POLICY_SESSION_LAST  (TPM_HC)(POLICY_SESSION_FIRST + MAX_ACTIVE_SESSIONS - 1)
00705 #define TRANSIENT_FIRST      (TPM_HC)(HR_TRANSIENT + 0)
00706 #define ACTIVE_SESSION_FIRST (TPM_HC)(POLICY_SESSION_FIRST)
00707 #define ACTIVE_SESSION_LAST  (TPM_HC)(POLICY_SESSION_LAST)
00708 #define TRANSIENT_LAST       (TPM_HC)(TRANSIENT_FIRST+MAX_LOADED_OBJECTS - 1)
00709 #define PERSISTENT_FIRST     (TPM_HC)(HR_PERSISTENT + 0)
00710 #define PERSISTENT_LAST      (TPM_HC)(PERSISTENT_FIRST + 0x00FFFFFF)
00711 #define PLATFORM_PERSISTENT  (TPM_HC)(PERSISTENT_FIRST + 0x00800000)
00712 #define NV_INDEX_FIRST       (TPM_HC)(HR_NV_INDEX + 0)
00713 #define NV_INDEX_LAST        (TPM_HC)(NV_INDEX_FIRST + 0x00FFFFFF)
00714 #define PERMANENT_FIRST      (TPM_HC)(TPM_RH_FIRST)
00715 #define PERMANENT_LAST       (TPM_HC)(TPM_RH_LAST)
00716 
00717 // 8 Attribute Structures
00718 
00719 // Table 29 - TPMA_ALGORITHM Bits
00720 typedef struct {
00721   UINT32 asymmetric    : 1;
00722   UINT32 symmetric     : 1;
00723   UINT32 hash          : 1;
00724   UINT32 object        : 1;
00725   UINT32 reserved4_7   : 4;
00726   UINT32 signing       : 1;
00727   UINT32 encrypting    : 1;
00728   UINT32 method        : 1;
00729   UINT32 reserved11_31 : 21;
00730 } TPMA_ALGORITHM;
00731 
00732 // Table 30 - TPMA_OBJECT Bits
00733 typedef struct {
00734   UINT32 reserved1            : 1;
00735   UINT32 fixedTPM             : 1;
00736   UINT32 stClear              : 1;
00737   UINT32 reserved4            : 1;
00738   UINT32 fixedParent          : 1;
00739   UINT32 sensitiveDataOrigin  : 1;
00740   UINT32 userWithAuth         : 1;
00741   UINT32 adminWithPolicy      : 1;
00742   UINT32 reserved8_9          : 2;
00743   UINT32 noDA                 : 1;
00744   UINT32 encryptedDuplication : 1;
00745   UINT32 reserved12_15        : 4;
00746   UINT32 restricted           : 1;
00747   UINT32 decrypt              : 1;
00748   UINT32 sign                 : 1;
00749   UINT32 reserved19_31        : 13;
00750 } TPMA_OBJECT;
00751 
00752 // Table 31 - TPMA_SESSION Bits
00753 typedef struct {
00754   UINT8 continueSession : 1;
00755   UINT8 auditExclusive  : 1;
00756   UINT8 auditReset      : 1;
00757   UINT8 reserved3_4     : 2;
00758   UINT8 decrypt         : 1;
00759   UINT8 encrypt         : 1;
00760   UINT8 audit           : 1;
00761 } TPMA_SESSION;
00762 
00763 // Table 32 - TPMA_LOCALITY Bits
00764 //
00765 // NOTE: Use low case here to resolve conflict
00766 //
00767 typedef struct {
00768   UINT8 locZero  : 1;
00769   UINT8 locOne   : 1;
00770   UINT8 locTwo   : 1;
00771   UINT8 locThree : 1;
00772   UINT8 locFour  : 1;
00773   UINT8 Extended : 3;
00774 } TPMA_LOCALITY;
00775 
00776 // Table 33 - TPMA_PERMANENT Bits
00777 typedef struct {
00778   UINT32 ownerAuthSet       : 1;
00779   UINT32 endorsementAuthSet : 1;
00780   UINT32 lockoutAuthSet     : 1;
00781   UINT32 reserved3_7        : 5;
00782   UINT32 disableClear       : 1;
00783   UINT32 inLockout          : 1;
00784   UINT32 tpmGeneratedEPS    : 1;
00785   UINT32 reserved11_31      : 21;
00786 } TPMA_PERMANENT;
00787 
00788 // Table 34 - TPMA_STARTUP_CLEAR Bits
00789 typedef struct {
00790   UINT32 phEnable     : 1;
00791   UINT32 shEnable     : 1;
00792   UINT32 ehEnable     : 1;
00793   UINT32 reserved3_30 : 28;
00794   UINT32 orderly      : 1;
00795 } TPMA_STARTUP_CLEAR;
00796 
00797 // Table 35 - TPMA_MEMORY Bits
00798 typedef struct {
00799   UINT32 sharedRAM         : 1;
00800   UINT32 sharedNV          : 1;
00801   UINT32 objectCopiedToRam : 1;
00802   UINT32 reserved3_31      : 29;
00803 } TPMA_MEMORY;
00804 
00805 // Table 36 - TPMA_CC Bits
00806 typedef struct {
00807   UINT32 commandIndex  : 16;
00808   UINT32 reserved16_21 : 6;
00809   UINT32 nv            : 1;
00810   UINT32 extensive     : 1;
00811   UINT32 flushed       : 1;
00812   UINT32 cHandles      : 3;
00813   UINT32 rHandle       : 1;
00814   UINT32 V             : 1;
00815   UINT32 Res           : 2;
00816 } TPMA_CC;
00817 
00818 // 9 Interface Types
00819 
00820 // Table 37 - TPMI_YES_NO Type
00821 typedef BYTE TPMI_YES_NO;
00822 
00823 // Table 38 - TPMI_DH_OBJECT Type
00824 typedef TPM_HANDLE TPMI_DH_OBJECT;
00825 
00826 // Table 39 - TPMI_DH_PERSISTENT Type
00827 typedef TPM_HANDLE TPMI_DH_PERSISTENT;
00828 
00829 // Table 40 - TPMI_DH_ENTITY Type
00830 typedef TPM_HANDLE TPMI_DH_ENTITY;
00831 
00832 // Table 41 - TPMI_DH_PCR Type
00833 typedef TPM_HANDLE TPMI_DH_PCR;
00834 
00835 // Table 42 - TPMI_SH_AUTH_SESSION Type
00836 typedef TPM_HANDLE TPMI_SH_AUTH_SESSION;
00837 
00838 // Table 43 - TPMI_SH_HMAC Type
00839 typedef TPM_HANDLE TPMI_SH_HMAC;
00840 
00841 // Table 44 - TPMI_SH_POLICY Type
00842 typedef TPM_HANDLE TPMI_SH_POLICY;
00843 
00844 // Table 45 - TPMI_DH_CONTEXT Type
00845 typedef TPM_HANDLE TPMI_DH_CONTEXT;
00846 
00847 // Table 46 - TPMI_RH_HIERARCHY Type
00848 typedef TPM_HANDLE TPMI_RH_HIERARCHY;
00849 
00850 // Table 47 - TPMI_RH_HIERARCHY_AUTH Type
00851 typedef TPM_HANDLE TPMI_RH_HIERARCHY_AUTH;
00852 
00853 // Table 48 - TPMI_RH_PLATFORM Type
00854 typedef TPM_HANDLE TPMI_RH_PLATFORM;
00855 
00856 // Table 49 - TPMI_RH_OWNER Type
00857 typedef TPM_HANDLE TPMI_RH_OWNER;
00858 
00859 // Table 50 - TPMI_RH_ENDORSEMENT Type
00860 typedef TPM_HANDLE TPMI_RH_ENDORSEMENT;
00861 
00862 // Table 51 - TPMI_RH_PROVISION Type
00863 typedef TPM_HANDLE TPMI_RH_PROVISION;
00864 
00865 // Table 52 - TPMI_RH_CLEAR Type
00866 typedef TPM_HANDLE TPMI_RH_CLEAR;
00867 
00868 // Table 53 - TPMI_RH_NV_AUTH Type
00869 typedef TPM_HANDLE TPMI_RH_NV_AUTH;
00870 
00871 // Table 54 - TPMI_RH_LOCKOUT Type
00872 typedef TPM_HANDLE TPMI_RH_LOCKOUT;
00873 
00874 // Table 55 - TPMI_RH_NV_INDEX Type
00875 typedef TPM_HANDLE TPMI_RH_NV_INDEX;
00876 
00877 // Table 56 - TPMI_ALG_HASH Type
00878 typedef TPM_ALG_ID TPMI_ALG_HASH;
00879 
00880 // Table 57 - TPMI_ALG_ASYM Type
00881 typedef TPM_ALG_ID TPMI_ALG_ASYM;
00882 
00883 // Table 58 - TPMI_ALG_SYM Type
00884 typedef TPM_ALG_ID TPMI_ALG_SYM;
00885 
00886 // Table 59 - TPMI_ALG_SYM_OBJECT Type
00887 typedef TPM_ALG_ID TPMI_ALG_SYM_OBJECT;
00888 
00889 // Table 60 - TPMI_ALG_SYM_MODE Type
00890 typedef TPM_ALG_ID TPMI_ALG_SYM_MODE;
00891 
00892 // Table 61 - TPMI_ALG_KDF Type
00893 typedef TPM_ALG_ID TPMI_ALG_KDF;
00894 
00895 // Table 62 - TPMI_ALG_SIG_SCHEME Type
00896 typedef TPM_ALG_ID TPMI_ALG_SIG_SCHEME;
00897 
00898 // Table 63 - TPMI_ECC_KEY_EXCHANGE Type
00899 typedef TPM_ALG_ID TPMI_ECC_KEY_EXCHANGE;
00900 
00901 // Table 64 - TPMI_ST_COMMAND_TAG Type
00902 typedef TPM_ST TPMI_ST_COMMAND_TAG;
00903 
00904 // 10 Structure Definitions
00905 
00906 // Table 65 - TPMS_ALGORITHM_DESCRIPTION Structure
00907 typedef struct {
00908   TPM_ALG_ID     alg;
00909   TPMA_ALGORITHM attributes;
00910 } TPMS_ALGORITHM_DESCRIPTION;
00911 
00912 // Table 66 - TPMU_HA Union
00913 typedef union {
00914   BYTE sha1[SHA1_DIGEST_SIZE];
00915   BYTE sha256[SHA256_DIGEST_SIZE];
00916   BYTE sm3_256[SM3_256_DIGEST_SIZE];
00917   BYTE sha384[SHA384_DIGEST_SIZE];
00918   BYTE sha512[SHA512_DIGEST_SIZE];
00919 } TPMU_HA;
00920 
00921 // Table 67 - TPMT_HA Structure
00922 typedef struct {
00923   TPMI_ALG_HASH hashAlg;
00924   TPMU_HA       digest;
00925 } TPMT_HA;
00926 
00927 // Table 68 - TPM2B_DIGEST Structure
00928 typedef struct {
00929   UINT16 size;
00930   BYTE   buffer[sizeof(TPMU_HA)];
00931 } TPM2B_DIGEST;
00932 
00933 // Table 69 - TPM2B_DATA Structure
00934 typedef struct {
00935   UINT16 size;
00936   BYTE   buffer[sizeof(TPMT_HA)];
00937 } TPM2B_DATA;
00938 
00939 // Table 70 - TPM2B_NONCE Types
00940 typedef TPM2B_DIGEST TPM2B_NONCE;
00941 
00942 // Table 71 - TPM2B_AUTH Types
00943 typedef TPM2B_DIGEST TPM2B_AUTH;
00944 
00945 // Table 72 - TPM2B_OPERAND Types
00946 typedef TPM2B_DIGEST TPM2B_OPERAND;
00947 
00948 // Table 73 - TPM2B_EVENT Structure
00949 typedef struct {
00950   UINT16 size;
00951   BYTE   buffer[1024];
00952 } TPM2B_EVENT;
00953 
00954 // Table 74 - TPM2B_MAX_BUFFER Structure
00955 typedef struct {
00956   UINT16 size;
00957   BYTE   buffer[MAX_DIGEST_BUFFER];
00958 } TPM2B_MAX_BUFFER;
00959 
00960 // Table 75 - TPM2B_MAX_NV_BUFFER Structure
00961 typedef struct {
00962   UINT16 size;
00963   BYTE   buffer[MAX_NV_INDEX_SIZE];
00964 } TPM2B_MAX_NV_BUFFER;
00965 
00966 // Table 76 - TPM2B_TIMEOUT Structure
00967 typedef struct {
00968   UINT16 size;
00969   BYTE   buffer[sizeof(UINT64)];
00970 } TPM2B_TIMEOUT;
00971 
00972 // Table 77 -- TPM2B_IV Structure <I/O>
00973 typedef struct {
00974   UINT16 size;
00975   BYTE   buffer[MAX_SYM_BLOCK_SIZE];
00976 } TPM2B_IV;
00977 
00978 // Table 78 - TPMU_NAME Union
00979 typedef union {
00980   TPMT_HA    digest;
00981   TPM_HANDLE handle;
00982 } TPMU_NAME;
00983 
00984 // Table 79 - TPM2B_NAME Structure
00985 typedef struct {
00986   UINT16 size;
00987   BYTE   name[sizeof(TPMU_NAME)];
00988 } TPM2B_NAME;
00989 
00990 // Table 80 - TPMS_PCR_SELECT Structure
00991 typedef struct {
00992   UINT8 sizeofSelect;
00993   BYTE  pcrSelect[PCR_SELECT_MAX];
00994 } TPMS_PCR_SELECT;
00995 
00996 // Table 81 - TPMS_PCR_SELECTION Structure
00997 typedef struct {
00998   TPMI_ALG_HASH hash;
00999   UINT8         sizeofSelect;
01000   BYTE          pcrSelect[PCR_SELECT_MAX];
01001 } TPMS_PCR_SELECTION;
01002 
01003 // Table 84 - TPMT_TK_CREATION Structure
01004 typedef struct {
01005   TPM_ST            tag;
01006   TPMI_RH_HIERARCHY hierarchy;
01007   TPM2B_DIGEST      digest;
01008 } TPMT_TK_CREATION;
01009 
01010 // Table 85 - TPMT_TK_VERIFIED Structure
01011 typedef struct {
01012   TPM_ST            tag;
01013   TPMI_RH_HIERARCHY hierarchy;
01014   TPM2B_DIGEST      digest;
01015 } TPMT_TK_VERIFIED;
01016 
01017 // Table 86 - TPMT_TK_AUTH Structure
01018 typedef struct {
01019   TPM_ST            tag;
01020   TPMI_RH_HIERARCHY hierarchy;
01021   TPM2B_DIGEST      digest;
01022 } TPMT_TK_AUTH;
01023 
01024 // Table 87 - TPMT_TK_HASHCHECK Structure
01025 typedef struct {
01026   TPM_ST            tag;
01027   TPMI_RH_HIERARCHY hierarchy;
01028   TPM2B_DIGEST      digest;
01029 } TPMT_TK_HASHCHECK;
01030 
01031 // Table 88 - TPMS_ALG_PROPERTY Structure
01032 typedef struct {
01033   TPM_ALG_ID     alg;
01034   TPMA_ALGORITHM algProperties;
01035 } TPMS_ALG_PROPERTY;
01036 
01037 // Table 89 - TPMS_TAGGED_PROPERTY Structure
01038 typedef struct {
01039   TPM_PT property;
01040   UINT32 value;
01041 } TPMS_TAGGED_PROPERTY;
01042 
01043 // Table 90 - TPMS_TAGGED_PCR_SELECT Structure
01044 typedef struct {
01045   TPM_PT tag;
01046   UINT8  sizeofSelect;
01047   BYTE   pcrSelect[PCR_SELECT_MAX];
01048 } TPMS_TAGGED_PCR_SELECT;
01049 
01050 // Table 91 - TPML_CC Structure
01051 typedef struct {
01052   UINT32 count;
01053   TPM_CC commandCodes[MAX_CAP_CC];
01054 } TPML_CC;
01055 
01056 // Table 92 - TPML_CCA Structure
01057 typedef struct {
01058   UINT32  count;
01059   TPMA_CC commandAttributes[MAX_CAP_CC];
01060 } TPML_CCA;
01061 
01062 // Table 93 - TPML_ALG Structure
01063 typedef struct {
01064   UINT32     count;
01065   TPM_ALG_ID algorithms[MAX_ALG_LIST_SIZE];
01066 } TPML_ALG;
01067 
01068 // Table 94 - TPML_HANDLE Structure
01069 typedef struct {
01070   UINT32     count;
01071   TPM_HANDLE handle[MAX_CAP_HANDLES];
01072 } TPML_HANDLE;
01073 
01074 // Table 95 - TPML_DIGEST Structure
01075 typedef struct {
01076   UINT32       count;
01077   TPM2B_DIGEST digests[8];
01078 } TPML_DIGEST;
01079 
01080 // Table 96 -- TPML_DIGEST_VALUES Structure <I/O>
01081 typedef struct {
01082   UINT32  count;
01083   TPMT_HA digests[HASH_COUNT];
01084 } TPML_DIGEST_VALUES;
01085 
01086 // Table 97 - TPM2B_DIGEST_VALUES Structure
01087 typedef struct {
01088   UINT16 size;
01089   BYTE   buffer[sizeof(TPML_DIGEST_VALUES)];
01090 } TPM2B_DIGEST_VALUES;
01091 
01092 // Table 98 - TPML_PCR_SELECTION Structure
01093 typedef struct {
01094   UINT32             count;
01095   TPMS_PCR_SELECTION pcrSelections[HASH_COUNT];
01096 } TPML_PCR_SELECTION;
01097 
01098 // Table 99 - TPML_ALG_PROPERTY Structure
01099 typedef struct {
01100   UINT32            count;
01101   TPMS_ALG_PROPERTY algProperties[MAX_CAP_ALGS];
01102 } TPML_ALG_PROPERTY;
01103 
01104 // Table 100 - TPML_TAGGED_TPM_PROPERTY Structure
01105 typedef struct {
01106   UINT32               count;
01107   TPMS_TAGGED_PROPERTY tpmProperty[MAX_TPM_PROPERTIES];
01108 } TPML_TAGGED_TPM_PROPERTY;
01109 
01110 // Table 101 - TPML_TAGGED_PCR_PROPERTY Structure
01111 typedef struct {
01112   UINT32                 count;
01113   TPMS_TAGGED_PCR_SELECT pcrProperty[MAX_PCR_PROPERTIES];
01114 } TPML_TAGGED_PCR_PROPERTY;
01115 
01116 // Table 102 - TPML_ECC_CURVE Structure
01117 typedef struct {
01118   UINT32        count;
01119   TPM_ECC_CURVE eccCurves[MAX_ECC_CURVES];
01120 } TPML_ECC_CURVE;
01121 
01122 // Table 103 - TPMU_CAPABILITIES Union
01123 typedef union {
01124   TPML_ALG_PROPERTY        algorithms;
01125   TPML_HANDLE              handles;
01126   TPML_CCA                 command;
01127   TPML_CC                  ppCommands;
01128   TPML_CC                  auditCommands;
01129   TPML_PCR_SELECTION       assignedPCR;
01130   TPML_TAGGED_TPM_PROPERTY tpmProperties;
01131   TPML_TAGGED_PCR_PROPERTY pcrProperties;
01132   TPML_ECC_CURVE           eccCurves;
01133 } TPMU_CAPABILITIES;
01134 
01135 // Table 104 - TPMS_CAPABILITY_DATA Structure
01136 typedef struct {
01137   TPM_CAP           capability;
01138   TPMU_CAPABILITIES data;
01139 } TPMS_CAPABILITY_DATA;
01140 
01141 // Table 105 - TPMS_CLOCK_INFO Structure
01142 typedef struct {
01143   UINT64      clock;
01144   UINT32      resetCount;
01145   UINT32      restartCount;
01146   TPMI_YES_NO safe;
01147 } TPMS_CLOCK_INFO;
01148 
01149 // Table 106 - TPMS_TIME_INFO Structure
01150 typedef struct {
01151   UINT64          time;
01152   TPMS_CLOCK_INFO clockInfo;
01153 } TPMS_TIME_INFO;
01154 
01155 // Table 107 - TPMS_TIME_ATTEST_INFO Structure
01156 typedef struct {
01157   TPMS_TIME_INFO time;
01158   UINT64         firmwareVersion;
01159 } TPMS_TIME_ATTEST_INFO;
01160 
01161 // Table 108 - TPMS_CERTIFY_INFO Structure
01162 typedef struct {
01163   TPM2B_NAME name;
01164   TPM2B_NAME qualifiedName;
01165 } TPMS_CERTIFY_INFO;
01166 
01167 // Table 109 - TPMS_QUOTE_INFO Structure
01168 typedef struct {
01169   TPML_PCR_SELECTION pcrSelect;
01170   TPM2B_DIGEST       pcrDigest;
01171 } TPMS_QUOTE_INFO;
01172 
01173 // Table 110 - TPMS_COMMAND_AUDIT_INFO Structure
01174 typedef struct {
01175   UINT64       auditCounter;
01176   TPM_ALG_ID   digestAlg;
01177   TPM2B_DIGEST auditDigest;
01178   TPM2B_DIGEST commandDigest;
01179 } TPMS_COMMAND_AUDIT_INFO;
01180 
01181 // Table 111 - TPMS_SESSION_AUDIT_INFO Structure
01182 typedef struct {
01183   TPMI_YES_NO  exclusiveSession;
01184   TPM2B_DIGEST sessionDigest;
01185 } TPMS_SESSION_AUDIT_INFO;
01186 
01187 // Table 112 - TPMS_CREATION_INFO Structure
01188 typedef struct {
01189   TPM2B_NAME   objectName;
01190   TPM2B_DIGEST creationHash;
01191 } TPMS_CREATION_INFO;
01192 
01193 // Table 113 - TPMS_NV_CERTIFY_INFO Structure
01194 typedef struct {
01195   TPM2B_NAME          indexName;
01196   UINT16              offset;
01197   TPM2B_MAX_NV_BUFFER nvContents;
01198 } TPMS_NV_CERTIFY_INFO;
01199 
01200 // Table 114 - TPMI_ST_ATTEST Type
01201 typedef TPM_ST TPMI_ST_ATTEST;
01202 
01203 // Table 115 - TPMU_ATTEST Union
01204 typedef union {
01205   TPMS_CERTIFY_INFO       certify;
01206   TPMS_CREATION_INFO      creation;
01207   TPMS_QUOTE_INFO         quote;
01208   TPMS_COMMAND_AUDIT_INFO commandAudit;
01209   TPMS_SESSION_AUDIT_INFO sessionAudit;
01210   TPMS_TIME_ATTEST_INFO   time;
01211   TPMS_NV_CERTIFY_INFO    nv;
01212 } TPMU_ATTEST;
01213 
01214 // Table 116 - TPMS_ATTEST Structure
01215 typedef struct {
01216   TPM_GENERATED   magic;
01217   TPMI_ST_ATTEST  type;
01218   TPM2B_NAME      qualifiedSigner;
01219   TPM2B_DATA      extraData;
01220   TPMS_CLOCK_INFO clockInfo;
01221   UINT64          firmwareVersion;
01222   TPMU_ATTEST     attested;
01223 } TPMS_ATTEST;
01224 
01225 // Table 117 - TPM2B_ATTEST Structure
01226 typedef struct {
01227   UINT16 size;
01228   BYTE   attestationData[sizeof(TPMS_ATTEST)];
01229 } TPM2B_ATTEST;
01230 
01231 // Table 118 - TPMS_AUTH_COMMAND Structure
01232 typedef struct {
01233   TPMI_SH_AUTH_SESSION sessionHandle;
01234   TPM2B_NONCE          nonce;
01235   TPMA_SESSION         sessionAttributes;
01236   TPM2B_AUTH           hmac;
01237 } TPMS_AUTH_COMMAND;
01238 
01239 // Table 119 - TPMS_AUTH_RESPONSE Structure
01240 typedef struct {
01241   TPM2B_NONCE  nonce;
01242   TPMA_SESSION sessionAttributes;
01243   TPM2B_AUTH   hmac;
01244 } TPMS_AUTH_RESPONSE;
01245 
01246 // 11 Algorithm Parameters and Structures
01247 
01248 // Table 120 - TPMI_AES_KEY_BITS Type
01249 typedef TPM_KEY_BITS TPMI_AES_KEY_BITS;
01250 
01251 // Table 121 - TPMI_SM4_KEY_BITS Type
01252 typedef TPM_KEY_BITS TPMI_SM4_KEY_BITS;
01253 
01254 // Table 122 - TPMU_SYM_KEY_BITS Union
01255 typedef union {
01256   TPMI_AES_KEY_BITS aes;
01257   TPMI_SM4_KEY_BITS SM4;
01258   TPM_KEY_BITS      sym;
01259   TPMI_ALG_HASH     xor;
01260 } TPMU_SYM_KEY_BITS;
01261 
01262 // Table 123 - TPMU_SYM_MODE Union
01263 typedef union {
01264   TPMI_ALG_SYM_MODE aes;
01265   TPMI_ALG_SYM_MODE SM4;
01266   TPMI_ALG_SYM_MODE sym;
01267 } TPMU_SYM_MODE;
01268 
01269 // Table 125 - TPMT_SYM_DEF Structure
01270 typedef struct {
01271   TPMI_ALG_SYM      algorithm;
01272   TPMU_SYM_KEY_BITS keyBits;
01273   TPMU_SYM_MODE     mode;
01274 } TPMT_SYM_DEF;
01275 
01276 // Table 126 - TPMT_SYM_DEF_OBJECT Structure
01277 typedef struct {
01278   TPMI_ALG_SYM_OBJECT algorithm;
01279   TPMU_SYM_KEY_BITS   keyBits;
01280   TPMU_SYM_MODE       mode;
01281 } TPMT_SYM_DEF_OBJECT;
01282 
01283 // Table 127 - TPM2B_SYM_KEY Structure
01284 typedef struct {
01285   UINT16 size;
01286   BYTE   buffer[MAX_SYM_KEY_BYTES];
01287 } TPM2B_SYM_KEY;
01288 
01289 // Table 128 - TPMS_SYMCIPHER_PARMS Structure
01290 typedef struct {
01291   TPMT_SYM_DEF_OBJECT sym;
01292 } TPMS_SYMCIPHER_PARMS;
01293 
01294 // Table 129 - TPM2B_SENSITIVE_DATA Structure
01295 typedef struct {
01296   UINT16 size;
01297   BYTE   buffer[MAX_SYM_DATA];
01298 } TPM2B_SENSITIVE_DATA;
01299 
01300 // Table 130 - TPMS_SENSITIVE_CREATE Structure
01301 typedef struct {
01302   TPM2B_AUTH           userAuth;
01303   TPM2B_SENSITIVE_DATA data;
01304 } TPMS_SENSITIVE_CREATE;
01305 
01306 // Table 131 - TPM2B_SENSITIVE_CREATE Structure
01307 typedef struct {
01308   UINT16                size;
01309   TPMS_SENSITIVE_CREATE sensitive;
01310 } TPM2B_SENSITIVE_CREATE;
01311 
01312 // Table 132 - TPMS_SCHEME_SIGHASH Structure
01313 typedef struct {
01314   TPMI_ALG_HASH hashAlg;
01315 } TPMS_SCHEME_SIGHASH;
01316 
01317 // Table 133 - TPMI_ALG_KEYEDHASH_SCHEME Type
01318 typedef TPM_ALG_ID TPMI_ALG_KEYEDHASH_SCHEME;
01319 
01320 // Table 134 - HMAC_SIG_SCHEME Types
01321 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_HMAC;
01322 
01323 // Table 135 - TPMS_SCHEME_XOR Structure
01324 typedef struct {
01325   TPMI_ALG_HASH hashAlg;
01326   TPMI_ALG_KDF  kdf;
01327 } TPMS_SCHEME_XOR;
01328 
01329 // Table 136 - TPMU_SCHEME_KEYEDHASH Union
01330 typedef union {
01331   TPMS_SCHEME_HMAC hmac;
01332   TPMS_SCHEME_XOR  xor;
01333 } TPMU_SCHEME_KEYEDHASH;
01334 
01335 // Table 137 - TPMT_KEYEDHASH_SCHEME Structure
01336 typedef struct {
01337   TPMI_ALG_KEYEDHASH_SCHEME scheme;
01338   TPMU_SCHEME_KEYEDHASH     details;
01339 } TPMT_KEYEDHASH_SCHEME;
01340 
01341 // Table 138 - RSA_SIG_SCHEMES Types
01342 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSASSA;
01343 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSAPSS;
01344 
01345 // Table 139 - ECC_SIG_SCHEMES Types
01346 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_ECDSA;
01347 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_SM2;
01348 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_ECSCHNORR;
01349 
01350 // Table 140 - TPMS_SCHEME_ECDAA Structure
01351 typedef struct {
01352   TPMI_ALG_HASH hashAlg;
01353   UINT16        count;
01354 } TPMS_SCHEME_ECDAA;
01355 
01356 // Table 141 - TPMU_SIG_SCHEME Union
01357 typedef union {
01358   TPMS_SCHEME_RSASSA    rsassa;
01359   TPMS_SCHEME_RSAPSS    rsapss;
01360   TPMS_SCHEME_ECDSA     ecdsa;
01361   TPMS_SCHEME_ECDAA     ecdaa;
01362   TPMS_SCHEME_ECSCHNORR ecSchnorr;
01363   TPMS_SCHEME_HMAC      hmac;
01364   TPMS_SCHEME_SIGHASH   any;
01365 } TPMU_SIG_SCHEME;
01366 
01367 // Table 142 - TPMT_SIG_SCHEME Structure
01368 typedef struct {
01369   TPMI_ALG_SIG_SCHEME scheme;
01370   TPMU_SIG_SCHEME     details;
01371 } TPMT_SIG_SCHEME;
01372 
01373 // Table 143 - TPMS_SCHEME_OAEP Structure
01374 typedef struct {
01375   TPMI_ALG_HASH hashAlg;
01376 } TPMS_SCHEME_OAEP;
01377 
01378 // Table 144 - TPMS_SCHEME_ECDH Structure
01379 typedef struct {
01380   TPMI_ALG_HASH hashAlg;
01381 } TPMS_SCHEME_ECDH;
01382 
01383 // Table 145 - TPMS_SCHEME_MGF1 Structure
01384 typedef struct {
01385   TPMI_ALG_HASH hashAlg;
01386 } TPMS_SCHEME_MGF1;
01387 
01388 // Table 146 - TPMS_SCHEME_KDF1_SP800_56a Structure
01389 typedef struct {
01390   TPMI_ALG_HASH hashAlg;
01391 } TPMS_SCHEME_KDF1_SP800_56a;
01392 
01393 // Table 147 - TPMS_SCHEME_KDF2 Structure
01394 typedef struct {
01395   TPMI_ALG_HASH hashAlg;
01396 } TPMS_SCHEME_KDF2;
01397 
01398 // Table 148 - TPMS_SCHEME_KDF1_SP800_108 Structure
01399 typedef struct {
01400   TPMI_ALG_HASH hashAlg;
01401 } TPMS_SCHEME_KDF1_SP800_108;
01402 
01403 // Table 149 - TPMU_KDF_SCHEME Union
01404 typedef union {
01405   TPMS_SCHEME_MGF1           mgf1;
01406   TPMS_SCHEME_KDF1_SP800_56a kdf1_SP800_56a;
01407   TPMS_SCHEME_KDF2           kdf2;
01408   TPMS_SCHEME_KDF1_SP800_108 kdf1_sp800_108;
01409 } TPMU_KDF_SCHEME;
01410 
01411 // Table 150 - TPMT_KDF_SCHEME Structure
01412 typedef struct {
01413   TPMI_ALG_KDF    scheme;
01414   TPMU_KDF_SCHEME details;
01415 } TPMT_KDF_SCHEME;
01416 
01417 // Table 151 - TPMI_ALG_ASYM_SCHEME Type
01418 typedef TPM_ALG_ID TPMI_ALG_ASYM_SCHEME;
01419 
01420 // Table 152 - TPMU_ASYM_SCHEME Union
01421 typedef union {
01422   TPMS_SCHEME_RSASSA    rsassa;
01423   TPMS_SCHEME_RSAPSS    rsapss;
01424   TPMS_SCHEME_OAEP      oaep;
01425   TPMS_SCHEME_ECDSA     ecdsa;
01426   TPMS_SCHEME_ECDAA     ecdaa;
01427   TPMS_SCHEME_ECSCHNORR ecSchnorr;
01428   TPMS_SCHEME_SIGHASH   anySig;
01429 } TPMU_ASYM_SCHEME;
01430 
01431 // Table 153 - TPMT_ASYM_SCHEME Structure
01432 typedef struct {
01433   TPMI_ALG_ASYM_SCHEME scheme;
01434   TPMU_ASYM_SCHEME     details;
01435 } TPMT_ASYM_SCHEME;
01436 
01437 // Table 154 - TPMI_ALG_RSA_SCHEME Type
01438 typedef TPM_ALG_ID TPMI_ALG_RSA_SCHEME;
01439 
01440 // Table 155 - TPMT_RSA_SCHEME Structure
01441 typedef struct {
01442   TPMI_ALG_RSA_SCHEME scheme;
01443   TPMU_ASYM_SCHEME    details;
01444 } TPMT_RSA_SCHEME;
01445 
01446 // Table 156 - TPMI_ALG_RSA_DECRYPT Type
01447 typedef TPM_ALG_ID TPMI_ALG_RSA_DECRYPT;
01448 
01449 // Table 157 - TPMT_RSA_DECRYPT Structure
01450 typedef struct {
01451   TPMI_ALG_RSA_DECRYPT scheme;
01452   TPMU_ASYM_SCHEME     details;
01453 } TPMT_RSA_DECRYPT;
01454 
01455 // Table 158 - TPM2B_PUBLIC_KEY_RSA Structure
01456 typedef struct {
01457   UINT16 size;
01458   BYTE   buffer[MAX_RSA_KEY_BYTES];
01459 } TPM2B_PUBLIC_KEY_RSA;
01460 
01461 // Table 159 - TPMI_RSA_KEY_BITS Type
01462 typedef TPM_KEY_BITS TPMI_RSA_KEY_BITS;
01463 
01464 // Table 160 - TPM2B_PRIVATE_KEY_RSA Structure
01465 typedef struct {
01466   UINT16 size;
01467   BYTE   buffer[MAX_RSA_KEY_BYTES/2];
01468 } TPM2B_PRIVATE_KEY_RSA;
01469 
01470 // Table 161 - TPM2B_ECC_PARAMETER Structure
01471 typedef struct {
01472   UINT16 size;
01473   BYTE   buffer[MAX_ECC_KEY_BYTES];
01474 } TPM2B_ECC_PARAMETER;
01475 
01476 // Table 162 - TPMS_ECC_POINT Structure
01477 typedef struct {
01478   TPM2B_ECC_PARAMETER x;
01479   TPM2B_ECC_PARAMETER y;
01480 } TPMS_ECC_POINT;
01481 
01482 // Table 163 -- TPM2B_ECC_POINT Structure <I/O>
01483 typedef struct {
01484   UINT16         size;
01485   TPMS_ECC_POINT point;
01486 } TPM2B_ECC_POINT;
01487 
01488 // Table 164 - TPMI_ALG_ECC_SCHEME Type
01489 typedef TPM_ALG_ID TPMI_ALG_ECC_SCHEME;
01490 
01491 // Table 165 - TPMI_ECC_CURVE Type
01492 typedef TPM_ECC_CURVE TPMI_ECC_CURVE;
01493 
01494 // Table 166 - TPMT_ECC_SCHEME Structure
01495 typedef struct {
01496   TPMI_ALG_ECC_SCHEME scheme;
01497   TPMU_SIG_SCHEME     details;
01498 } TPMT_ECC_SCHEME;
01499 
01500 // Table 167 - TPMS_ALGORITHM_DETAIL_ECC Structure
01501 typedef struct {
01502   TPM_ECC_CURVE       curveID;
01503   UINT16              keySize;
01504   TPMT_KDF_SCHEME     kdf;
01505   TPMT_ECC_SCHEME     sign;
01506   TPM2B_ECC_PARAMETER p;
01507   TPM2B_ECC_PARAMETER a;
01508   TPM2B_ECC_PARAMETER b;
01509   TPM2B_ECC_PARAMETER gX;
01510   TPM2B_ECC_PARAMETER gY;
01511   TPM2B_ECC_PARAMETER n;
01512   TPM2B_ECC_PARAMETER h;
01513 } TPMS_ALGORITHM_DETAIL_ECC;
01514 
01515 // Table 168 - TPMS_SIGNATURE_RSASSA Structure
01516 typedef struct {
01517   TPMI_ALG_HASH        hash;
01518   TPM2B_PUBLIC_KEY_RSA sig;
01519 } TPMS_SIGNATURE_RSASSA;
01520 
01521 // Table 169 - TPMS_SIGNATURE_RSAPSS Structure
01522 typedef struct {
01523   TPMI_ALG_HASH        hash;
01524   TPM2B_PUBLIC_KEY_RSA sig;
01525 } TPMS_SIGNATURE_RSAPSS;
01526 
01527 // Table 170 - TPMS_SIGNATURE_ECDSA Structure
01528 typedef struct {
01529   TPMI_ALG_HASH       hash;
01530   TPM2B_ECC_PARAMETER signatureR;
01531   TPM2B_ECC_PARAMETER signatureS;
01532 } TPMS_SIGNATURE_ECDSA;
01533 
01534 // Table 171 - TPMU_SIGNATURE Union
01535 typedef union {
01536   TPMS_SIGNATURE_RSASSA rsassa;
01537   TPMS_SIGNATURE_RSAPSS rsapss;
01538   TPMS_SIGNATURE_ECDSA  ecdsa;
01539   TPMS_SIGNATURE_ECDSA  sm2;
01540   TPMS_SIGNATURE_ECDSA  ecdaa;
01541   TPMS_SIGNATURE_ECDSA  ecschnorr;
01542   TPMT_HA               hmac;
01543   TPMS_SCHEME_SIGHASH   any;
01544 } TPMU_SIGNATURE;
01545 
01546 // Table 172 - TPMT_SIGNATURE Structure
01547 typedef struct {
01548   TPMI_ALG_SIG_SCHEME sigAlg;
01549   TPMU_SIGNATURE      signature;
01550 } TPMT_SIGNATURE;
01551 
01552 // Table 173 - TPMU_ENCRYPTED_SECRET Union
01553 typedef union {
01554   BYTE ecc[sizeof(TPMS_ECC_POINT)];
01555   BYTE rsa[MAX_RSA_KEY_BYTES];
01556   BYTE symmetric[sizeof(TPM2B_DIGEST)];
01557   BYTE keyedHash[sizeof(TPM2B_DIGEST)];
01558 } TPMU_ENCRYPTED_SECRET;
01559 
01560 // Table 174 - TPM2B_ENCRYPTED_SECRET Structure
01561 typedef struct {
01562   UINT16 size;
01563   BYTE   secret[sizeof(TPMU_ENCRYPTED_SECRET)];
01564 } TPM2B_ENCRYPTED_SECRET;
01565 
01566 // 12 Key/Object Complex
01567 
01568 // Table 175 - TPMI_ALG_PUBLIC Type
01569 typedef TPM_ALG_ID TPMI_ALG_PUBLIC;
01570 
01571 // Table 176 - TPMU_PUBLIC_ID Union
01572 typedef union {
01573   TPM2B_DIGEST         keyedHash;
01574   TPM2B_DIGEST         sym;
01575   TPM2B_PUBLIC_KEY_RSA rsa;
01576   TPMS_ECC_POINT       ecc;
01577 } TPMU_PUBLIC_ID;
01578 
01579 // Table 177 - TPMS_KEYEDHASH_PARMS Structure
01580 typedef struct {
01581   TPMT_KEYEDHASH_SCHEME scheme;
01582 } TPMS_KEYEDHASH_PARMS;
01583 
01584 // Table 178 - TPMS_ASYM_PARMS Structure
01585 typedef struct {
01586   TPMT_SYM_DEF_OBJECT symmetric;
01587   TPMT_ASYM_SCHEME    scheme;
01588 } TPMS_ASYM_PARMS;
01589 
01590 // Table 179 - TPMS_RSA_PARMS Structure
01591 typedef struct {
01592   TPMT_SYM_DEF_OBJECT symmetric;
01593   TPMT_RSA_SCHEME     scheme;
01594   TPMI_RSA_KEY_BITS   keyBits;
01595   UINT32              exponent;
01596 } TPMS_RSA_PARMS;
01597 
01598 // Table 180 - TPMS_ECC_PARMS Structure
01599 typedef struct {
01600   TPMT_SYM_DEF_OBJECT symmetric;
01601   TPMT_ECC_SCHEME     scheme;
01602   TPMI_ECC_CURVE      curveID;
01603   TPMT_KDF_SCHEME     kdf;
01604 } TPMS_ECC_PARMS;
01605 
01606 // Table 181 - TPMU_PUBLIC_PARMS Union
01607 typedef union {
01608   TPMS_KEYEDHASH_PARMS keyedHashDetail;
01609   TPMT_SYM_DEF_OBJECT  symDetail;
01610   TPMS_RSA_PARMS       rsaDetail;
01611   TPMS_ECC_PARMS       eccDetail;
01612   TPMS_ASYM_PARMS      asymDetail;
01613 } TPMU_PUBLIC_PARMS;
01614 
01615 // Table 182 - TPMT_PUBLIC_PARMS Structure
01616 typedef struct {
01617   TPMI_ALG_PUBLIC   type;
01618   TPMU_PUBLIC_PARMS parameters;
01619 } TPMT_PUBLIC_PARMS;
01620 
01621 // Table 183 - TPMT_PUBLIC Structure
01622 typedef struct {
01623   TPMI_ALG_PUBLIC   type;
01624   TPMI_ALG_HASH     nameAlg;
01625   TPMA_OBJECT       objectAttributes;
01626   TPM2B_DIGEST      authPolicy;
01627   TPMU_PUBLIC_PARMS parameters;
01628   TPMU_PUBLIC_ID    unique;
01629 } TPMT_PUBLIC;
01630 
01631 // Table 184 - TPM2B_PUBLIC Structure
01632 typedef struct {
01633   UINT16      size;
01634   TPMT_PUBLIC publicArea;
01635 } TPM2B_PUBLIC;
01636 
01637 // Table 185 - TPM2B_PRIVATE_VENDOR_SPECIFIC Structure
01638 typedef struct {
01639   UINT16 size;
01640   BYTE   buffer[PRIVATE_VENDOR_SPECIFIC_BYTES];
01641 } TPM2B_PRIVATE_VENDOR_SPECIFIC;
01642 
01643 // Table 186 - TPMU_SENSITIVE_COMPOSITE Union
01644 typedef union {
01645   TPM2B_PRIVATE_KEY_RSA         rsa;
01646   TPM2B_ECC_PARAMETER           ecc;
01647   TPM2B_SENSITIVE_DATA          bits;
01648   TPM2B_SYM_KEY                 sym;
01649   TPM2B_PRIVATE_VENDOR_SPECIFIC any;
01650 } TPMU_SENSITIVE_COMPOSITE;
01651 
01652 // Table 187 - TPMT_SENSITIVE Structure
01653 typedef struct {
01654   TPMI_ALG_PUBLIC          sensitiveType;
01655   TPM2B_AUTH               authValue;
01656   TPM2B_DIGEST             seedValue;
01657   TPMU_SENSITIVE_COMPOSITE sensitive;
01658 } TPMT_SENSITIVE;
01659 
01660 // Table 188 - TPM2B_SENSITIVE Structure
01661 typedef struct {
01662   UINT16         size;
01663   TPMT_SENSITIVE sensitiveArea;
01664 } TPM2B_SENSITIVE;
01665 
01666 // Table 189 - _PRIVATE Structure
01667 typedef struct {
01668   TPM2B_DIGEST   integrityOuter;
01669   TPM2B_DIGEST   integrityInner;
01670   TPMT_SENSITIVE sensitive;
01671 } _PRIVATE;
01672 
01673 // Table 190 - TPM2B_PRIVATE Structure
01674 typedef struct {
01675   UINT16 size;
01676   BYTE   buffer[sizeof(_PRIVATE)];
01677 } TPM2B_PRIVATE;
01678 
01679 // Table 191 - _ID_OBJECT Structure
01680 typedef struct {
01681   TPM2B_DIGEST integrityHMAC;
01682   TPM2B_DIGEST encIdentity;
01683 } _ID_OBJECT;
01684 
01685 // Table 192 - TPM2B_ID_OBJECT Structure
01686 typedef struct {
01687   UINT16 size;
01688   BYTE   credential[sizeof(_ID_OBJECT)];
01689 } TPM2B_ID_OBJECT;
01690 
01691 // 13 NV Storage Structures
01692 
01693 // Table 193 - TPM_NV_INDEX Bits
01694 //
01695 // NOTE: Comment here to resolve conflict
01696 //
01697 //typedef struct {
01698 //  UINT32 index : 22;
01699 //  UINT32 space : 2;
01700 //  UINT32 RH_NV : 8;
01701 //} TPM_NV_INDEX;
01702 
01703 // Table 195 - TPMA_NV Bits
01704 typedef struct {
01705   UINT32 TPMA_NV_PPWRITE        : 1;
01706   UINT32 TPMA_NV_OWNERWRITE     : 1;
01707   UINT32 TPMA_NV_AUTHWRITE      : 1;
01708   UINT32 TPMA_NV_POLICYWRITE    : 1;
01709   UINT32 TPMA_NV_COUNTER        : 1;
01710   UINT32 TPMA_NV_BITS           : 1;
01711   UINT32 TPMA_NV_EXTEND         : 1;
01712   UINT32 reserved7_9            : 3;
01713   UINT32 TPMA_NV_POLICY_DELETE  : 1;
01714   UINT32 TPMA_NV_WRITELOCKED    : 1;
01715   UINT32 TPMA_NV_WRITEALL       : 1;
01716   UINT32 TPMA_NV_WRITEDEFINE    : 1;
01717   UINT32 TPMA_NV_WRITE_STCLEAR  : 1;
01718   UINT32 TPMA_NV_GLOBALLOCK     : 1;
01719   UINT32 TPMA_NV_PPREAD         : 1;
01720   UINT32 TPMA_NV_OWNERREAD      : 1;
01721   UINT32 TPMA_NV_AUTHREAD       : 1;
01722   UINT32 TPMA_NV_POLICYREAD     : 1;
01723   UINT32 reserved20_24          : 5;
01724   UINT32 TPMA_NV_NO_DA          : 1;
01725   UINT32 TPMA_NV_ORDERLY        : 1;
01726   UINT32 TPMA_NV_CLEAR_STCLEAR  : 1;
01727   UINT32 TPMA_NV_READLOCKED     : 1;
01728   UINT32 TPMA_NV_WRITTEN        : 1;
01729   UINT32 TPMA_NV_PLATFORMCREATE : 1;
01730   UINT32 TPMA_NV_READ_STCLEAR   : 1;
01731 } TPMA_NV;
01732 
01733 // Table 196 - TPMS_NV_PUBLIC Structure
01734 typedef struct {
01735   TPMI_RH_NV_INDEX nvIndex;
01736   TPMI_ALG_HASH    nameAlg;
01737   TPMA_NV          attributes;
01738   TPM2B_DIGEST     authPolicy;
01739   UINT16           dataSize;
01740 } TPMS_NV_PUBLIC;
01741 
01742 // Table 197 - TPM2B_NV_PUBLIC Structure
01743 typedef struct {
01744   UINT16         size;
01745   TPMS_NV_PUBLIC nvPublic;
01746 } TPM2B_NV_PUBLIC;
01747 
01748 // 14 Context Data
01749 
01750 // Table 198 - TPM2B_CONTEXT_SENSITIVE Structure
01751 typedef struct {
01752   UINT16 size;
01753   BYTE   buffer[MAX_CONTEXT_SIZE];
01754 } TPM2B_CONTEXT_SENSITIVE;
01755 
01756 // Table 199 - TPMS_CONTEXT_DATA Structure
01757 typedef struct {
01758   TPM2B_DIGEST            integrity;
01759   TPM2B_CONTEXT_SENSITIVE encrypted;
01760 } TPMS_CONTEXT_DATA;
01761 
01762 // Table 200 - TPM2B_CONTEXT_DATA Structure
01763 typedef struct {
01764   UINT16 size;
01765   BYTE   buffer[sizeof(TPMS_CONTEXT_DATA)];
01766 } TPM2B_CONTEXT_DATA;
01767 
01768 // Table 201 - TPMS_CONTEXT Structure
01769 typedef struct {
01770   UINT64             sequence;
01771   TPMI_DH_CONTEXT    savedHandle;
01772   TPMI_RH_HIERARCHY  hierarchy;
01773   TPM2B_CONTEXT_DATA contextBlob;
01774 } TPMS_CONTEXT;
01775 
01776 // 15 Creation Data
01777 
01778 // Table 203 - TPMS_CREATION_DATA Structure
01779 typedef struct {
01780   TPML_PCR_SELECTION pcrSelect;
01781   TPM2B_DIGEST       pcrDigest;
01782   TPMA_LOCALITY      locality;
01783   TPM_ALG_ID         parentNameAlg;
01784   TPM2B_NAME         parentName;
01785   TPM2B_NAME         parentQualifiedName;
01786   TPM2B_DATA         outsideInfo;
01787 } TPMS_CREATION_DATA;
01788 
01789 // Table 204 - TPM2B_CREATION_DATA Structure
01790 typedef struct {
01791   UINT16             size;
01792   TPMS_CREATION_DATA creationData;
01793 } TPM2B_CREATION_DATA;
01794 
01795 
01796 //
01797 // Command Header
01798 //
01799 typedef struct {
01800   TPM_ST tag;
01801   UINT32 paramSize;
01802   TPM_CC commandCode;
01803 } TPM2_COMMAND_HEADER;
01804 
01805 typedef struct {
01806   TPM_ST tag;
01807   UINT32 paramSize;
01808   TPM_RC responseCode;
01809 } TPM2_RESPONSE_HEADER;
01810 
01811 #pragma pack ()
01812 
01813 //
01814 // TCG Algorithm Registry
01815 //
01816 #define HASH_ALG_SHA1    0x00000001
01817 #define HASH_ALG_SHA256  0x00000002
01818 #define HASH_ALG_SHA384  0x00000004
01819 #define HASH_ALG_SHA512  0x00000008
01820 #define HASH_ALG_SM3_256 0x00000010
01821 
01822 #endif