github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/src/tpm2/tpm20.h (about) 1 /** @file 2 TPM2.0 Specification data structures 3 (Trusted Platform Module Library Specification, Family "2.0", Level 00, Revision 00.96, 4 @http://www.trustedcomputinggroup.org/resources/tpm_library_specification) 5 6 Check http://trustedcomputinggroup.org for latest specification updates. 7 8 Copyright (c) 2013, Intel Corporation. All rights reserved. <BR> 9 This program and the accompanying materials 10 are licensed and made available under the terms and conditions of the BSD License 11 which accompanies this distribution. The full text of the license may be found at 12 http://opensource.org/licenses/bsd-license.php 13 14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 16 17 **/ 18 19 #ifndef _TPM20_H_ 20 #define _TPM20_H_ 21 22 #include "tpm12.h" 23 24 #pragma pack (1) 25 26 // Annex A Algorithm Constants 27 28 // Table 205 - Defines for SHA1 Hash Values 29 #define SHA1_DIGEST_SIZE 20 30 #define SHA1_BLOCK_SIZE 64 31 32 // Table 206 - Defines for SHA256 Hash Values 33 #define SHA256_DIGEST_SIZE 32 34 #define SHA256_BLOCK_SIZE 64 35 36 // Table 207 - Defines for SHA384 Hash Values 37 #define SHA384_DIGEST_SIZE 48 38 #define SHA384_BLOCK_SIZE 128 39 40 // Table 208 - Defines for SHA512 Hash Values 41 #define SHA512_DIGEST_SIZE 64 42 #define SHA512_BLOCK_SIZE 128 43 44 // Table 209 - Defines for SM3_256 Hash Values 45 #define SM3_256_DIGEST_SIZE 32 46 #define SM3_256_BLOCK_SIZE 64 47 48 // Table 210 - Defines for Architectural Limits Values 49 #define MAX_SESSION_NUMBER 3 50 51 // Annex B Implementation Definitions 52 53 // Table 211 - Defines for Logic Values 54 #define YES 1 55 #define NO 0 56 #define SET 1 57 #define CLEAR 0 58 59 // Table 215 - Defines for RSA Algorithm Constants 60 #define MAX_RSA_KEY_BITS 2048 61 #define MAX_RSA_KEY_BYTES ((MAX_RSA_KEY_BITS + 7) / 8) 62 63 // Table 216 - Defines for ECC Algorithm Constants 64 #define MAX_ECC_KEY_BITS 256 65 #define MAX_ECC_KEY_BYTES ((MAX_ECC_KEY_BITS + 7) / 8) 66 67 // Table 217 - Defines for AES Algorithm Constants 68 #define MAX_AES_KEY_BITS 128 69 #define MAX_AES_BLOCK_SIZE_BYTES 16 70 #define MAX_AES_KEY_BYTES ((MAX_AES_KEY_BITS + 7) / 8) 71 72 // Table 218 - Defines for SM4 Algorithm Constants 73 #define MAX_SM4_KEY_BITS 128 74 #define MAX_SM4_BLOCK_SIZE_BYTES 16 75 #define MAX_SM4_KEY_BYTES ((MAX_SM4_KEY_BITS + 7) / 8) 76 77 // Table 219 - Defines for Symmetric Algorithm Constants 78 #define MAX_SYM_KEY_BITS MAX_AES_KEY_BITS 79 #define MAX_SYM_KEY_BYTES MAX_AES_KEY_BYTES 80 #define MAX_SYM_BLOCK_SIZE MAX_AES_BLOCK_SIZE_BYTES 81 82 // Table 220 - Defines for Implementation Values 83 typedef uint16_t BSIZE; 84 #define BUFFER_ALIGNMENT 4 85 #define IMPLEMENTATION_PCR 24 86 #define PLATFORM_PCR 24 87 #define DRTM_PCR 17 88 #define NUM_LOCALITIES 5 89 #define MAX_HANDLE_NUM 3 90 #define MAX_ACTIVE_SESSIONS 64 91 typedef uint16_t CONTEXT_SLOT; 92 typedef uint64_t CONTEXT_COUNTER; 93 #define MAX_LOADED_SESSIONS 3 94 #define MAX_SESSION_NUM 3 95 #define MAX_LOADED_OBJECTS 3 96 #define MIN_EVICT_OBJECTS 2 97 #define PCR_SELECT_MIN ((PLATFORM_PCR + 7) / 8) 98 #define PCR_SELECT_MAX ((IMPLEMENTATION_PCR + 7) / 8) 99 #define NUM_POLICY_PCR_GROUP 1 100 #define NUM_AUTHVALUE_PCR_GROUP 1 101 #define MAX_CONTEXT_SIZE 4000 102 #define MAX_DIGEST_BUFFER 1024 103 #define MAX_NV_INDEX_SIZE 1024 104 #define MAX_CAP_BUFFER 1024 105 #define NV_MEMORY_SIZE 16384 106 #define NUM_STATIC_PCR 16 107 #define MAX_ALG_LIST_SIZE 64 108 #define TIMER_PRESCALE 100000 109 #define PRIMARY_SEED_SIZE 32 110 #define CONTEXT_ENCRYPT_ALG TPM_ALG_AES 111 #define CONTEXT_ENCRYPT_KEY_BITS MAX_SYM_KEY_BITS 112 #define CONTEXT_ENCRYPT_KEY_BYTES ((CONTEXT_ENCRYPT_KEY_BITS + 7) / 8) 113 #define CONTEXT_INTEGRITY_HASH_ALG TPM_ALG_SHA256 114 #define CONTEXT_INTEGRITY_HASH_SIZE SHA256_DIGEST_SIZE 115 #define PROOF_SIZE CONTEXT_INTEGRITY_HASH_SIZE 116 #define NV_CLOCK_UPDATE_INTERVAL 12 117 #define NUM_POLICY_PCR 1 118 #define MAX_COMMAND_SIZE 4096 119 #define MAX_RESPONSE_SIZE 4096 120 #define ORDERLY_BITS 8 121 #define MAX_ORDERLY_COUNT ((1 << ORDERLY_BITS) - 1) 122 #define ALG_ID_FIRST TPM_ALG_FIRST 123 #define ALG_ID_LAST TPM_ALG_LAST 124 #define MAX_SYM_DATA 128 125 #define MAX_RNG_ENTROPY_SIZE 64 126 #define RAM_INDEX_SPACE 512 127 #define RSA_DEFAULT_PUBLIC_EXPONENT 0x00010001 128 #define CRT_FORMAT_RSA YES 129 #define PRIVATE_VENDOR_SPECIFIC_BYTES ((MAX_RSA_KEY_BYTES / 2) * ( 3 + CRT_FORMAT_RSA * 2)) 130 131 // Capability related MAX_ value 132 #define MAX_CAP_DATA (MAX_CAP_BUFFER - sizeof(TPM_CAP) - sizeof(uint32_t)) 133 #define MAX_CAP_ALGS (MAX_CAP_DATA / sizeof(TPMS_ALG_PROPERTY)) 134 #define MAX_CAP_HANDLES (MAX_CAP_DATA / sizeof(TPM_HANDLE)) 135 #define MAX_CAP_CC (MAX_CAP_DATA / sizeof(TPM_CC)) 136 #define MAX_TPM_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PROPERTY)) 137 #define MAX_PCR_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PCR_SELECT)) 138 #define MAX_ECC_CURVES (MAX_CAP_DATA / sizeof(TPM_ECC_CURVE)) 139 140 // 141 // Always set 5 here, because we want to support all hash algo in BIOS. 142 // 143 #define HASH_COUNT 5 144 145 // 5 Base Types 146 147 // Table 3 - Definition of Base Types 148 typedef byte BYTE; 149 typedef byte BOOL; 150 151 // Table 4 - Definition of Types for Documentation Clarity 152 // 153 // NOTE: Comment because it has same name as TPM1.2 (value is same, so not runtime issue) 154 // 155 //typedef uint32_t TPM_ALGORITHM_ID; 156 //typedef uint32_t TPM_MODIFIER_INDICATOR; 157 typedef uint32_t TPM_AUTHORIZATION_SIZE; 158 typedef uint32_t TPM_PARAMETER_SIZE; 159 typedef uint16_t TPM_KEY_SIZE; 160 typedef uint16_t TPM_KEY_BITS; 161 162 // 6 Constants 163 164 // Table 6 - TPM_GENERATED Constants 165 typedef uint32_t TPM_GENERATED; 166 #define TPM_GENERATED_VALUE (TPM_GENERATED)(0xff544347) 167 168 // Table 7 - TPM_ALG_ID Constants 169 typedef uint16_t TPM_ALG_ID; 170 // 171 // NOTE: Comment some algo which has same name as TPM1.2 (value is same, so not runtime issue) 172 // 173 #define TPM_ALG_ERROR (TPM_ALG_ID)(0x0000) 174 #define TPM_ALG_FIRST (TPM_ALG_ID)(0x0001) 175 // defined in tpm.h #define TPM_ALG_RSA (TPM_ALG_ID)(0x0001) 176 // defined in tpm.h #define TPM_ALG_SHA (TPM_ALG_ID)(0x0004) 177 #define TPM_ALG_SHA1 (TPM_ALG_ID)(0x0004) 178 // defined in tpm.h #define TPM_ALG_HMAC (TPM_ALG_ID)(0x0005) 179 #define TPM_ALG_AES (TPM_ALG_ID)(0x0006) 180 // defined in tpm.h #define TPM_ALG_MGF1 (TPM_ALG_ID)(0x0007) 181 #define TPM_ALG_KEYEDHASH (TPM_ALG_ID)(0x0008) 182 // defined in tpm.h #define TPM_ALG_XOR (TPM_ALG_ID)(0x000A) 183 #define TPM_ALG_SHA256 (TPM_ALG_ID)(0x000B) 184 #define TPM_ALG_SHA384 (TPM_ALG_ID)(0x000C) 185 #define TPM_ALG_SHA512 (TPM_ALG_ID)(0x000D) 186 #define TPM_ALG_NULL (TPM_ALG_ID)(0x0010) 187 #define TPM_ALG_SM3_256 (TPM_ALG_ID)(0x0012) 188 #define TPM_ALG_SM4 (TPM_ALG_ID)(0x0013) 189 #define TPM_ALG_RSASSA (TPM_ALG_ID)(0x0014) 190 #define TPM_ALG_RSAES (TPM_ALG_ID)(0x0015) 191 #define TPM_ALG_RSAPSS (TPM_ALG_ID)(0x0016) 192 #define TPM_ALG_OAEP (TPM_ALG_ID)(0x0017) 193 #define TPM_ALG_ECDSA (TPM_ALG_ID)(0x0018) 194 #define TPM_ALG_ECDH (TPM_ALG_ID)(0x0019) 195 #define TPM_ALG_ECDAA (TPM_ALG_ID)(0x001A) 196 #define TPM_ALG_SM2 (TPM_ALG_ID)(0x001B) 197 #define TPM_ALG_ECSCHNORR (TPM_ALG_ID)(0x001C) 198 #define TPM_ALG_ECMQV (TPM_ALG_ID)(0x001D) 199 #define TPM_ALG_KDF1_SP800_56a (TPM_ALG_ID)(0x0020) 200 #define TPM_ALG_KDF2 (TPM_ALG_ID)(0x0021) 201 #define TPM_ALG_KDF1_SP800_108 (TPM_ALG_ID)(0x0022) 202 #define TPM_ALG_ECC (TPM_ALG_ID)(0x0023) 203 #define TPM_ALG_SYMCIPHER (TPM_ALG_ID)(0x0025) 204 #define TPM_ALG_CTR (TPM_ALG_ID)(0x0040) 205 #define TPM_ALG_OFB (TPM_ALG_ID)(0x0041) 206 #define TPM_ALG_CBC (TPM_ALG_ID)(0x0042) 207 #define TPM_ALG_CFB (TPM_ALG_ID)(0x0043) 208 #define TPM_ALG_ECB (TPM_ALG_ID)(0x0044) 209 #define TPM_ALG_LAST (TPM_ALG_ID)(0x0044) 210 211 // Table 8 - TPM_ECC_CURVE Constants 212 typedef uint16_t TPM_ECC_CURVE; 213 #define TPM_ECC_NONE (TPM_ECC_CURVE)(0x0000) 214 #define TPM_ECC_NIST_P192 (TPM_ECC_CURVE)(0x0001) 215 #define TPM_ECC_NIST_P224 (TPM_ECC_CURVE)(0x0002) 216 #define TPM_ECC_NIST_P256 (TPM_ECC_CURVE)(0x0003) 217 #define TPM_ECC_NIST_P384 (TPM_ECC_CURVE)(0x0004) 218 #define TPM_ECC_NIST_P521 (TPM_ECC_CURVE)(0x0005) 219 #define TPM_ECC_BN_P256 (TPM_ECC_CURVE)(0x0010) 220 #define TPM_ECC_BN_P638 (TPM_ECC_CURVE)(0x0011) 221 #define TPM_ECC_SM2_P256 (TPM_ECC_CURVE)(0x0020) 222 223 // Table 11 - TPM_CC Constants (Numeric Order) 224 typedef uint32_t TPM_CC; 225 #define TPM_CC_FIRST (TPM_CC)(0x0000011F) 226 #define TPM_CC_PP_FIRST (TPM_CC)(0x0000011F) 227 #define TPM_CC_NV_UndefineSpaceSpecial (TPM_CC)(0x0000011F) 228 #define TPM_CC_EvictControl (TPM_CC)(0x00000120) 229 #define TPM_CC_HierarchyControl (TPM_CC)(0x00000121) 230 #define TPM_CC_NV_UndefineSpace (TPM_CC)(0x00000122) 231 #define TPM_CC_ChangeEPS (TPM_CC)(0x00000124) 232 #define TPM_CC_ChangePPS (TPM_CC)(0x00000125) 233 #define TPM_CC_Clear (TPM_CC)(0x00000126) 234 #define TPM_CC_ClearControl (TPM_CC)(0x00000127) 235 #define TPM_CC_ClockSet (TPM_CC)(0x00000128) 236 #define TPM_CC_HierarchyChangeAuth (TPM_CC)(0x00000129) 237 #define TPM_CC_NV_DefineSpace (TPM_CC)(0x0000012A) 238 #define TPM_CC_PCR_Allocate (TPM_CC)(0x0000012B) 239 #define TPM_CC_PCR_SetAuthPolicy (TPM_CC)(0x0000012C) 240 #define TPM_CC_PP_Commands (TPM_CC)(0x0000012D) 241 #define TPM_CC_SetPrimaryPolicy (TPM_CC)(0x0000012E) 242 #define TPM_CC_FieldUpgradeStart (TPM_CC)(0x0000012F) 243 #define TPM_CC_ClockRateAdjust (TPM_CC)(0x00000130) 244 #define TPM_CC_CreatePrimary (TPM_CC)(0x00000131) 245 #define TPM_CC_NV_GlobalWriteLock (TPM_CC)(0x00000132) 246 #define TPM_CC_PP_LAST (TPM_CC)(0x00000132) 247 #define TPM_CC_GetCommandAuditDigest (TPM_CC)(0x00000133) 248 #define TPM_CC_NV_Increment (TPM_CC)(0x00000134) 249 #define TPM_CC_NV_SetBits (TPM_CC)(0x00000135) 250 #define TPM_CC_NV_Extend (TPM_CC)(0x00000136) 251 #define TPM_CC_NV_Write (TPM_CC)(0x00000137) 252 #define TPM_CC_NV_WriteLock (TPM_CC)(0x00000138) 253 #define TPM_CC_DictionaryAttackLockReset (TPM_CC)(0x00000139) 254 #define TPM_CC_DictionaryAttackParameters (TPM_CC)(0x0000013A) 255 #define TPM_CC_NV_ChangeAuth (TPM_CC)(0x0000013B) 256 #define TPM_CC_PCR_Event (TPM_CC)(0x0000013C) 257 #define TPM_CC_PCR_Reset (TPM_CC)(0x0000013D) 258 #define TPM_CC_SequenceComplete (TPM_CC)(0x0000013E) 259 #define TPM_CC_SetAlgorithmSet (TPM_CC)(0x0000013F) 260 #define TPM_CC_SetCommandCodeAuditStatus (TPM_CC)(0x00000140) 261 #define TPM_CC_FieldUpgradeData (TPM_CC)(0x00000141) 262 #define TPM_CC_IncrementalSelfTest (TPM_CC)(0x00000142) 263 #define TPM_CC_SelfTest (TPM_CC)(0x00000143) 264 #define TPM_CC_Startup (TPM_CC)(0x00000144) 265 #define TPM_CC_Shutdown (TPM_CC)(0x00000145) 266 #define TPM_CC_StirRandom (TPM_CC)(0x00000146) 267 #define TPM_CC_ActivateCredential (TPM_CC)(0x00000147) 268 #define TPM_CC_Certify (TPM_CC)(0x00000148) 269 #define TPM_CC_PolicyNV (TPM_CC)(0x00000149) 270 #define TPM_CC_CertifyCreation (TPM_CC)(0x0000014A) 271 #define TPM_CC_Duplicate (TPM_CC)(0x0000014B) 272 #define TPM_CC_GetTime (TPM_CC)(0x0000014C) 273 #define TPM_CC_GetSessionAuditDigest (TPM_CC)(0x0000014D) 274 #define TPM_CC_NV_Read (TPM_CC)(0x0000014E) 275 #define TPM_CC_NV_ReadLock (TPM_CC)(0x0000014F) 276 #define TPM_CC_ObjectChangeAuth (TPM_CC)(0x00000150) 277 #define TPM_CC_PolicySecret (TPM_CC)(0x00000151) 278 #define TPM_CC_Rewrap (TPM_CC)(0x00000152) 279 #define TPM_CC_Create (TPM_CC)(0x00000153) 280 #define TPM_CC_ECDH_ZGen (TPM_CC)(0x00000154) 281 #define TPM_CC_HMAC (TPM_CC)(0x00000155) 282 #define TPM_CC_Import (TPM_CC)(0x00000156) 283 #define TPM_CC_Load (TPM_CC)(0x00000157) 284 #define TPM_CC_Quote (TPM_CC)(0x00000158) 285 #define TPM_CC_RSA_Decrypt (TPM_CC)(0x00000159) 286 #define TPM_CC_HMAC_Start (TPM_CC)(0x0000015B) 287 #define TPM_CC_SequenceUpdate (TPM_CC)(0x0000015C) 288 #define TPM_CC_Sign (TPM_CC)(0x0000015D) 289 #define TPM_CC_Unseal (TPM_CC)(0x0000015E) 290 #define TPM_CC_PolicySigned (TPM_CC)(0x00000160) 291 #define TPM_CC_ContextLoad (TPM_CC)(0x00000161) 292 #define TPM_CC_ContextSave (TPM_CC)(0x00000162) 293 #define TPM_CC_ECDH_KeyGen (TPM_CC)(0x00000163) 294 #define TPM_CC_EncryptDecrypt (TPM_CC)(0x00000164) 295 #define TPM_CC_FlushContext (TPM_CC)(0x00000165) 296 #define TPM_CC_LoadExternal (TPM_CC)(0x00000167) 297 #define TPM_CC_MakeCredential (TPM_CC)(0x00000168) 298 #define TPM_CC_NV_ReadPublic (TPM_CC)(0x00000169) 299 #define TPM_CC_PolicyAuthorize (TPM_CC)(0x0000016A) 300 #define TPM_CC_PolicyAuthValue (TPM_CC)(0x0000016B) 301 #define TPM_CC_PolicyCommandCode (TPM_CC)(0x0000016C) 302 #define TPM_CC_PolicyCounterTimer (TPM_CC)(0x0000016D) 303 #define TPM_CC_PolicyCpHash (TPM_CC)(0x0000016E) 304 #define TPM_CC_PolicyLocality (TPM_CC)(0x0000016F) 305 #define TPM_CC_PolicyNameHash (TPM_CC)(0x00000170) 306 #define TPM_CC_PolicyOR (TPM_CC)(0x00000171) 307 #define TPM_CC_PolicyTicket (TPM_CC)(0x00000172) 308 #define TPM_CC_ReadPublic (TPM_CC)(0x00000173) 309 #define TPM_CC_RSA_Encrypt (TPM_CC)(0x00000174) 310 #define TPM_CC_StartAuthSession (TPM_CC)(0x00000176) 311 #define TPM_CC_VerifySignature (TPM_CC)(0x00000177) 312 #define TPM_CC_ECC_Parameters (TPM_CC)(0x00000178) 313 #define TPM_CC_FirmwareRead (TPM_CC)(0x00000179) 314 #define TPM_CC_GetCapability (TPM_CC)(0x0000017A) 315 #define TPM_CC_GetRandom (TPM_CC)(0x0000017B) 316 #define TPM_CC_GetTestResult (TPM_CC)(0x0000017C) 317 #define TPM_CC_Hash (TPM_CC)(0x0000017D) 318 #define TPM_CC_PCR_Read (TPM_CC)(0x0000017E) 319 #define TPM_CC_PolicyPCR (TPM_CC)(0x0000017F) 320 #define TPM_CC_PolicyRestart (TPM_CC)(0x00000180) 321 #define TPM_CC_ReadClock (TPM_CC)(0x00000181) 322 #define TPM_CC_PCR_Extend (TPM_CC)(0x00000182) 323 #define TPM_CC_PCR_SetAuthValue (TPM_CC)(0x00000183) 324 #define TPM_CC_NV_Certify (TPM_CC)(0x00000184) 325 #define TPM_CC_EventSequenceComplete (TPM_CC)(0x00000185) 326 #define TPM_CC_HashSequenceStart (TPM_CC)(0x00000186) 327 #define TPM_CC_PolicyPhysicalPresence (TPM_CC)(0x00000187) 328 #define TPM_CC_PolicyDuplicationSelect (TPM_CC)(0x00000188) 329 #define TPM_CC_PolicyGetDigest (TPM_CC)(0x00000189) 330 #define TPM_CC_TestParms (TPM_CC)(0x0000018A) 331 #define TPM_CC_Commit (TPM_CC)(0x0000018B) 332 #define TPM_CC_PolicyPassword (TPM_CC)(0x0000018C) 333 #define TPM_CC_ZGen_2Phase (TPM_CC)(0x0000018D) 334 #define TPM_CC_EC_Ephemeral (TPM_CC)(0x0000018E) 335 #define TPM_CC_LAST (TPM_CC)(0x0000018E) 336 337 // Table 15 - TPM_RC Constants (Actions) 338 typedef uint32_t TPM_RC; 339 #define TPM_RC_SUCCESS (TPM_RC)(0x000) 340 #define TPM_RC_BAD_TAG (TPM_RC)(0x030) 341 #define RC_VER1 (TPM_RC)(0x100) 342 #define TPM_RC_INITIALIZE (TPM_RC)(RC_VER1 + 0x000) 343 #define TPM_RC_FAILURE (TPM_RC)(RC_VER1 + 0x001) 344 #define TPM_RC_SEQUENCE (TPM_RC)(RC_VER1 + 0x003) 345 #define TPM_RC_PRIVATE (TPM_RC)(RC_VER1 + 0x00B) 346 #define TPM_RC_HMAC (TPM_RC)(RC_VER1 + 0x019) 347 #define TPM_RC_DISABLED (TPM_RC)(RC_VER1 + 0x020) 348 #define TPM_RC_EXCLUSIVE (TPM_RC)(RC_VER1 + 0x021) 349 #define TPM_RC_AUTH_TYPE (TPM_RC)(RC_VER1 + 0x024) 350 #define TPM_RC_AUTH_MISSING (TPM_RC)(RC_VER1 + 0x025) 351 #define TPM_RC_POLICY (TPM_RC)(RC_VER1 + 0x026) 352 #define TPM_RC_PCR (TPM_RC)(RC_VER1 + 0x027) 353 #define TPM_RC_PCR_CHANGED (TPM_RC)(RC_VER1 + 0x028) 354 #define TPM_RC_UPGRADE (TPM_RC)(RC_VER1 + 0x02D) 355 #define TPM_RC_TOO_MANY_CONTEXTS (TPM_RC)(RC_VER1 + 0x02E) 356 #define TPM_RC_AUTH_UNAVAILABLE (TPM_RC)(RC_VER1 + 0x02F) 357 #define TPM_RC_REBOOT (TPM_RC)(RC_VER1 + 0x030) 358 #define TPM_RC_UNBALANCED (TPM_RC)(RC_VER1 + 0x031) 359 #define TPM_RC_COMMAND_SIZE (TPM_RC)(RC_VER1 + 0x042) 360 #define TPM_RC_COMMAND_CODE (TPM_RC)(RC_VER1 + 0x043) 361 #define TPM_RC_AUTHSIZE (TPM_RC)(RC_VER1 + 0x044) 362 #define TPM_RC_AUTH_CONTEXT (TPM_RC)(RC_VER1 + 0x045) 363 #define TPM_RC_NV_RANGE (TPM_RC)(RC_VER1 + 0x046) 364 #define TPM_RC_NV_SIZE (TPM_RC)(RC_VER1 + 0x047) 365 #define TPM_RC_NV_LOCKED (TPM_RC)(RC_VER1 + 0x048) 366 #define TPM_RC_NV_AUTHORIZATION (TPM_RC)(RC_VER1 + 0x049) 367 #define TPM_RC_NV_UNINITIALIZED (TPM_RC)(RC_VER1 + 0x04A) 368 #define TPM_RC_NV_SPACE (TPM_RC)(RC_VER1 + 0x04B) 369 #define TPM_RC_NV_DEFINED (TPM_RC)(RC_VER1 + 0x04C) 370 #define TPM_RC_BAD_CONTEXT (TPM_RC)(RC_VER1 + 0x050) 371 #define TPM_RC_CPHASH (TPM_RC)(RC_VER1 + 0x051) 372 #define TPM_RC_PARENT (TPM_RC)(RC_VER1 + 0x052) 373 #define TPM_RC_NEEDS_TEST (TPM_RC)(RC_VER1 + 0x053) 374 #define TPM_RC_NO_RESULT (TPM_RC)(RC_VER1 + 0x054) 375 #define TPM_RC_SENSITIVE (TPM_RC)(RC_VER1 + 0x055) 376 #define RC_MAX_FM0 (TPM_RC)(RC_VER1 + 0x07F) 377 #define RC_FMT1 (TPM_RC)(0x080) 378 #define TPM_RC_ASYMMETRIC (TPM_RC)(RC_FMT1 + 0x001) 379 #define TPM_RC_ATTRIBUTES (TPM_RC)(RC_FMT1 + 0x002) 380 #define TPM_RC_HASH (TPM_RC)(RC_FMT1 + 0x003) 381 #define TPM_RC_VALUE (TPM_RC)(RC_FMT1 + 0x004) 382 #define TPM_RC_HIERARCHY (TPM_RC)(RC_FMT1 + 0x005) 383 #define TPM_RC_KEY_SIZE (TPM_RC)(RC_FMT1 + 0x007) 384 #define TPM_RC_MGF (TPM_RC)(RC_FMT1 + 0x008) 385 #define TPM_RC_MODE (TPM_RC)(RC_FMT1 + 0x009) 386 #define TPM_RC_TYPE (TPM_RC)(RC_FMT1 + 0x00A) 387 #define TPM_RC_HANDLE (TPM_RC)(RC_FMT1 + 0x00B) 388 #define TPM_RC_KDF (TPM_RC)(RC_FMT1 + 0x00C) 389 #define TPM_RC_RANGE (TPM_RC)(RC_FMT1 + 0x00D) 390 #define TPM_RC_AUTH_FAIL (TPM_RC)(RC_FMT1 + 0x00E) 391 #define TPM_RC_NONCE (TPM_RC)(RC_FMT1 + 0x00F) 392 #define TPM_RC_PP (TPM_RC)(RC_FMT1 + 0x010) 393 #define TPM_RC_SCHEME (TPM_RC)(RC_FMT1 + 0x012) 394 #define TPM_RC_SIZE (TPM_RC)(RC_FMT1 + 0x015) 395 #define TPM_RC_SYMMETRIC (TPM_RC)(RC_FMT1 + 0x016) 396 #define TPM_RC_TAG (TPM_RC)(RC_FMT1 + 0x017) 397 #define TPM_RC_SELECTOR (TPM_RC)(RC_FMT1 + 0x018) 398 #define TPM_RC_INSUFFICIENT (TPM_RC)(RC_FMT1 + 0x01A) 399 #define TPM_RC_SIGNATURE (TPM_RC)(RC_FMT1 + 0x01B) 400 #define TPM_RC_KEY (TPM_RC)(RC_FMT1 + 0x01C) 401 #define TPM_RC_POLICY_FAIL (TPM_RC)(RC_FMT1 + 0x01D) 402 #define TPM_RC_INTEGRITY (TPM_RC)(RC_FMT1 + 0x01F) 403 #define TPM_RC_TICKET (TPM_RC)(RC_FMT1 + 0x020) 404 #define TPM_RC_RESERVED_BITS (TPM_RC)(RC_FMT1 + 0x021) 405 #define TPM_RC_BAD_AUTH (TPM_RC)(RC_FMT1 + 0x022) 406 #define TPM_RC_EXPIRED (TPM_RC)(RC_FMT1 + 0x023) 407 #define TPM_RC_POLICY_CC (TPM_RC)(RC_FMT1 + 0x024 ) 408 #define TPM_RC_BINDING (TPM_RC)(RC_FMT1 + 0x025) 409 #define TPM_RC_CURVE (TPM_RC)(RC_FMT1 + 0x026) 410 #define TPM_RC_ECC_POINT (TPM_RC)(RC_FMT1 + 0x027) 411 #define RC_WARN (TPM_RC)(0x900) 412 #define TPM_RC_CONTEXT_GAP (TPM_RC)(RC_WARN + 0x001) 413 #define TPM_RC_OBJECT_MEMORY (TPM_RC)(RC_WARN + 0x002) 414 #define TPM_RC_SESSION_MEMORY (TPM_RC)(RC_WARN + 0x003) 415 #define TPM_RC_MEMORY (TPM_RC)(RC_WARN + 0x004) 416 #define TPM_RC_SESSION_HANDLES (TPM_RC)(RC_WARN + 0x005) 417 #define TPM_RC_OBJECT_HANDLES (TPM_RC)(RC_WARN + 0x006) 418 #define TPM_RC_LOCALITY (TPM_RC)(RC_WARN + 0x007) 419 #define TPM_RC_YIELDED (TPM_RC)(RC_WARN + 0x008) 420 #define TPM_RC_CANCELED (TPM_RC)(RC_WARN + 0x009) 421 #define TPM_RC_TESTING (TPM_RC)(RC_WARN + 0x00A) 422 #define TPM_RC_REFERENCE_H0 (TPM_RC)(RC_WARN + 0x010) 423 #define TPM_RC_REFERENCE_H1 (TPM_RC)(RC_WARN + 0x011) 424 #define TPM_RC_REFERENCE_H2 (TPM_RC)(RC_WARN + 0x012) 425 #define TPM_RC_REFERENCE_H3 (TPM_RC)(RC_WARN + 0x013) 426 #define TPM_RC_REFERENCE_H4 (TPM_RC)(RC_WARN + 0x014) 427 #define TPM_RC_REFERENCE_H5 (TPM_RC)(RC_WARN + 0x015) 428 #define TPM_RC_REFERENCE_H6 (TPM_RC)(RC_WARN + 0x016) 429 #define TPM_RC_REFERENCE_S0 (TPM_RC)(RC_WARN + 0x018) 430 #define TPM_RC_REFERENCE_S1 (TPM_RC)(RC_WARN + 0x019) 431 #define TPM_RC_REFERENCE_S2 (TPM_RC)(RC_WARN + 0x01A) 432 #define TPM_RC_REFERENCE_S3 (TPM_RC)(RC_WARN + 0x01B) 433 #define TPM_RC_REFERENCE_S4 (TPM_RC)(RC_WARN + 0x01C) 434 #define TPM_RC_REFERENCE_S5 (TPM_RC)(RC_WARN + 0x01D) 435 #define TPM_RC_REFERENCE_S6 (TPM_RC)(RC_WARN + 0x01E) 436 #define TPM_RC_NV_RATE (TPM_RC)(RC_WARN + 0x020) 437 #define TPM_RC_LOCKOUT (TPM_RC)(RC_WARN + 0x021) 438 #define TPM_RC_RETRY (TPM_RC)(RC_WARN + 0x022) 439 #define TPM_RC_NV_UNAVAILABLE (TPM_RC)(RC_WARN + 0x023) 440 #define TPM_RC_NOT_USED (TPM_RC)(RC_WARN + 0x7F) 441 #define TPM_RC_H (TPM_RC)(0x000) 442 #define TPM_RC_P (TPM_RC)(0x040) 443 #define TPM_RC_S (TPM_RC)(0x800) 444 #define TPM_RC_1 (TPM_RC)(0x100) 445 #define TPM_RC_2 (TPM_RC)(0x200) 446 #define TPM_RC_3 (TPM_RC)(0x300) 447 #define TPM_RC_4 (TPM_RC)(0x400) 448 #define TPM_RC_5 (TPM_RC)(0x500) 449 #define TPM_RC_6 (TPM_RC)(0x600) 450 #define TPM_RC_7 (TPM_RC)(0x700) 451 #define TPM_RC_8 (TPM_RC)(0x800) 452 #define TPM_RC_9 (TPM_RC)(0x900) 453 #define TPM_RC_A (TPM_RC)(0xA00) 454 #define TPM_RC_B (TPM_RC)(0xB00) 455 #define TPM_RC_C (TPM_RC)(0xC00) 456 #define TPM_RC_D (TPM_RC)(0xD00) 457 #define TPM_RC_E (TPM_RC)(0xE00) 458 #define TPM_RC_F (TPM_RC)(0xF00) 459 #define TPM_RC_N_MASK (TPM_RC)(0xF00) 460 461 // Table 16 - TPM_CLOCK_ADJUST Constants 462 typedef int8_t TPM_CLOCK_ADJUST; 463 #define TPM_CLOCK_COARSE_SLOWER (TPM_CLOCK_ADJUST)(-3) 464 #define TPM_CLOCK_MEDIUM_SLOWER (TPM_CLOCK_ADJUST)(-2) 465 #define TPM_CLOCK_FINE_SLOWER (TPM_CLOCK_ADJUST)(-1) 466 #define TPM_CLOCK_NO_CHANGE (TPM_CLOCK_ADJUST)(0) 467 #define TPM_CLOCK_FINE_FASTER (TPM_CLOCK_ADJUST)(1) 468 #define TPM_CLOCK_MEDIUM_FASTER (TPM_CLOCK_ADJUST)(2) 469 #define TPM_CLOCK_COARSE_FASTER (TPM_CLOCK_ADJUST)(3) 470 471 // Table 17 - TPM_EO Constants 472 typedef uint16_t TPM_EO; 473 #define TPM_EO_EQ (TPM_EO)(0x0000) 474 #define TPM_EO_NEQ (TPM_EO)(0x0001) 475 #define TPM_EO_SIGNED_GT (TPM_EO)(0x0002) 476 #define TPM_EO_UNSIGNED_GT (TPM_EO)(0x0003) 477 #define TPM_EO_SIGNED_LT (TPM_EO)(0x0004) 478 #define TPM_EO_UNSIGNED_LT (TPM_EO)(0x0005) 479 #define TPM_EO_SIGNED_GE (TPM_EO)(0x0006) 480 #define TPM_EO_UNSIGNED_GE (TPM_EO)(0x0007) 481 #define TPM_EO_SIGNED_LE (TPM_EO)(0x0008) 482 #define TPM_EO_UNSIGNED_LE (TPM_EO)(0x0009) 483 #define TPM_EO_BITSET (TPM_EO)(0x000A) 484 #define TPM_EO_BITCLEAR (TPM_EO)(0x000B) 485 486 // Table 18 - TPM_ST Constants 487 typedef uint16_t TPM_ST; 488 #define TPM_ST_RSP_COMMAND (TPM_ST)(0x00C4) 489 #define TPM_ST_NULL (TPM_ST)(0X8000) 490 #define TPM_ST_NO_SESSIONS (TPM_ST)(0x8001) 491 #define TPM_ST_SESSIONS (TPM_ST)(0x8002) 492 #define TPM_ST_ATTEST_NV (TPM_ST)(0x8014) 493 #define TPM_ST_ATTEST_COMMAND_AUDIT (TPM_ST)(0x8015) 494 #define TPM_ST_ATTEST_SESSION_AUDIT (TPM_ST)(0x8016) 495 #define TPM_ST_ATTEST_CERTIFY (TPM_ST)(0x8017) 496 #define TPM_ST_ATTEST_QUOTE (TPM_ST)(0x8018) 497 #define TPM_ST_ATTEST_TIME (TPM_ST)(0x8019) 498 #define TPM_ST_ATTEST_CREATION (TPM_ST)(0x801A) 499 #define TPM_ST_CREATION (TPM_ST)(0x8021) 500 #define TPM_ST_VERIFIED (TPM_ST)(0x8022) 501 #define TPM_ST_AUTH_SECRET (TPM_ST)(0x8023) 502 #define TPM_ST_HASHCHECK (TPM_ST)(0x8024) 503 #define TPM_ST_AUTH_SIGNED (TPM_ST)(0x8025) 504 #define TPM_ST_FU_MANIFEST (TPM_ST)(0x8029) 505 506 // Table 19 - TPM_SU Constants 507 typedef uint16_t TPM_SU; 508 #define TPM_SU_CLEAR (TPM_SU)(0x0000) 509 #define TPM_SU_STATE (TPM_SU)(0x0001) 510 511 // Table 20 - TPM_SE Constants 512 typedef byte TPM_SE; 513 #define TPM_SE_HMAC (TPM_SE)(0x00) 514 #define TPM_SE_POLICY (TPM_SE)(0x01) 515 #define TPM_SE_TRIAL (TPM_SE)(0x03) 516 517 // Table 21 - TPM_CAP Constants 518 typedef uint32_t TPM_CAP; 519 #define TPM_CAP_FIRST (TPM_CAP)(0x00000000) 520 #define TPM_CAP_ALGS (TPM_CAP)(0x00000000) 521 #define TPM_CAP_HANDLES (TPM_CAP)(0x00000001) 522 #define TPM_CAP_COMMANDS (TPM_CAP)(0x00000002) 523 #define TPM_CAP_PP_COMMANDS (TPM_CAP)(0x00000003) 524 #define TPM_CAP_AUDIT_COMMANDS (TPM_CAP)(0x00000004) 525 #define TPM_CAP_PCRS (TPM_CAP)(0x00000005) 526 #define TPM_CAP_TPM_PROPERTIES (TPM_CAP)(0x00000006) 527 #define TPM_CAP_PCR_PROPERTIES (TPM_CAP)(0x00000007) 528 #define TPM_CAP_ECC_CURVES (TPM_CAP)(0x00000008) 529 #define TPM_CAP_LAST (TPM_CAP)(0x00000008) 530 #define TPM_CAP_VENDOR_PROPERTY (TPM_CAP)(0x00000100) 531 532 // Table 22 - TPM_PT Constants 533 typedef uint32_t TPM_PT; 534 #define TPM_PT_NONE (TPM_PT)(0x00000000) 535 #define PT_GROUP (TPM_PT)(0x00000100) 536 #define PT_FIXED (TPM_PT)(PT_GROUP * 1) 537 #define TPM_PT_FAMILY_INDICATOR (TPM_PT)(PT_FIXED + 0) 538 #define TPM_PT_LEVEL (TPM_PT)(PT_FIXED + 1) 539 #define TPM_PT_REVISION (TPM_PT)(PT_FIXED + 2) 540 #define TPM_PT_DAY_OF_YEAR (TPM_PT)(PT_FIXED + 3) 541 #define TPM_PT_YEAR (TPM_PT)(PT_FIXED + 4) 542 #define TPM_PT_MANUFACTURER (TPM_PT)(PT_FIXED + 5) 543 #define TPM_PT_VENDOR_STRING_1 (TPM_PT)(PT_FIXED + 6) 544 #define TPM_PT_VENDOR_STRING_2 (TPM_PT)(PT_FIXED + 7) 545 #define TPM_PT_VENDOR_STRING_3 (TPM_PT)(PT_FIXED + 8) 546 #define TPM_PT_VENDOR_STRING_4 (TPM_PT)(PT_FIXED + 9) 547 #define TPM_PT_VENDOR_TPM_TYPE (TPM_PT)(PT_FIXED + 10) 548 #define TPM_PT_FIRMWARE_VERSION_1 (TPM_PT)(PT_FIXED + 11) 549 #define TPM_PT_FIRMWARE_VERSION_2 (TPM_PT)(PT_FIXED + 12) 550 #define TPM_PT_INPUT_BUFFER (TPM_PT)(PT_FIXED + 13) 551 #define TPM_PT_HR_TRANSIENT_MIN (TPM_PT)(PT_FIXED + 14) 552 #define TPM_PT_HR_PERSISTENT_MIN (TPM_PT)(PT_FIXED + 15) 553 #define TPM_PT_HR_LOADED_MIN (TPM_PT)(PT_FIXED + 16) 554 #define TPM_PT_ACTIVE_SESSIONS_MAX (TPM_PT)(PT_FIXED + 17) 555 #define TPM_PT_PCR_COUNT (TPM_PT)(PT_FIXED + 18) 556 #define TPM_PT_PCR_SELECT_MIN (TPM_PT)(PT_FIXED + 19) 557 #define TPM_PT_CONTEXT_GAP_MAX (TPM_PT)(PT_FIXED + 20) 558 #define TPM_PT_NV_COUNTERS_MAX (TPM_PT)(PT_FIXED + 22) 559 #define TPM_PT_NV_INDEX_MAX (TPM_PT)(PT_FIXED + 23) 560 #define TPM_PT_MEMORY (TPM_PT)(PT_FIXED + 24) 561 #define TPM_PT_CLOCK_UPDATE (TPM_PT)(PT_FIXED + 25) 562 #define TPM_PT_CONTEXT_HASH (TPM_PT)(PT_FIXED + 26) 563 #define TPM_PT_CONTEXT_SYM (TPM_PT)(PT_FIXED + 27) 564 #define TPM_PT_CONTEXT_SYM_SIZE (TPM_PT)(PT_FIXED + 28) 565 #define TPM_PT_ORDERLY_COUNT (TPM_PT)(PT_FIXED + 29) 566 #define TPM_PT_MAX_COMMAND_SIZE (TPM_PT)(PT_FIXED + 30) 567 #define TPM_PT_MAX_RESPONSE_SIZE (TPM_PT)(PT_FIXED + 31) 568 #define TPM_PT_MAX_DIGEST (TPM_PT)(PT_FIXED + 32) 569 #define TPM_PT_MAX_OBJECT_CONTEXT (TPM_PT)(PT_FIXED + 33) 570 #define TPM_PT_MAX_SESSION_CONTEXT (TPM_PT)(PT_FIXED + 34) 571 #define TPM_PT_PS_FAMILY_INDICATOR (TPM_PT)(PT_FIXED + 35) 572 #define TPM_PT_PS_LEVEL (TPM_PT)(PT_FIXED + 36) 573 #define TPM_PT_PS_REVISION (TPM_PT)(PT_FIXED + 37) 574 #define TPM_PT_PS_DAY_OF_YEAR (TPM_PT)(PT_FIXED + 38) 575 #define TPM_PT_PS_YEAR (TPM_PT)(PT_FIXED + 39) 576 #define TPM_PT_SPLIT_MAX (TPM_PT)(PT_FIXED + 40) 577 #define TPM_PT_TOTAL_COMMANDS (TPM_PT)(PT_FIXED + 41) 578 #define TPM_PT_LIBRARY_COMMANDS (TPM_PT)(PT_FIXED + 42) 579 #define TPM_PT_VENDOR_COMMANDS (TPM_PT)(PT_FIXED + 43) 580 #define PT_VAR (TPM_PT)(PT_GROUP * 2) 581 #define TPM_PT_PERMANENT (TPM_PT)(PT_VAR + 0) 582 #define TPM_PT_STARTUP_CLEAR (TPM_PT)(PT_VAR + 1) 583 #define TPM_PT_HR_NV_INDEX (TPM_PT)(PT_VAR + 2) 584 #define TPM_PT_HR_LOADED (TPM_PT)(PT_VAR + 3) 585 #define TPM_PT_HR_LOADED_AVAIL (TPM_PT)(PT_VAR + 4) 586 #define TPM_PT_HR_ACTIVE (TPM_PT)(PT_VAR + 5) 587 #define TPM_PT_HR_ACTIVE_AVAIL (TPM_PT)(PT_VAR + 6) 588 #define TPM_PT_HR_TRANSIENT_AVAIL (TPM_PT)(PT_VAR + 7) 589 #define TPM_PT_HR_PERSISTENT (TPM_PT)(PT_VAR + 8) 590 #define TPM_PT_HR_PERSISTENT_AVAIL (TPM_PT)(PT_VAR + 9) 591 #define TPM_PT_NV_COUNTERS (TPM_PT)(PT_VAR + 10) 592 #define TPM_PT_NV_COUNTERS_AVAIL (TPM_PT)(PT_VAR + 11) 593 #define TPM_PT_ALGORITHM_SET (TPM_PT)(PT_VAR + 12) 594 #define TPM_PT_LOADED_CURVES (TPM_PT)(PT_VAR + 13) 595 #define TPM_PT_LOCKOUT_COUNTER (TPM_PT)(PT_VAR + 14) 596 #define TPM_PT_MAX_AUTH_FAIL (TPM_PT)(PT_VAR + 15) 597 #define TPM_PT_LOCKOUT_INTERVAL (TPM_PT)(PT_VAR + 16) 598 #define TPM_PT_LOCKOUT_RECOVERY (TPM_PT)(PT_VAR + 17) 599 #define TPM_PT_NV_WRITE_RECOVERY (TPM_PT)(PT_VAR + 18) 600 #define TPM_PT_AUDIT_COUNTER_0 (TPM_PT)(PT_VAR + 19) 601 #define TPM_PT_AUDIT_COUNTER_1 (TPM_PT)(PT_VAR + 20) 602 603 // Table 23 - TPM_PT_PCR Constants 604 typedef uint32_t TPM_PT_PCR; 605 #define TPM_PT_PCR_FIRST (TPM_PT_PCR)(0x00000000) 606 #define TPM_PT_PCR_SAVE (TPM_PT_PCR)(0x00000000) 607 #define TPM_PT_PCR_EXTEND_L0 (TPM_PT_PCR)(0x00000001) 608 #define TPM_PT_PCR_RESET_L0 (TPM_PT_PCR)(0x00000002) 609 #define TPM_PT_PCR_EXTEND_L1 (TPM_PT_PCR)(0x00000003) 610 #define TPM_PT_PCR_RESET_L1 (TPM_PT_PCR)(0x00000004) 611 #define TPM_PT_PCR_EXTEND_L2 (TPM_PT_PCR)(0x00000005) 612 #define TPM_PT_PCR_RESET_L2 (TPM_PT_PCR)(0x00000006) 613 #define TPM_PT_PCR_EXTEND_L3 (TPM_PT_PCR)(0x00000007) 614 #define TPM_PT_PCR_RESET_L3 (TPM_PT_PCR)(0x00000008) 615 #define TPM_PT_PCR_EXTEND_L4 (TPM_PT_PCR)(0x00000009) 616 #define TPM_PT_PCR_RESET_L4 (TPM_PT_PCR)(0x0000000A) 617 #define TPM_PT_PCR_NO_INCREMENT (TPM_PT_PCR)(0x00000011) 618 #define TPM_PT_PCR_DRTM_RESET (TPM_PT_PCR)(0x00000012) 619 #define TPM_PT_PCR_POLICY (TPM_PT_PCR)(0x00000013) 620 #define TPM_PT_PCR_AUTH (TPM_PT_PCR)(0x00000014) 621 #define TPM_PT_PCR_LAST (TPM_PT_PCR)(0x00000014) 622 623 // Table 24 - TPM_PS Constants 624 typedef uint32_t TPM_PS; 625 #define TPM_PS_MAIN (TPM_PS)(0x00000000) 626 #define TPM_PS_PC (TPM_PS)(0x00000001) 627 #define TPM_PS_PDA (TPM_PS)(0x00000002) 628 #define TPM_PS_CELL_PHONE (TPM_PS)(0x00000003) 629 #define TPM_PS_SERVER (TPM_PS)(0x00000004) 630 #define TPM_PS_PERIPHERAL (TPM_PS)(0x00000005) 631 #define TPM_PS_TSS (TPM_PS)(0x00000006) 632 #define TPM_PS_STORAGE (TPM_PS)(0x00000007) 633 #define TPM_PS_AUTHENTICATION (TPM_PS)(0x00000008) 634 #define TPM_PS_EMBEDDED (TPM_PS)(0x00000009) 635 #define TPM_PS_HARDCOPY (TPM_PS)(0x0000000A) 636 #define TPM_PS_INFRASTRUCTURE (TPM_PS)(0x0000000B) 637 #define TPM_PS_VIRTUALIZATION (TPM_PS)(0x0000000C) 638 #define TPM_PS_TNC (TPM_PS)(0x0000000D) 639 #define TPM_PS_MULTI_TENANT (TPM_PS)(0x0000000E) 640 #define TPM_PS_TC (TPM_PS)(0x0000000F) 641 642 // 7 Handles 643 644 // Table 25 - Handles Types 645 // 646 // NOTE: Comment because it has same name as TPM1.2 (value is same, so not runtime issue) 647 // 648 //typedef uint32_t TPM_HANDLE; 649 650 // Table 26 - TPM_HT Constants 651 typedef byte TPM_HT; 652 #define TPM_HT_PCR (TPM_HT)(0x00) 653 #define TPM_HT_NV_INDEX (TPM_HT)(0x01) 654 #define TPM_HT_HMAC_SESSION (TPM_HT)(0x02) 655 #define TPM_HT_LOADED_SESSION (TPM_HT)(0x02) 656 #define TPM_HT_POLICY_SESSION (TPM_HT)(0x03) 657 #define TPM_HT_ACTIVE_SESSION (TPM_HT)(0x03) 658 #define TPM_HT_PERMANENT (TPM_HT)(0x40) 659 #define TPM_HT_TRANSIENT (TPM_HT)(0x80) 660 #define TPM_HT_PERSISTENT (TPM_HT)(0x81) 661 662 // Table 27 - TPM_RH Constants 663 typedef uint32_t TPM_RH; 664 #define TPM_RH_FIRST (TPM_RH)(0x40000000) 665 #define TPM_RH_SRK (TPM_RH)(0x40000000) 666 #define TPM_RH_OWNER (TPM_RH)(0x40000001) 667 #define TPM_RH_REVOKE (TPM_RH)(0x40000002) 668 #define TPM_RH_TRANSPORT (TPM_RH)(0x40000003) 669 #define TPM_RH_OPERATOR (TPM_RH)(0x40000004) 670 #define TPM_RH_ADMIN (TPM_RH)(0x40000005) 671 #define TPM_RH_EK (TPM_RH)(0x40000006) 672 #define TPM_RH_NULL (TPM_RH)(0x40000007) 673 #define TPM_RH_UNASSIGNED (TPM_RH)(0x40000008) 674 #define TPM_RS_PW (TPM_RH)(0x40000009) 675 #define TPM_RH_LOCKOUT (TPM_RH)(0x4000000A) 676 #define TPM_RH_ENDORSEMENT (TPM_RH)(0x4000000B) 677 #define TPM_RH_PLATFORM (TPM_RH)(0x4000000C) 678 #define TPM_RH_LAST (TPM_RH)(0x4000000C) 679 680 // Table 28 - TPM_HC Constants 681 typedef TPM_HANDLE TPM_HC; 682 #define HR_HANDLE_MASK (TPM_HC)(0x00FFFFFF) 683 #define HR_RANGE_MASK (TPM_HC)(0xFF000000) 684 #define HR_SHIFT (TPM_HC)(24) 685 #define HR_PCR (TPM_HC)((TPM_HC)TPM_HT_PCR << HR_SHIFT) 686 #define HR_HMAC_SESSION (TPM_HC)((TPM_HC)TPM_HT_HMAC_SESSION << HR_SHIFT) 687 #define HR_POLICY_SESSION (TPM_HC)((TPM_HC)TPM_HT_POLICY_SESSION << HR_SHIFT) 688 #define HR_TRANSIENT (TPM_HC)((TPM_HC)TPM_HT_TRANSIENT << HR_SHIFT) 689 #define HR_PERSISTENT (TPM_HC)((TPM_HC)TPM_HT_PERSISTENT << HR_SHIFT) 690 #define HR_NV_INDEX (TPM_HC)((TPM_HC)TPM_HT_NV_INDEX << HR_SHIFT) 691 #define HR_PERMANENT (TPM_HC)((TPM_HC)TPM_HT_PERMANENT << HR_SHIFT) 692 #define PCR_FIRST (TPM_HC)(HR_PCR + 0) 693 #define PCR_LAST (TPM_HC)(PCR_FIRST + IMPLEMENTATION_PCR - 1) 694 #define HMAC_SESSION_FIRST (TPM_HC)(HR_HMAC_SESSION + 0) 695 #define HMAC_SESSION_LAST (TPM_HC)(HMAC_SESSION_FIRST + MAX_ACTIVE_SESSIONS - 1) 696 #define LOADED_SESSION_FIRST (TPM_HC)(HMAC_SESSION_FIRST) 697 #define LOADED_SESSION_LAST (TPM_HC)(HMAC_SESSION_LAST) 698 #define POLICY_SESSION_FIRST (TPM_HC)(HR_POLICY_SESSION + 0) 699 #define POLICY_SESSION_LAST (TPM_HC)(POLICY_SESSION_FIRST + MAX_ACTIVE_SESSIONS - 1) 700 #define TRANSIENT_FIRST (TPM_HC)(HR_TRANSIENT + 0) 701 #define ACTIVE_SESSION_FIRST (TPM_HC)(POLICY_SESSION_FIRST) 702 #define ACTIVE_SESSION_LAST (TPM_HC)(POLICY_SESSION_LAST) 703 #define TRANSIENT_LAST (TPM_HC)(TRANSIENT_FIRST+MAX_LOADED_OBJECTS - 1) 704 #define PERSISTENT_FIRST (TPM_HC)(HR_PERSISTENT + 0) 705 #define PERSISTENT_LAST (TPM_HC)(PERSISTENT_FIRST + 0x00FFFFFF) 706 #define PLATFORM_PERSISTENT (TPM_HC)(PERSISTENT_FIRST + 0x00800000) 707 #define NV_INDEX_FIRST (TPM_HC)(HR_NV_INDEX + 0) 708 #define NV_INDEX_LAST (TPM_HC)(NV_INDEX_FIRST + 0x00FFFFFF) 709 #define PERMANENT_FIRST (TPM_HC)(TPM_RH_FIRST) 710 #define PERMANENT_LAST (TPM_HC)(TPM_RH_LAST) 711 712 // 8 Attribute Structures 713 714 // Table 29 - TPMA_ALGORITHM Bits 715 typedef struct { 716 uint32_t asymmetric : 1; 717 uint32_t symmetric : 1; 718 uint32_t hash : 1; 719 uint32_t object : 1; 720 uint32_t reserved4_7 : 4; 721 uint32_t signing : 1; 722 uint32_t encrypting : 1; 723 uint32_t method : 1; 724 uint32_t reserved11_31 : 21; 725 } TPMA_ALGORITHM; 726 727 // Table 30 - TPMA_OBJECT Bits 728 typedef struct { 729 uint32_t reserved1 : 1; 730 uint32_t fixedTPM : 1; 731 uint32_t stClear : 1; 732 uint32_t reserved4 : 1; 733 uint32_t fixedParent : 1; 734 uint32_t sensitiveDataOrigin : 1; 735 uint32_t userWithAuth : 1; 736 uint32_t adminWithPolicy : 1; 737 uint32_t reserved8_9 : 2; 738 uint32_t noDA : 1; 739 uint32_t encryptedDuplication : 1; 740 uint32_t reserved12_15 : 4; 741 uint32_t restricted : 1; 742 uint32_t decrypt : 1; 743 uint32_t sign : 1; 744 uint32_t reserved19_31 : 13; 745 } TPMA_OBJECT; 746 747 // Table 31 - TPMA_SESSION Bits 748 typedef struct { 749 byte continueSession : 1; 750 byte auditExclusive : 1; 751 byte auditReset : 1; 752 byte reserved3_4 : 2; 753 byte decrypt : 1; 754 byte encrypt : 1; 755 byte audit : 1; 756 } TPMA_SESSION; 757 758 // Table 32 - TPMA_LOCALITY Bits 759 // 760 // NOTE: Use low case here to resolve conflict 761 // 762 typedef struct { 763 byte locZero : 1; 764 byte locOne : 1; 765 byte locTwo : 1; 766 byte locThree : 1; 767 byte locFour : 1; 768 byte Extended : 3; 769 } TPMA_LOCALITY; 770 771 // Table 33 - TPMA_PERMANENT Bits 772 typedef struct { 773 uint32_t ownerAuthSet : 1; 774 uint32_t endorsementAuthSet : 1; 775 uint32_t lockoutAuthSet : 1; 776 uint32_t reserved3_7 : 5; 777 uint32_t disableClear : 1; 778 uint32_t inLockout : 1; 779 uint32_t tpmGeneratedEPS : 1; 780 uint32_t reserved11_31 : 21; 781 } TPMA_PERMANENT; 782 783 // Table 34 - TPMA_STARTUP_CLEAR Bits 784 typedef struct { 785 uint32_t phEnable : 1; 786 uint32_t shEnable : 1; 787 uint32_t ehEnable : 1; 788 uint32_t reserved3_30 : 28; 789 uint32_t orderly : 1; 790 } TPMA_STARTUP_CLEAR; 791 792 // Table 35 - TPMA_MEMORY Bits 793 typedef struct { 794 uint32_t sharedRAM : 1; 795 uint32_t sharedNV : 1; 796 uint32_t objectCopiedToRam : 1; 797 uint32_t reserved3_31 : 29; 798 } TPMA_MEMORY; 799 800 // Table 36 - TPMA_CC Bits 801 typedef struct { 802 uint32_t commandIndex : 16; 803 uint32_t reserved16_21 : 6; 804 uint32_t nv : 1; 805 uint32_t extensive : 1; 806 uint32_t flushed : 1; 807 uint32_t cHandles : 3; 808 uint32_t rHandle : 1; 809 uint32_t V : 1; 810 uint32_t Res : 2; 811 } TPMA_CC; 812 813 // 9 Interface Types 814 815 // Table 37 - TPMI_YES_NO Type 816 typedef BYTE TPMI_YES_NO; 817 818 // Table 38 - TPMI_DH_OBJECT Type 819 typedef TPM_HANDLE TPMI_DH_OBJECT; 820 821 // Table 39 - TPMI_DH_PERSISTENT Type 822 typedef TPM_HANDLE TPMI_DH_PERSISTENT; 823 824 // Table 40 - TPMI_DH_ENTITY Type 825 typedef TPM_HANDLE TPMI_DH_ENTITY; 826 827 // Table 41 - TPMI_DH_PCR Type 828 typedef TPM_HANDLE TPMI_DH_PCR; 829 830 // Table 42 - TPMI_SH_AUTH_SESSION Type 831 typedef TPM_HANDLE TPMI_SH_AUTH_SESSION; 832 833 // Table 43 - TPMI_SH_HMAC Type 834 typedef TPM_HANDLE TPMI_SH_HMAC; 835 836 // Table 44 - TPMI_SH_POLICY Type 837 typedef TPM_HANDLE TPMI_SH_POLICY; 838 839 // Table 45 - TPMI_DH_CONTEXT Type 840 typedef TPM_HANDLE TPMI_DH_CONTEXT; 841 842 // Table 46 - TPMI_RH_HIERARCHY Type 843 typedef TPM_HANDLE TPMI_RH_HIERARCHY; 844 845 // Table 47 - TPMI_RH_HIERARCHY_AUTH Type 846 typedef TPM_HANDLE TPMI_RH_HIERARCHY_AUTH; 847 848 // Table 48 - TPMI_RH_PLATFORM Type 849 typedef TPM_HANDLE TPMI_RH_PLATFORM; 850 851 // Table 49 - TPMI_RH_OWNER Type 852 typedef TPM_HANDLE TPMI_RH_OWNER; 853 854 // Table 50 - TPMI_RH_ENDORSEMENT Type 855 typedef TPM_HANDLE TPMI_RH_ENDORSEMENT; 856 857 // Table 51 - TPMI_RH_PROVISION Type 858 typedef TPM_HANDLE TPMI_RH_PROVISION; 859 860 // Table 52 - TPMI_RH_CLEAR Type 861 typedef TPM_HANDLE TPMI_RH_CLEAR; 862 863 // Table 53 - TPMI_RH_NV_AUTH Type 864 typedef TPM_HANDLE TPMI_RH_NV_AUTH; 865 866 // Table 54 - TPMI_RH_LOCKOUT Type 867 typedef TPM_HANDLE TPMI_RH_LOCKOUT; 868 869 // Table 55 - TPMI_RH_NV_INDEX Type 870 typedef TPM_HANDLE TPMI_RH_NV_INDEX; 871 872 // Table 56 - TPMI_ALG_HASH Type 873 typedef TPM_ALG_ID TPMI_ALG_HASH; 874 875 // Table 57 - TPMI_ALG_ASYM Type 876 typedef TPM_ALG_ID TPMI_ALG_ASYM; 877 878 // Table 58 - TPMI_ALG_SYM Type 879 typedef TPM_ALG_ID TPMI_ALG_SYM; 880 881 // Table 59 - TPMI_ALG_SYM_OBJECT Type 882 typedef TPM_ALG_ID TPMI_ALG_SYM_OBJECT; 883 884 // Table 60 - TPMI_ALG_SYM_MODE Type 885 typedef TPM_ALG_ID TPMI_ALG_SYM_MODE; 886 887 // Table 61 - TPMI_ALG_KDF Type 888 typedef TPM_ALG_ID TPMI_ALG_KDF; 889 890 // Table 62 - TPMI_ALG_SIG_SCHEME Type 891 typedef TPM_ALG_ID TPMI_ALG_SIG_SCHEME; 892 893 // Table 63 - TPMI_ECC_KEY_EXCHANGE Type 894 typedef TPM_ALG_ID TPMI_ECC_KEY_EXCHANGE; 895 896 // Table 64 - TPMI_ST_COMMAND_TAG Type 897 typedef TPM_ST TPMI_ST_COMMAND_TAG; 898 899 // 10 Structure Definitions 900 901 // Table 65 - TPMS_ALGORITHM_DESCRIPTION Structure 902 typedef struct { 903 TPM_ALG_ID alg; 904 TPMA_ALGORITHM attributes; 905 } TPMS_ALGORITHM_DESCRIPTION; 906 907 // Table 66 - TPMU_HA Union 908 typedef union { 909 BYTE sha1[SHA1_DIGEST_SIZE]; 910 BYTE sha256[SHA256_DIGEST_SIZE]; 911 BYTE sm3_256[SM3_256_DIGEST_SIZE]; 912 BYTE sha384[SHA384_DIGEST_SIZE]; 913 BYTE sha512[SHA512_DIGEST_SIZE]; 914 } TPMU_HA; 915 916 // Table 67 - TPMT_HA Structure 917 typedef struct { 918 TPMI_ALG_HASH hashAlg; 919 TPMU_HA digest; 920 } TPMT_HA; 921 922 // Table 68 - TPM2B_DIGEST Structure 923 typedef struct { 924 uint16_t size; 925 BYTE buffer[sizeof(TPMU_HA)]; 926 } TPM2B_DIGEST; 927 928 // Table 69 - TPM2B_DATA Structure 929 typedef struct { 930 uint16_t size; 931 BYTE buffer[sizeof(TPMT_HA)]; 932 } TPM2B_DATA; 933 934 // Table 70 - TPM2B_NONCE Types 935 typedef TPM2B_DIGEST TPM2B_NONCE; 936 937 // Table 71 - TPM2B_AUTH Types 938 typedef TPM2B_DIGEST TPM2B_AUTH; 939 940 // Table 72 - TPM2B_OPERAND Types 941 typedef TPM2B_DIGEST TPM2B_OPERAND; 942 943 // Table 73 - TPM2B_EVENT Structure 944 typedef struct { 945 uint16_t size; 946 BYTE buffer[1024]; 947 } TPM2B_EVENT; 948 949 // Table 74 - TPM2B_MAX_BUFFER Structure 950 typedef struct { 951 uint16_t size; 952 BYTE buffer[MAX_DIGEST_BUFFER]; 953 } TPM2B_MAX_BUFFER; 954 955 // Table 75 - TPM2B_MAX_NV_BUFFER Structure 956 typedef struct { 957 uint16_t size; 958 BYTE buffer[MAX_NV_INDEX_SIZE]; 959 } TPM2B_MAX_NV_BUFFER; 960 961 // Table 76 - TPM2B_TIMEOUT Structure 962 typedef struct { 963 uint16_t size; 964 BYTE buffer[sizeof(uint64_t)]; 965 } TPM2B_TIMEOUT; 966 967 // Table 77 -- TPM2B_IV Structure <I/O> 968 typedef struct { 969 uint16_t size; 970 BYTE buffer[MAX_SYM_BLOCK_SIZE]; 971 } TPM2B_IV; 972 973 // Table 78 - TPMU_NAME Union 974 typedef union { 975 TPMT_HA digest; 976 TPM_HANDLE handle; 977 } TPMU_NAME; 978 979 // Table 79 - TPM2B_NAME Structure 980 typedef struct { 981 uint16_t size; 982 BYTE name[sizeof(TPMU_NAME)]; 983 } TPM2B_NAME; 984 985 // Table 80 - TPMS_PCR_SELECT Structure 986 typedef struct { 987 byte sizeofSelect; 988 BYTE pcrSelect[PCR_SELECT_MAX]; 989 } TPMS_PCR_SELECT; 990 991 // Table 81 - TPMS_PCR_SELECTION Structure 992 typedef struct { 993 TPMI_ALG_HASH hash; 994 byte sizeofSelect; 995 BYTE pcrSelect[PCR_SELECT_MAX]; 996 } TPMS_PCR_SELECTION; 997 998 // Table 84 - TPMT_TK_CREATION Structure 999 typedef struct { 1000 TPM_ST tag; 1001 TPMI_RH_HIERARCHY hierarchy; 1002 TPM2B_DIGEST digest; 1003 } TPMT_TK_CREATION; 1004 1005 // Table 85 - TPMT_TK_VERIFIED Structure 1006 typedef struct { 1007 TPM_ST tag; 1008 TPMI_RH_HIERARCHY hierarchy; 1009 TPM2B_DIGEST digest; 1010 } TPMT_TK_VERIFIED; 1011 1012 // Table 86 - TPMT_TK_AUTH Structure 1013 typedef struct { 1014 TPM_ST tag; 1015 TPMI_RH_HIERARCHY hierarchy; 1016 TPM2B_DIGEST digest; 1017 } TPMT_TK_AUTH; 1018 1019 // Table 87 - TPMT_TK_HASHCHECK Structure 1020 typedef struct { 1021 TPM_ST tag; 1022 TPMI_RH_HIERARCHY hierarchy; 1023 TPM2B_DIGEST digest; 1024 } TPMT_TK_HASHCHECK; 1025 1026 // Table 88 - TPMS_ALG_PROPERTY Structure 1027 typedef struct { 1028 TPM_ALG_ID alg; 1029 TPMA_ALGORITHM algProperties; 1030 } TPMS_ALG_PROPERTY; 1031 1032 // Table 89 - TPMS_TAGGED_PROPERTY Structure 1033 typedef struct { 1034 TPM_PT property; 1035 uint32_t value; 1036 } TPMS_TAGGED_PROPERTY; 1037 1038 // Table 90 - TPMS_TAGGED_PCR_SELECT Structure 1039 typedef struct { 1040 TPM_PT tag; 1041 byte sizeofSelect; 1042 BYTE pcrSelect[PCR_SELECT_MAX]; 1043 } TPMS_TAGGED_PCR_SELECT; 1044 1045 // Table 91 - TPML_CC Structure 1046 typedef struct { 1047 uint32_t count; 1048 TPM_CC commandCodes[MAX_CAP_CC]; 1049 } TPML_CC; 1050 1051 // Table 92 - TPML_CCA Structure 1052 typedef struct { 1053 uint32_t count; 1054 TPMA_CC commandAttributes[MAX_CAP_CC]; 1055 } TPML_CCA; 1056 1057 // Table 93 - TPML_ALG Structure 1058 typedef struct { 1059 uint32_t count; 1060 TPM_ALG_ID algorithms[MAX_ALG_LIST_SIZE]; 1061 } TPML_ALG; 1062 1063 // Table 94 - TPML_HANDLE Structure 1064 typedef struct { 1065 uint32_t count; 1066 TPM_HANDLE handle[MAX_CAP_HANDLES]; 1067 } TPML_HANDLE; 1068 1069 // Table 95 - TPML_DIGEST Structure 1070 typedef struct { 1071 uint32_t count; 1072 TPM2B_DIGEST digests[8]; 1073 } TPML_DIGEST; 1074 1075 // Table 96 -- TPML_DIGEST_VALUES Structure <I/O> 1076 typedef struct { 1077 uint32_t count; 1078 TPMT_HA digests[HASH_COUNT]; 1079 } TPML_DIGEST_VALUES; 1080 1081 // Table 97 - TPM2B_DIGEST_VALUES Structure 1082 typedef struct { 1083 uint16_t size; 1084 BYTE buffer[sizeof(TPML_DIGEST_VALUES)]; 1085 } TPM2B_DIGEST_VALUES; 1086 1087 // Table 98 - TPML_PCR_SELECTION Structure 1088 typedef struct { 1089 uint32_t count; 1090 TPMS_PCR_SELECTION pcrSelections[HASH_COUNT]; 1091 } TPML_PCR_SELECTION; 1092 1093 // Table 99 - TPML_ALG_PROPERTY Structure 1094 typedef struct { 1095 uint32_t count; 1096 TPMS_ALG_PROPERTY algProperties[MAX_CAP_ALGS]; 1097 } TPML_ALG_PROPERTY; 1098 1099 // Table 100 - TPML_TAGGED_TPM_PROPERTY Structure 1100 typedef struct { 1101 uint32_t count; 1102 TPMS_TAGGED_PROPERTY tpmProperty[MAX_TPM_PROPERTIES]; 1103 } TPML_TAGGED_TPM_PROPERTY; 1104 1105 // Table 101 - TPML_TAGGED_PCR_PROPERTY Structure 1106 typedef struct { 1107 uint32_t count; 1108 TPMS_TAGGED_PCR_SELECT pcrProperty[MAX_PCR_PROPERTIES]; 1109 } TPML_TAGGED_PCR_PROPERTY; 1110 1111 // Table 102 - TPML_ECC_CURVE Structure 1112 typedef struct { 1113 uint32_t count; 1114 TPM_ECC_CURVE eccCurves[MAX_ECC_CURVES]; 1115 } TPML_ECC_CURVE; 1116 1117 // Table 103 - TPMU_CAPABILITIES Union 1118 typedef union { 1119 TPML_ALG_PROPERTY algorithms; 1120 TPML_HANDLE handles; 1121 TPML_CCA command; 1122 TPML_CC ppCommands; 1123 TPML_CC auditCommands; 1124 TPML_PCR_SELECTION assignedPCR; 1125 TPML_TAGGED_TPM_PROPERTY tpmProperties; 1126 TPML_TAGGED_PCR_PROPERTY pcrProperties; 1127 TPML_ECC_CURVE eccCurves; 1128 } TPMU_CAPABILITIES; 1129 1130 // Table 104 - TPMS_CAPABILITY_DATA Structure 1131 typedef struct { 1132 TPM_CAP capability; 1133 TPMU_CAPABILITIES data; 1134 } TPMS_CAPABILITY_DATA; 1135 1136 // Table 105 - TPMS_CLOCK_INFO Structure 1137 typedef struct { 1138 uint64_t clock; 1139 uint32_t resetCount; 1140 uint32_t restartCount; 1141 TPMI_YES_NO safe; 1142 } TPMS_CLOCK_INFO; 1143 1144 // Table 106 - TPMS_TIME_INFO Structure 1145 typedef struct { 1146 uint64_t time; 1147 TPMS_CLOCK_INFO clockInfo; 1148 } TPMS_TIME_INFO; 1149 1150 // Table 107 - TPMS_TIME_ATTEST_INFO Structure 1151 typedef struct { 1152 TPMS_TIME_INFO time; 1153 uint64_t firmwareVersion; 1154 } TPMS_TIME_ATTEST_INFO; 1155 1156 // Table 108 - TPMS_CERTIFY_INFO Structure 1157 typedef struct { 1158 TPM2B_NAME name; 1159 TPM2B_NAME qualifiedName; 1160 } TPMS_CERTIFY_INFO; 1161 1162 // Table 109 - TPMS_QUOTE_INFO Structure 1163 typedef struct { 1164 TPML_PCR_SELECTION pcrSelect; 1165 TPM2B_DIGEST pcrDigest; 1166 } TPMS_QUOTE_INFO; 1167 1168 // Table 110 - TPMS_COMMAND_AUDIT_INFO Structure 1169 typedef struct { 1170 uint64_t auditCounter; 1171 TPM_ALG_ID digestAlg; 1172 TPM2B_DIGEST auditDigest; 1173 TPM2B_DIGEST commandDigest; 1174 } TPMS_COMMAND_AUDIT_INFO; 1175 1176 // Table 111 - TPMS_SESSION_AUDIT_INFO Structure 1177 typedef struct { 1178 TPMI_YES_NO exclusiveSession; 1179 TPM2B_DIGEST sessionDigest; 1180 } TPMS_SESSION_AUDIT_INFO; 1181 1182 // Table 112 - TPMS_CREATION_INFO Structure 1183 typedef struct { 1184 TPM2B_NAME objectName; 1185 TPM2B_DIGEST creationHash; 1186 } TPMS_CREATION_INFO; 1187 1188 // Table 113 - TPMS_NV_CERTIFY_INFO Structure 1189 typedef struct { 1190 TPM2B_NAME indexName; 1191 uint16_t offset; 1192 TPM2B_MAX_NV_BUFFER nvContents; 1193 } TPMS_NV_CERTIFY_INFO; 1194 1195 // Table 114 - TPMI_ST_ATTEST Type 1196 typedef TPM_ST TPMI_ST_ATTEST; 1197 1198 // Table 115 - TPMU_ATTEST Union 1199 typedef union { 1200 TPMS_CERTIFY_INFO certify; 1201 TPMS_CREATION_INFO creation; 1202 TPMS_QUOTE_INFO quote; 1203 TPMS_COMMAND_AUDIT_INFO commandAudit; 1204 TPMS_SESSION_AUDIT_INFO sessionAudit; 1205 TPMS_TIME_ATTEST_INFO time; 1206 TPMS_NV_CERTIFY_INFO nv; 1207 } TPMU_ATTEST; 1208 1209 // Table 116 - TPMS_ATTEST Structure 1210 typedef struct { 1211 TPM_GENERATED magic; 1212 TPMI_ST_ATTEST type; 1213 TPM2B_NAME qualifiedSigner; 1214 TPM2B_DATA extraData; 1215 TPMS_CLOCK_INFO clockInfo; 1216 uint64_t firmwareVersion; 1217 TPMU_ATTEST attested; 1218 } TPMS_ATTEST; 1219 1220 // Table 117 - TPM2B_ATTEST Structure 1221 typedef struct { 1222 uint16_t size; 1223 BYTE attestationData[sizeof(TPMS_ATTEST)]; 1224 } TPM2B_ATTEST; 1225 1226 // Table 118 - TPMS_AUTH_COMMAND Structure 1227 typedef struct { 1228 TPMI_SH_AUTH_SESSION sessionHandle; 1229 TPM2B_NONCE nonce; 1230 TPMA_SESSION sessionAttributes; 1231 TPM2B_AUTH hmac; 1232 } TPMS_AUTH_COMMAND; 1233 1234 // Table 119 - TPMS_AUTH_RESPONSE Structure 1235 typedef struct { 1236 TPM2B_NONCE nonce; 1237 TPMA_SESSION sessionAttributes; 1238 TPM2B_AUTH hmac; 1239 } TPMS_AUTH_RESPONSE; 1240 1241 // 11 Algorithm Parameters and Structures 1242 1243 // Table 120 - TPMI_AES_KEY_BITS Type 1244 typedef TPM_KEY_BITS TPMI_AES_KEY_BITS; 1245 1246 // Table 121 - TPMI_SM4_KEY_BITS Type 1247 typedef TPM_KEY_BITS TPMI_SM4_KEY_BITS; 1248 1249 // Table 122 - TPMU_SYM_KEY_BITS Union 1250 typedef union { 1251 TPMI_AES_KEY_BITS aes; 1252 TPMI_SM4_KEY_BITS SM4; 1253 TPM_KEY_BITS sym; 1254 TPMI_ALG_HASH xor_; 1255 } TPMU_SYM_KEY_BITS; 1256 1257 // Table 123 - TPMU_SYM_MODE Union 1258 typedef union { 1259 TPMI_ALG_SYM_MODE aes; 1260 TPMI_ALG_SYM_MODE SM4; 1261 TPMI_ALG_SYM_MODE sym; 1262 } TPMU_SYM_MODE; 1263 1264 // Table 125 - TPMT_SYM_DEF Structure 1265 typedef struct { 1266 TPMI_ALG_SYM algorithm; 1267 TPMU_SYM_KEY_BITS keyBits; 1268 TPMU_SYM_MODE mode; 1269 } TPMT_SYM_DEF; 1270 1271 // Table 126 - TPMT_SYM_DEF_OBJECT Structure 1272 typedef struct { 1273 TPMI_ALG_SYM_OBJECT algorithm; 1274 TPMU_SYM_KEY_BITS keyBits; 1275 TPMU_SYM_MODE mode; 1276 } TPMT_SYM_DEF_OBJECT; 1277 1278 // Table 127 - TPM2B_SYM_KEY Structure 1279 typedef struct { 1280 uint16_t size; 1281 BYTE buffer[MAX_SYM_KEY_BYTES]; 1282 } TPM2B_SYM_KEY; 1283 1284 // Table 128 - TPMS_SYMCIPHER_PARMS Structure 1285 typedef struct { 1286 TPMT_SYM_DEF_OBJECT sym; 1287 } TPMS_SYMCIPHER_PARMS; 1288 1289 // Table 129 - TPM2B_SENSITIVE_DATA Structure 1290 typedef struct { 1291 uint16_t size; 1292 BYTE buffer[MAX_SYM_DATA]; 1293 } TPM2B_SENSITIVE_DATA; 1294 1295 // Table 130 - TPMS_SENSITIVE_CREATE Structure 1296 typedef struct { 1297 TPM2B_AUTH userAuth; 1298 TPM2B_SENSITIVE_DATA data; 1299 } TPMS_SENSITIVE_CREATE; 1300 1301 // Table 131 - TPM2B_SENSITIVE_CREATE Structure 1302 typedef struct { 1303 uint16_t size; 1304 TPMS_SENSITIVE_CREATE sensitive; 1305 } TPM2B_SENSITIVE_CREATE; 1306 1307 // Table 132 - TPMS_SCHEME_SIGHASH Structure 1308 typedef struct { 1309 TPMI_ALG_HASH hashAlg; 1310 } TPMS_SCHEME_SIGHASH; 1311 1312 // Table 133 - TPMI_ALG_KEYEDHASH_SCHEME Type 1313 typedef TPM_ALG_ID TPMI_ALG_KEYEDHASH_SCHEME; 1314 1315 // Table 134 - HMAC_SIG_SCHEME Types 1316 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_HMAC; 1317 1318 // Table 135 - TPMS_SCHEME_XOR Structure 1319 typedef struct { 1320 TPMI_ALG_HASH hashAlg; 1321 TPMI_ALG_KDF kdf; 1322 } TPMS_SCHEME_XOR; 1323 1324 // Table 136 - TPMU_SCHEME_KEYEDHASH Union 1325 typedef union { 1326 TPMS_SCHEME_HMAC hmac; 1327 TPMS_SCHEME_XOR xor_; 1328 } TPMU_SCHEME_KEYEDHASH; 1329 1330 // Table 137 - TPMT_KEYEDHASH_SCHEME Structure 1331 typedef struct { 1332 TPMI_ALG_KEYEDHASH_SCHEME scheme; 1333 TPMU_SCHEME_KEYEDHASH details; 1334 } TPMT_KEYEDHASH_SCHEME; 1335 1336 // Table 138 - RSA_SIG_SCHEMES Types 1337 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSASSA; 1338 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSAPSS; 1339 1340 // Table 139 - ECC_SIG_SCHEMES Types 1341 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_ECDSA; 1342 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_SM2; 1343 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_ECSCHNORR; 1344 1345 // Table 140 - TPMS_SCHEME_ECDAA Structure 1346 typedef struct { 1347 TPMI_ALG_HASH hashAlg; 1348 uint16_t count; 1349 } TPMS_SCHEME_ECDAA; 1350 1351 // Table 141 - TPMU_SIG_SCHEME Union 1352 typedef union { 1353 TPMS_SCHEME_RSASSA rsassa; 1354 TPMS_SCHEME_RSAPSS rsapss; 1355 TPMS_SCHEME_ECDSA ecdsa; 1356 TPMS_SCHEME_ECDAA ecdaa; 1357 TPMS_SCHEME_ECSCHNORR ecSchnorr; 1358 TPMS_SCHEME_HMAC hmac; 1359 TPMS_SCHEME_SIGHASH any; 1360 } TPMU_SIG_SCHEME; 1361 1362 // Table 142 - TPMT_SIG_SCHEME Structure 1363 typedef struct { 1364 TPMI_ALG_SIG_SCHEME scheme; 1365 TPMU_SIG_SCHEME details; 1366 } TPMT_SIG_SCHEME; 1367 1368 // Table 143 - TPMS_SCHEME_OAEP Structure 1369 typedef struct { 1370 TPMI_ALG_HASH hashAlg; 1371 } TPMS_SCHEME_OAEP; 1372 1373 // Table 144 - TPMS_SCHEME_ECDH Structure 1374 typedef struct { 1375 TPMI_ALG_HASH hashAlg; 1376 } TPMS_SCHEME_ECDH; 1377 1378 // Table 145 - TPMS_SCHEME_MGF1 Structure 1379 typedef struct { 1380 TPMI_ALG_HASH hashAlg; 1381 } TPMS_SCHEME_MGF1; 1382 1383 // Table 146 - TPMS_SCHEME_KDF1_SP800_56a Structure 1384 typedef struct { 1385 TPMI_ALG_HASH hashAlg; 1386 } TPMS_SCHEME_KDF1_SP800_56a; 1387 1388 // Table 147 - TPMS_SCHEME_KDF2 Structure 1389 typedef struct { 1390 TPMI_ALG_HASH hashAlg; 1391 } TPMS_SCHEME_KDF2; 1392 1393 // Table 148 - TPMS_SCHEME_KDF1_SP800_108 Structure 1394 typedef struct { 1395 TPMI_ALG_HASH hashAlg; 1396 } TPMS_SCHEME_KDF1_SP800_108; 1397 1398 // Table 149 - TPMU_KDF_SCHEME Union 1399 typedef union { 1400 TPMS_SCHEME_MGF1 mgf1; 1401 TPMS_SCHEME_KDF1_SP800_56a kdf1_SP800_56a; 1402 TPMS_SCHEME_KDF2 kdf2; 1403 TPMS_SCHEME_KDF1_SP800_108 kdf1_sp800_108; 1404 } TPMU_KDF_SCHEME; 1405 1406 // Table 150 - TPMT_KDF_SCHEME Structure 1407 typedef struct { 1408 TPMI_ALG_KDF scheme; 1409 TPMU_KDF_SCHEME details; 1410 } TPMT_KDF_SCHEME; 1411 1412 // Table 151 - TPMI_ALG_ASYM_SCHEME Type 1413 typedef TPM_ALG_ID TPMI_ALG_ASYM_SCHEME; 1414 1415 // Table 152 - TPMU_ASYM_SCHEME Union 1416 typedef union { 1417 TPMS_SCHEME_RSASSA rsassa; 1418 TPMS_SCHEME_RSAPSS rsapss; 1419 TPMS_SCHEME_OAEP oaep; 1420 TPMS_SCHEME_ECDSA ecdsa; 1421 TPMS_SCHEME_ECDAA ecdaa; 1422 TPMS_SCHEME_ECSCHNORR ecSchnorr; 1423 TPMS_SCHEME_SIGHASH anySig; 1424 } TPMU_ASYM_SCHEME; 1425 1426 // Table 153 - TPMT_ASYM_SCHEME Structure 1427 typedef struct { 1428 TPMI_ALG_ASYM_SCHEME scheme; 1429 TPMU_ASYM_SCHEME details; 1430 } TPMT_ASYM_SCHEME; 1431 1432 // Table 154 - TPMI_ALG_RSA_SCHEME Type 1433 typedef TPM_ALG_ID TPMI_ALG_RSA_SCHEME; 1434 1435 // Table 155 - TPMT_RSA_SCHEME Structure 1436 typedef struct { 1437 TPMI_ALG_RSA_SCHEME scheme; 1438 TPMU_ASYM_SCHEME details; 1439 } TPMT_RSA_SCHEME; 1440 1441 // Table 156 - TPMI_ALG_RSA_DECRYPT Type 1442 typedef TPM_ALG_ID TPMI_ALG_RSA_DECRYPT; 1443 1444 // Table 157 - TPMT_RSA_DECRYPT Structure 1445 typedef struct { 1446 TPMI_ALG_RSA_DECRYPT scheme; 1447 TPMU_ASYM_SCHEME details; 1448 } TPMT_RSA_DECRYPT; 1449 1450 // Table 158 - TPM2B_PUBLIC_KEY_RSA Structure 1451 typedef struct { 1452 uint16_t size; 1453 BYTE buffer[MAX_RSA_KEY_BYTES]; 1454 } TPM2B_PUBLIC_KEY_RSA; 1455 1456 // Table 159 - TPMI_RSA_KEY_BITS Type 1457 typedef TPM_KEY_BITS TPMI_RSA_KEY_BITS; 1458 1459 // Table 160 - TPM2B_PRIVATE_KEY_RSA Structure 1460 typedef struct { 1461 uint16_t size; 1462 BYTE buffer[MAX_RSA_KEY_BYTES/2]; 1463 } TPM2B_PRIVATE_KEY_RSA; 1464 1465 // Table 161 - TPM2B_ECC_PARAMETER Structure 1466 typedef struct { 1467 uint16_t size; 1468 BYTE buffer[MAX_ECC_KEY_BYTES]; 1469 } TPM2B_ECC_PARAMETER; 1470 1471 // Table 162 - TPMS_ECC_POINT Structure 1472 typedef struct { 1473 TPM2B_ECC_PARAMETER x; 1474 TPM2B_ECC_PARAMETER y; 1475 } TPMS_ECC_POINT; 1476 1477 // Table 163 -- TPM2B_ECC_POINT Structure <I/O> 1478 typedef struct { 1479 uint16_t size; 1480 TPMS_ECC_POINT point; 1481 } TPM2B_ECC_POINT; 1482 1483 // Table 164 - TPMI_ALG_ECC_SCHEME Type 1484 typedef TPM_ALG_ID TPMI_ALG_ECC_SCHEME; 1485 1486 // Table 165 - TPMI_ECC_CURVE Type 1487 typedef TPM_ECC_CURVE TPMI_ECC_CURVE; 1488 1489 // Table 166 - TPMT_ECC_SCHEME Structure 1490 typedef struct { 1491 TPMI_ALG_ECC_SCHEME scheme; 1492 TPMU_SIG_SCHEME details; 1493 } TPMT_ECC_SCHEME; 1494 1495 // Table 167 - TPMS_ALGORITHM_DETAIL_ECC Structure 1496 typedef struct { 1497 TPM_ECC_CURVE curveID; 1498 uint16_t keySize; 1499 TPMT_KDF_SCHEME kdf; 1500 TPMT_ECC_SCHEME sign; 1501 TPM2B_ECC_PARAMETER p; 1502 TPM2B_ECC_PARAMETER a; 1503 TPM2B_ECC_PARAMETER b; 1504 TPM2B_ECC_PARAMETER gX; 1505 TPM2B_ECC_PARAMETER gY; 1506 TPM2B_ECC_PARAMETER n; 1507 TPM2B_ECC_PARAMETER h; 1508 } TPMS_ALGORITHM_DETAIL_ECC; 1509 1510 // Table 168 - TPMS_SIGNATURE_RSASSA Structure 1511 typedef struct { 1512 TPMI_ALG_HASH hash; 1513 TPM2B_PUBLIC_KEY_RSA sig; 1514 } TPMS_SIGNATURE_RSASSA; 1515 1516 // Table 169 - TPMS_SIGNATURE_RSAPSS Structure 1517 typedef struct { 1518 TPMI_ALG_HASH hash; 1519 TPM2B_PUBLIC_KEY_RSA sig; 1520 } TPMS_SIGNATURE_RSAPSS; 1521 1522 // Table 170 - TPMS_SIGNATURE_ECDSA Structure 1523 typedef struct { 1524 TPMI_ALG_HASH hash; 1525 TPM2B_ECC_PARAMETER signatureR; 1526 TPM2B_ECC_PARAMETER signatureS; 1527 } TPMS_SIGNATURE_ECDSA; 1528 1529 // Table 171 - TPMU_SIGNATURE Union 1530 typedef union { 1531 TPMS_SIGNATURE_RSASSA rsassa; 1532 TPMS_SIGNATURE_RSAPSS rsapss; 1533 TPMS_SIGNATURE_ECDSA ecdsa; 1534 TPMS_SIGNATURE_ECDSA sm2; 1535 TPMS_SIGNATURE_ECDSA ecdaa; 1536 TPMS_SIGNATURE_ECDSA ecschnorr; 1537 TPMT_HA hmac; 1538 TPMS_SCHEME_SIGHASH any; 1539 } TPMU_SIGNATURE; 1540 1541 // Table 172 - TPMT_SIGNATURE Structure 1542 typedef struct { 1543 TPMI_ALG_SIG_SCHEME sigAlg; 1544 TPMU_SIGNATURE signature; 1545 } TPMT_SIGNATURE; 1546 1547 // Table 173 - TPMU_ENCRYPTED_SECRET Union 1548 typedef union { 1549 BYTE ecc[sizeof(TPMS_ECC_POINT)]; 1550 BYTE rsa[MAX_RSA_KEY_BYTES]; 1551 BYTE symmetric[sizeof(TPM2B_DIGEST)]; 1552 BYTE keyedHash[sizeof(TPM2B_DIGEST)]; 1553 } TPMU_ENCRYPTED_SECRET; 1554 1555 // Table 174 - TPM2B_ENCRYPTED_SECRET Structure 1556 typedef struct { 1557 uint16_t size; 1558 BYTE secret[sizeof(TPMU_ENCRYPTED_SECRET)]; 1559 } TPM2B_ENCRYPTED_SECRET; 1560 1561 // 12 Key/Object Complex 1562 1563 // Table 175 - TPMI_ALG_PUBLIC Type 1564 typedef TPM_ALG_ID TPMI_ALG_PUBLIC; 1565 1566 // Table 176 - TPMU_PUBLIC_ID Union 1567 typedef union { 1568 TPM2B_DIGEST keyedHash; 1569 TPM2B_DIGEST sym; 1570 TPM2B_PUBLIC_KEY_RSA rsa; 1571 TPMS_ECC_POINT ecc; 1572 } TPMU_PUBLIC_ID; 1573 1574 // Table 177 - TPMS_KEYEDHASH_PARMS Structure 1575 typedef struct { 1576 TPMT_KEYEDHASH_SCHEME scheme; 1577 } TPMS_KEYEDHASH_PARMS; 1578 1579 // Table 178 - TPMS_ASYM_PARMS Structure 1580 typedef struct { 1581 TPMT_SYM_DEF_OBJECT symmetric; 1582 TPMT_ASYM_SCHEME scheme; 1583 } TPMS_ASYM_PARMS; 1584 1585 // Table 179 - TPMS_RSA_PARMS Structure 1586 typedef struct { 1587 TPMT_SYM_DEF_OBJECT symmetric; 1588 TPMT_RSA_SCHEME scheme; 1589 TPMI_RSA_KEY_BITS keyBits; 1590 uint32_t exponent; 1591 } TPMS_RSA_PARMS; 1592 1593 // Table 180 - TPMS_ECC_PARMS Structure 1594 typedef struct { 1595 TPMT_SYM_DEF_OBJECT symmetric; 1596 TPMT_ECC_SCHEME scheme; 1597 TPMI_ECC_CURVE curveID; 1598 TPMT_KDF_SCHEME kdf; 1599 } TPMS_ECC_PARMS; 1600 1601 // Table 181 - TPMU_PUBLIC_PARMS Union 1602 typedef union { 1603 TPMS_KEYEDHASH_PARMS keyedHashDetail; 1604 TPMT_SYM_DEF_OBJECT symDetail; 1605 TPMS_RSA_PARMS rsaDetail; 1606 TPMS_ECC_PARMS eccDetail; 1607 TPMS_ASYM_PARMS asymDetail; 1608 } TPMU_PUBLIC_PARMS; 1609 1610 // Table 182 - TPMT_PUBLIC_PARMS Structure 1611 typedef struct { 1612 TPMI_ALG_PUBLIC type; 1613 TPMU_PUBLIC_PARMS parameters; 1614 } TPMT_PUBLIC_PARMS; 1615 1616 // Table 183 - TPMT_PUBLIC Structure 1617 typedef struct { 1618 TPMI_ALG_PUBLIC type; 1619 TPMI_ALG_HASH nameAlg; 1620 TPMA_OBJECT objectAttributes; 1621 TPM2B_DIGEST authPolicy; 1622 TPMU_PUBLIC_PARMS parameters; 1623 TPMU_PUBLIC_ID unique; 1624 } TPMT_PUBLIC; 1625 1626 // Table 184 - TPM2B_PUBLIC Structure 1627 typedef struct { 1628 uint16_t size; 1629 TPMT_PUBLIC publicArea; 1630 } TPM2B_PUBLIC; 1631 1632 // Table 185 - TPM2B_PRIVATE_VENDOR_SPECIFIC Structure 1633 typedef struct { 1634 uint16_t size; 1635 BYTE buffer[PRIVATE_VENDOR_SPECIFIC_BYTES]; 1636 } TPM2B_PRIVATE_VENDOR_SPECIFIC; 1637 1638 // Table 186 - TPMU_SENSITIVE_COMPOSITE Union 1639 typedef union { 1640 TPM2B_PRIVATE_KEY_RSA rsa; 1641 TPM2B_ECC_PARAMETER ecc; 1642 TPM2B_SENSITIVE_DATA bits; 1643 TPM2B_SYM_KEY sym; 1644 TPM2B_PRIVATE_VENDOR_SPECIFIC any; 1645 } TPMU_SENSITIVE_COMPOSITE; 1646 1647 // Table 187 - TPMT_SENSITIVE Structure 1648 typedef struct { 1649 TPMI_ALG_PUBLIC sensitiveType; 1650 TPM2B_AUTH authValue; 1651 TPM2B_DIGEST seedValue; 1652 TPMU_SENSITIVE_COMPOSITE sensitive; 1653 } TPMT_SENSITIVE; 1654 1655 // Table 188 - TPM2B_SENSITIVE Structure 1656 typedef struct { 1657 uint16_t size; 1658 TPMT_SENSITIVE sensitiveArea; 1659 } TPM2B_SENSITIVE; 1660 1661 // Table 189 - _PRIVATE Structure 1662 typedef struct { 1663 TPM2B_DIGEST integrityOuter; 1664 TPM2B_DIGEST integrityInner; 1665 TPMT_SENSITIVE sensitive; 1666 } _PRIVATE; 1667 1668 // Table 190 - TPM2B_PRIVATE Structure 1669 typedef struct { 1670 uint16_t size; 1671 BYTE buffer[sizeof(_PRIVATE)]; 1672 } TPM2B_PRIVATE; 1673 1674 // Table 191 - _ID_OBJECT Structure 1675 typedef struct { 1676 TPM2B_DIGEST integrityHMAC; 1677 TPM2B_DIGEST encIdentity; 1678 } _ID_OBJECT; 1679 1680 // Table 192 - TPM2B_ID_OBJECT Structure 1681 typedef struct { 1682 uint16_t size; 1683 BYTE credential[sizeof(_ID_OBJECT)]; 1684 } TPM2B_ID_OBJECT; 1685 1686 // 13 NV Storage Structures 1687 1688 // Table 193 - TPM_NV_INDEX Bits 1689 // 1690 // NOTE: Comment here to resolve conflict 1691 // 1692 //typedef struct { 1693 // uint32_t index : 22; 1694 // uint32_t space : 2; 1695 // uint32_t RH_NV : 8; 1696 //} TPM_NV_INDEX; 1697 1698 // Table 195 - TPMA_NV Bits 1699 typedef struct { 1700 uint32_t TPMA_NV_PPWRITE : 1; 1701 uint32_t TPMA_NV_OWNERWRITE : 1; 1702 uint32_t TPMA_NV_AUTHWRITE : 1; 1703 uint32_t TPMA_NV_POLICYWRITE : 1; 1704 uint32_t TPMA_NV_COUNTER : 1; 1705 uint32_t TPMA_NV_BITS : 1; 1706 uint32_t TPMA_NV_EXTEND : 1; 1707 uint32_t reserved7_9 : 3; 1708 uint32_t TPMA_NV_POLICY_DELETE : 1; 1709 uint32_t TPMA_NV_WRITELOCKED : 1; 1710 uint32_t TPMA_NV_WRITEALL : 1; 1711 uint32_t TPMA_NV_WRITEDEFINE : 1; 1712 uint32_t TPMA_NV_WRITE_STCLEAR : 1; 1713 uint32_t TPMA_NV_GLOBALLOCK : 1; 1714 uint32_t TPMA_NV_PPREAD : 1; 1715 uint32_t TPMA_NV_OWNERREAD : 1; 1716 uint32_t TPMA_NV_AUTHREAD : 1; 1717 uint32_t TPMA_NV_POLICYREAD : 1; 1718 uint32_t reserved20_24 : 5; 1719 uint32_t TPMA_NV_NO_DA : 1; 1720 uint32_t TPMA_NV_ORDERLY : 1; 1721 uint32_t TPMA_NV_CLEAR_STCLEAR : 1; 1722 uint32_t TPMA_NV_READLOCKED : 1; 1723 uint32_t TPMA_NV_WRITTEN : 1; 1724 uint32_t TPMA_NV_PLATFORMCREATE : 1; 1725 uint32_t TPMA_NV_READ_STCLEAR : 1; 1726 } TPMA_NV; 1727 1728 // Table 196 - TPMS_NV_PUBLIC Structure 1729 typedef struct { 1730 TPMI_RH_NV_INDEX nvIndex; 1731 TPMI_ALG_HASH nameAlg; 1732 TPMA_NV attributes; 1733 TPM2B_DIGEST authPolicy; 1734 uint16_t dataSize; 1735 } TPMS_NV_PUBLIC; 1736 1737 // Table 197 - TPM2B_NV_PUBLIC Structure 1738 typedef struct { 1739 uint16_t size; 1740 TPMS_NV_PUBLIC nvPublic; 1741 } TPM2B_NV_PUBLIC; 1742 1743 // 14 Context Data 1744 1745 // Table 198 - TPM2B_CONTEXT_SENSITIVE Structure 1746 typedef struct { 1747 uint16_t size; 1748 BYTE buffer[MAX_CONTEXT_SIZE]; 1749 } TPM2B_CONTEXT_SENSITIVE; 1750 1751 // Table 199 - TPMS_CONTEXT_DATA Structure 1752 typedef struct { 1753 TPM2B_DIGEST integrity; 1754 TPM2B_CONTEXT_SENSITIVE encrypted; 1755 } TPMS_CONTEXT_DATA; 1756 1757 // Table 200 - TPM2B_CONTEXT_DATA Structure 1758 typedef struct { 1759 uint16_t size; 1760 BYTE buffer[sizeof(TPMS_CONTEXT_DATA)]; 1761 } TPM2B_CONTEXT_DATA; 1762 1763 // Table 201 - TPMS_CONTEXT Structure 1764 typedef struct { 1765 uint64_t sequence; 1766 TPMI_DH_CONTEXT savedHandle; 1767 TPMI_RH_HIERARCHY hierarchy; 1768 TPM2B_CONTEXT_DATA contextBlob; 1769 } TPMS_CONTEXT; 1770 1771 // 15 Creation Data 1772 1773 // Table 203 - TPMS_CREATION_DATA Structure 1774 typedef struct { 1775 TPML_PCR_SELECTION pcrSelect; 1776 TPM2B_DIGEST pcrDigest; 1777 TPMA_LOCALITY locality; 1778 TPM_ALG_ID parentNameAlg; 1779 TPM2B_NAME parentName; 1780 TPM2B_NAME parentQualifiedName; 1781 TPM2B_DATA outsideInfo; 1782 } TPMS_CREATION_DATA; 1783 1784 // Table 204 - TPM2B_CREATION_DATA Structure 1785 typedef struct { 1786 uint16_t size; 1787 TPMS_CREATION_DATA creationData; 1788 } TPM2B_CREATION_DATA; 1789 1790 1791 // 1792 // Command Header 1793 // 1794 typedef struct { 1795 TPM_ST tag; 1796 uint32_t paramSize; 1797 TPM_CC commandCode; 1798 } TPM2_COMMAND_HEADER; 1799 1800 typedef struct { 1801 TPM_ST tag; 1802 uint32_t paramSize; 1803 TPM_RC responseCode; 1804 } TPM2_RESPONSE_HEADER; 1805 1806 #pragma pack () 1807 1808 #endif