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