23#define SHA1_DIGEST_SIZE 20
24#define SHA1_BLOCK_SIZE 64
27#define SHA256_DIGEST_SIZE 32
28#define SHA256_BLOCK_SIZE 64
31#define SHA384_DIGEST_SIZE 48
32#define SHA384_BLOCK_SIZE 128
35#define SHA512_DIGEST_SIZE 64
36#define SHA512_BLOCK_SIZE 128
39#define SM3_256_DIGEST_SIZE 32
40#define SM3_256_BLOCK_SIZE 64
43#define MAX_SESSION_NUMBER 3
54#define MAX_RSA_KEY_BITS 2048
55#define MAX_RSA_KEY_BYTES ((MAX_RSA_KEY_BITS + 7) / 8)
58#define MAX_ECC_KEY_BITS 256
59#define MAX_ECC_KEY_BYTES ((MAX_ECC_KEY_BITS + 7) / 8)
62#define MAX_AES_KEY_BITS 128
63#define MAX_AES_BLOCK_SIZE_BYTES 16
64#define MAX_AES_KEY_BYTES ((MAX_AES_KEY_BITS + 7) / 8)
67#define MAX_SM4_KEY_BITS 128
68#define MAX_SM4_BLOCK_SIZE_BYTES 16
69#define MAX_SM4_KEY_BYTES ((MAX_SM4_KEY_BITS + 7) / 8)
72#define MAX_SYM_KEY_BITS MAX_AES_KEY_BITS
73#define MAX_SYM_KEY_BYTES MAX_AES_KEY_BYTES
74#define MAX_SYM_BLOCK_SIZE MAX_AES_BLOCK_SIZE_BYTES
78#define BUFFER_ALIGNMENT 4
79#define IMPLEMENTATION_PCR 24
80#define PLATFORM_PCR 24
82#define NUM_LOCALITIES 5
83#define MAX_HANDLE_NUM 3
84#define MAX_ACTIVE_SESSIONS 64
85typedef UINT16 CONTEXT_SLOT;
86typedef UINT64 CONTEXT_COUNTER;
87#define MAX_LOADED_SESSIONS 3
88#define MAX_SESSION_NUM 3
89#define MAX_LOADED_OBJECTS 3
90#define MIN_EVICT_OBJECTS 2
91#define PCR_SELECT_MIN ((PLATFORM_PCR + 7) / 8)
92#define PCR_SELECT_MAX ((IMPLEMENTATION_PCR + 7) / 8)
93#define NUM_POLICY_PCR_GROUP 1
94#define NUM_AUTHVALUE_PCR_GROUP 1
95#define MAX_CONTEXT_SIZE 4000
96#define MAX_DIGEST_BUFFER 1024
97#define MAX_NV_INDEX_SIZE 1024
98#define MAX_CAP_BUFFER 1024
99#define NV_MEMORY_SIZE 16384
100#define NUM_STATIC_PCR 16
101#define MAX_ALG_LIST_SIZE 64
102#define TIMER_PRESCALE 100000
103#define PRIMARY_SEED_SIZE 32
104#define CONTEXT_ENCRYPT_ALG TPM_ALG_AES
105#define CONTEXT_ENCRYPT_KEY_BITS MAX_SYM_KEY_BITS
106#define CONTEXT_ENCRYPT_KEY_BYTES ((CONTEXT_ENCRYPT_KEY_BITS + 7) / 8)
107#define CONTEXT_INTEGRITY_HASH_ALG TPM_ALG_SHA256
108#define CONTEXT_INTEGRITY_HASH_SIZE SHA256_DIGEST_SIZE
109#define PROOF_SIZE CONTEXT_INTEGRITY_HASH_SIZE
110#define NV_CLOCK_UPDATE_INTERVAL 12
111#define NUM_POLICY_PCR 1
112#define MAX_COMMAND_SIZE 4096
113#define MAX_RESPONSE_SIZE 4096
114#define ORDERLY_BITS 8
115#define MAX_ORDERLY_COUNT ((1 << ORDERLY_BITS) - 1)
116#define ALG_ID_FIRST TPM_ALG_FIRST
117#define ALG_ID_LAST TPM_ALG_LAST
118#define MAX_SYM_DATA 128
119#define MAX_RNG_ENTROPY_SIZE 64
120#define RAM_INDEX_SPACE 512
121#define RSA_DEFAULT_PUBLIC_EXPONENT 0x00010001
122#define CRT_FORMAT_RSA YES
123#define PRIVATE_VENDOR_SPECIFIC_BYTES ((MAX_RSA_KEY_BYTES / 2) * ( 3 + CRT_FORMAT_RSA * 2))
126#define MAX_CAP_DATA (MAX_CAP_BUFFER - sizeof(TPM_CAP) - sizeof(UINT32))
127#define MAX_CAP_ALGS (MAX_CAP_DATA / sizeof(TPMS_ALG_PROPERTY))
128#define MAX_CAP_HANDLES (MAX_CAP_DATA / sizeof(TPM_HANDLE))
129#define MAX_CAP_CC (MAX_CAP_DATA / sizeof(TPM_CC))
130#define MAX_TPM_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PROPERTY))
131#define MAX_PCR_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PCR_SELECT))
132#define MAX_ECC_CURVES (MAX_CAP_DATA / sizeof(TPM_ECC_CURVE))
150typedef UINT32 TPM_AUTHORIZATION_SIZE;
151typedef UINT32 TPM_PARAMETER_SIZE;
152typedef UINT16 TPM_KEY_SIZE;
153typedef UINT16 TPM_KEY_BITS;
158typedef UINT32 TPM_GENERATED;
159#define TPM_GENERATED_VALUE (TPM_GENERATED)(0xff544347)
162typedef UINT16 TPM_ALG_ID;
166#define TPM_ALG_ERROR (TPM_ALG_ID)(0x0000)
167#define TPM_ALG_FIRST (TPM_ALG_ID)(0x0001)
170#define TPM_ALG_SHA1 (TPM_ALG_ID)(0x0004)
172#define TPM_ALG_AES (TPM_ALG_ID)(0x0006)
174#define TPM_ALG_KEYEDHASH (TPM_ALG_ID)(0x0008)
176#define TPM_ALG_SHA256 (TPM_ALG_ID)(0x000B)
177#define TPM_ALG_SHA384 (TPM_ALG_ID)(0x000C)
178#define TPM_ALG_SHA512 (TPM_ALG_ID)(0x000D)
179#define TPM_ALG_NULL (TPM_ALG_ID)(0x0010)
180#define TPM_ALG_SM3_256 (TPM_ALG_ID)(0x0012)
181#define TPM_ALG_SM4 (TPM_ALG_ID)(0x0013)
182#define TPM_ALG_RSASSA (TPM_ALG_ID)(0x0014)
183#define TPM_ALG_RSAES (TPM_ALG_ID)(0x0015)
184#define TPM_ALG_RSAPSS (TPM_ALG_ID)(0x0016)
185#define TPM_ALG_OAEP (TPM_ALG_ID)(0x0017)
186#define TPM_ALG_ECDSA (TPM_ALG_ID)(0x0018)
187#define TPM_ALG_ECDH (TPM_ALG_ID)(0x0019)
188#define TPM_ALG_ECDAA (TPM_ALG_ID)(0x001A)
189#define TPM_ALG_SM2 (TPM_ALG_ID)(0x001B)
190#define TPM_ALG_ECSCHNORR (TPM_ALG_ID)(0x001C)
191#define TPM_ALG_ECMQV (TPM_ALG_ID)(0x001D)
192#define TPM_ALG_KDF1_SP800_56a (TPM_ALG_ID)(0x0020)
193#define TPM_ALG_KDF2 (TPM_ALG_ID)(0x0021)
194#define TPM_ALG_KDF1_SP800_108 (TPM_ALG_ID)(0x0022)
195#define TPM_ALG_ECC (TPM_ALG_ID)(0x0023)
196#define TPM_ALG_SYMCIPHER (TPM_ALG_ID)(0x0025)
197#define TPM_ALG_CTR (TPM_ALG_ID)(0x0040)
198#define TPM_ALG_OFB (TPM_ALG_ID)(0x0041)
199#define TPM_ALG_CBC (TPM_ALG_ID)(0x0042)
200#define TPM_ALG_CFB (TPM_ALG_ID)(0x0043)
201#define TPM_ALG_ECB (TPM_ALG_ID)(0x0044)
202#define TPM_ALG_LAST (TPM_ALG_ID)(0x0044)
205typedef UINT16 TPM_ECC_CURVE;
206#define TPM_ECC_NONE (TPM_ECC_CURVE)(0x0000)
207#define TPM_ECC_NIST_P192 (TPM_ECC_CURVE)(0x0001)
208#define TPM_ECC_NIST_P224 (TPM_ECC_CURVE)(0x0002)
209#define TPM_ECC_NIST_P256 (TPM_ECC_CURVE)(0x0003)
210#define TPM_ECC_NIST_P384 (TPM_ECC_CURVE)(0x0004)
211#define TPM_ECC_NIST_P521 (TPM_ECC_CURVE)(0x0005)
212#define TPM_ECC_BN_P256 (TPM_ECC_CURVE)(0x0010)
213#define TPM_ECC_BN_P638 (TPM_ECC_CURVE)(0x0011)
214#define TPM_ECC_SM2_P256 (TPM_ECC_CURVE)(0x0020)
215#define TPM_ECC_BP_P512_R1 (TPM_ECC_CURVE)(0x0032)
218typedef UINT32 TPM_CC;
219#define TPM_CC_FIRST (TPM_CC)(0x0000011F)
220#define TPM_CC_PP_FIRST (TPM_CC)(0x0000011F)
221#define TPM_CC_NV_UndefineSpaceSpecial (TPM_CC)(0x0000011F)
222#define TPM_CC_EvictControl (TPM_CC)(0x00000120)
223#define TPM_CC_HierarchyControl (TPM_CC)(0x00000121)
224#define TPM_CC_NV_UndefineSpace (TPM_CC)(0x00000122)
225#define TPM_CC_ChangeEPS (TPM_CC)(0x00000124)
226#define TPM_CC_ChangePPS (TPM_CC)(0x00000125)
227#define TPM_CC_Clear (TPM_CC)(0x00000126)
228#define TPM_CC_ClearControl (TPM_CC)(0x00000127)
229#define TPM_CC_ClockSet (TPM_CC)(0x00000128)
230#define TPM_CC_HierarchyChangeAuth (TPM_CC)(0x00000129)
231#define TPM_CC_NV_DefineSpace (TPM_CC)(0x0000012A)
232#define TPM_CC_PCR_Allocate (TPM_CC)(0x0000012B)
233#define TPM_CC_PCR_SetAuthPolicy (TPM_CC)(0x0000012C)
234#define TPM_CC_PP_Commands (TPM_CC)(0x0000012D)
235#define TPM_CC_SetPrimaryPolicy (TPM_CC)(0x0000012E)
236#define TPM_CC_FieldUpgradeStart (TPM_CC)(0x0000012F)
237#define TPM_CC_ClockRateAdjust (TPM_CC)(0x00000130)
238#define TPM_CC_CreatePrimary (TPM_CC)(0x00000131)
239#define TPM_CC_NV_GlobalWriteLock (TPM_CC)(0x00000132)
240#define TPM_CC_PP_LAST (TPM_CC)(0x00000132)
241#define TPM_CC_GetCommandAuditDigest (TPM_CC)(0x00000133)
242#define TPM_CC_NV_Increment (TPM_CC)(0x00000134)
243#define TPM_CC_NV_SetBits (TPM_CC)(0x00000135)
244#define TPM_CC_NV_Extend (TPM_CC)(0x00000136)
245#define TPM_CC_NV_Write (TPM_CC)(0x00000137)
246#define TPM_CC_NV_WriteLock (TPM_CC)(0x00000138)
247#define TPM_CC_DictionaryAttackLockReset (TPM_CC)(0x00000139)
248#define TPM_CC_DictionaryAttackParameters (TPM_CC)(0x0000013A)
249#define TPM_CC_NV_ChangeAuth (TPM_CC)(0x0000013B)
250#define TPM_CC_PCR_Event (TPM_CC)(0x0000013C)
251#define TPM_CC_PCR_Reset (TPM_CC)(0x0000013D)
252#define TPM_CC_SequenceComplete (TPM_CC)(0x0000013E)
253#define TPM_CC_SetAlgorithmSet (TPM_CC)(0x0000013F)
254#define TPM_CC_SetCommandCodeAuditStatus (TPM_CC)(0x00000140)
255#define TPM_CC_FieldUpgradeData (TPM_CC)(0x00000141)
256#define TPM_CC_IncrementalSelfTest (TPM_CC)(0x00000142)
257#define TPM_CC_SelfTest (TPM_CC)(0x00000143)
258#define TPM_CC_Startup (TPM_CC)(0x00000144)
259#define TPM_CC_Shutdown (TPM_CC)(0x00000145)
260#define TPM_CC_StirRandom (TPM_CC)(0x00000146)
261#define TPM_CC_ActivateCredential (TPM_CC)(0x00000147)
262#define TPM_CC_Certify (TPM_CC)(0x00000148)
263#define TPM_CC_PolicyNV (TPM_CC)(0x00000149)
264#define TPM_CC_CertifyCreation (TPM_CC)(0x0000014A)
265#define TPM_CC_Duplicate (TPM_CC)(0x0000014B)
266#define TPM_CC_GetTime (TPM_CC)(0x0000014C)
267#define TPM_CC_GetSessionAuditDigest (TPM_CC)(0x0000014D)
268#define TPM_CC_NV_Read (TPM_CC)(0x0000014E)
269#define TPM_CC_NV_ReadLock (TPM_CC)(0x0000014F)
270#define TPM_CC_ObjectChangeAuth (TPM_CC)(0x00000150)
271#define TPM_CC_PolicySecret (TPM_CC)(0x00000151)
272#define TPM_CC_Rewrap (TPM_CC)(0x00000152)
273#define TPM_CC_Create (TPM_CC)(0x00000153)
274#define TPM_CC_ECDH_ZGen (TPM_CC)(0x00000154)
275#define TPM_CC_HMAC (TPM_CC)(0x00000155)
276#define TPM_CC_Import (TPM_CC)(0x00000156)
277#define TPM_CC_Load (TPM_CC)(0x00000157)
278#define TPM_CC_Quote (TPM_CC)(0x00000158)
279#define TPM_CC_RSA_Decrypt (TPM_CC)(0x00000159)
280#define TPM_CC_HMAC_Start (TPM_CC)(0x0000015B)
281#define TPM_CC_SequenceUpdate (TPM_CC)(0x0000015C)
282#define TPM_CC_Sign (TPM_CC)(0x0000015D)
283#define TPM_CC_Unseal (TPM_CC)(0x0000015E)
284#define TPM_CC_PolicySigned (TPM_CC)(0x00000160)
285#define TPM_CC_ContextLoad (TPM_CC)(0x00000161)
286#define TPM_CC_ContextSave (TPM_CC)(0x00000162)
287#define TPM_CC_ECDH_KeyGen (TPM_CC)(0x00000163)
288#define TPM_CC_EncryptDecrypt (TPM_CC)(0x00000164)
289#define TPM_CC_FlushContext (TPM_CC)(0x00000165)
290#define TPM_CC_LoadExternal (TPM_CC)(0x00000167)
291#define TPM_CC_MakeCredential (TPM_CC)(0x00000168)
292#define TPM_CC_NV_ReadPublic (TPM_CC)(0x00000169)
293#define TPM_CC_PolicyAuthorize (TPM_CC)(0x0000016A)
294#define TPM_CC_PolicyAuthValue (TPM_CC)(0x0000016B)
295#define TPM_CC_PolicyCommandCode (TPM_CC)(0x0000016C)
296#define TPM_CC_PolicyCounterTimer (TPM_CC)(0x0000016D)
297#define TPM_CC_PolicyCpHash (TPM_CC)(0x0000016E)
298#define TPM_CC_PolicyLocality (TPM_CC)(0x0000016F)
299#define TPM_CC_PolicyNameHash (TPM_CC)(0x00000170)
300#define TPM_CC_PolicyOR (TPM_CC)(0x00000171)
301#define TPM_CC_PolicyTicket (TPM_CC)(0x00000172)
302#define TPM_CC_ReadPublic (TPM_CC)(0x00000173)
303#define TPM_CC_RSA_Encrypt (TPM_CC)(0x00000174)
304#define TPM_CC_StartAuthSession (TPM_CC)(0x00000176)
305#define TPM_CC_VerifySignature (TPM_CC)(0x00000177)
306#define TPM_CC_ECC_Parameters (TPM_CC)(0x00000178)
307#define TPM_CC_FirmwareRead (TPM_CC)(0x00000179)
308#define TPM_CC_GetCapability (TPM_CC)(0x0000017A)
309#define TPM_CC_GetRandom (TPM_CC)(0x0000017B)
310#define TPM_CC_GetTestResult (TPM_CC)(0x0000017C)
311#define TPM_CC_Hash (TPM_CC)(0x0000017D)
312#define TPM_CC_PCR_Read (TPM_CC)(0x0000017E)
313#define TPM_CC_PolicyPCR (TPM_CC)(0x0000017F)
314#define TPM_CC_PolicyRestart (TPM_CC)(0x00000180)
315#define TPM_CC_ReadClock (TPM_CC)(0x00000181)
316#define TPM_CC_PCR_Extend (TPM_CC)(0x00000182)
317#define TPM_CC_PCR_SetAuthValue (TPM_CC)(0x00000183)
318#define TPM_CC_NV_Certify (TPM_CC)(0x00000184)
319#define TPM_CC_EventSequenceComplete (TPM_CC)(0x00000185)
320#define TPM_CC_HashSequenceStart (TPM_CC)(0x00000186)
321#define TPM_CC_PolicyPhysicalPresence (TPM_CC)(0x00000187)
322#define TPM_CC_PolicyDuplicationSelect (TPM_CC)(0x00000188)
323#define TPM_CC_PolicyGetDigest (TPM_CC)(0x00000189)
324#define TPM_CC_TestParms (TPM_CC)(0x0000018A)
325#define TPM_CC_Commit (TPM_CC)(0x0000018B)
326#define TPM_CC_PolicyPassword (TPM_CC)(0x0000018C)
327#define TPM_CC_ZGen_2Phase (TPM_CC)(0x0000018D)
328#define TPM_CC_EC_Ephemeral (TPM_CC)(0x0000018E)
329#define TPM_CC_LAST (TPM_CC)(0x0000018E)
332typedef UINT32 TPM_RC;
333#define TPM_RC_SUCCESS (TPM_RC)(0x000)
334#define TPM_RC_BAD_TAG (TPM_RC)(0x030)
335#define RC_VER1 (TPM_RC)(0x100)
336#define TPM_RC_INITIALIZE (TPM_RC)(RC_VER1 + 0x000)
337#define TPM_RC_FAILURE (TPM_RC)(RC_VER1 + 0x001)
338#define TPM_RC_SEQUENCE (TPM_RC)(RC_VER1 + 0x003)
339#define TPM_RC_PRIVATE (TPM_RC)(RC_VER1 + 0x00B)
340#define TPM_RC_HMAC (TPM_RC)(RC_VER1 + 0x019)
341#define TPM_RC_DISABLED (TPM_RC)(RC_VER1 + 0x020)
342#define TPM_RC_EXCLUSIVE (TPM_RC)(RC_VER1 + 0x021)
343#define TPM_RC_AUTH_TYPE (TPM_RC)(RC_VER1 + 0x024)
344#define TPM_RC_AUTH_MISSING (TPM_RC)(RC_VER1 + 0x025)
345#define TPM_RC_POLICY (TPM_RC)(RC_VER1 + 0x026)
346#define TPM_RC_PCR (TPM_RC)(RC_VER1 + 0x027)
347#define TPM_RC_PCR_CHANGED (TPM_RC)(RC_VER1 + 0x028)
348#define TPM_RC_UPGRADE (TPM_RC)(RC_VER1 + 0x02D)
349#define TPM_RC_TOO_MANY_CONTEXTS (TPM_RC)(RC_VER1 + 0x02E)
350#define TPM_RC_AUTH_UNAVAILABLE (TPM_RC)(RC_VER1 + 0x02F)
351#define TPM_RC_REBOOT (TPM_RC)(RC_VER1 + 0x030)
352#define TPM_RC_UNBALANCED (TPM_RC)(RC_VER1 + 0x031)
353#define TPM_RC_COMMAND_SIZE (TPM_RC)(RC_VER1 + 0x042)
354#define TPM_RC_COMMAND_CODE (TPM_RC)(RC_VER1 + 0x043)
355#define TPM_RC_AUTHSIZE (TPM_RC)(RC_VER1 + 0x044)
356#define TPM_RC_AUTH_CONTEXT (TPM_RC)(RC_VER1 + 0x045)
357#define TPM_RC_NV_RANGE (TPM_RC)(RC_VER1 + 0x046)
358#define TPM_RC_NV_SIZE (TPM_RC)(RC_VER1 + 0x047)
359#define TPM_RC_NV_LOCKED (TPM_RC)(RC_VER1 + 0x048)
360#define TPM_RC_NV_AUTHORIZATION (TPM_RC)(RC_VER1 + 0x049)
361#define TPM_RC_NV_UNINITIALIZED (TPM_RC)(RC_VER1 + 0x04A)
362#define TPM_RC_NV_SPACE (TPM_RC)(RC_VER1 + 0x04B)
363#define TPM_RC_NV_DEFINED (TPM_RC)(RC_VER1 + 0x04C)
364#define TPM_RC_BAD_CONTEXT (TPM_RC)(RC_VER1 + 0x050)
365#define TPM_RC_CPHASH (TPM_RC)(RC_VER1 + 0x051)
366#define TPM_RC_PARENT (TPM_RC)(RC_VER1 + 0x052)
367#define TPM_RC_NEEDS_TEST (TPM_RC)(RC_VER1 + 0x053)
368#define TPM_RC_NO_RESULT (TPM_RC)(RC_VER1 + 0x054)
369#define TPM_RC_SENSITIVE (TPM_RC)(RC_VER1 + 0x055)
370#define RC_MAX_FM0 (TPM_RC)(RC_VER1 + 0x07F)
371#define RC_FMT1 (TPM_RC)(0x080)
372#define TPM_RC_ASYMMETRIC (TPM_RC)(RC_FMT1 + 0x001)
373#define TPM_RC_ATTRIBUTES (TPM_RC)(RC_FMT1 + 0x002)
374#define TPM_RC_HASH (TPM_RC)(RC_FMT1 + 0x003)
375#define TPM_RC_VALUE (TPM_RC)(RC_FMT1 + 0x004)
376#define TPM_RC_HIERARCHY (TPM_RC)(RC_FMT1 + 0x005)
377#define TPM_RC_KEY_SIZE (TPM_RC)(RC_FMT1 + 0x007)
378#define TPM_RC_MGF (TPM_RC)(RC_FMT1 + 0x008)
379#define TPM_RC_MODE (TPM_RC)(RC_FMT1 + 0x009)
380#define TPM_RC_TYPE (TPM_RC)(RC_FMT1 + 0x00A)
381#define TPM_RC_HANDLE (TPM_RC)(RC_FMT1 + 0x00B)
382#define TPM_RC_KDF (TPM_RC)(RC_FMT1 + 0x00C)
383#define TPM_RC_RANGE (TPM_RC)(RC_FMT1 + 0x00D)
384#define TPM_RC_AUTH_FAIL (TPM_RC)(RC_FMT1 + 0x00E)
385#define TPM_RC_NONCE (TPM_RC)(RC_FMT1 + 0x00F)
386#define TPM_RC_PP (TPM_RC)(RC_FMT1 + 0x010)
387#define TPM_RC_SCHEME (TPM_RC)(RC_FMT1 + 0x012)
388#define TPM_RC_SIZE (TPM_RC)(RC_FMT1 + 0x015)
389#define TPM_RC_SYMMETRIC (TPM_RC)(RC_FMT1 + 0x016)
390#define TPM_RC_TAG (TPM_RC)(RC_FMT1 + 0x017)
391#define TPM_RC_SELECTOR (TPM_RC)(RC_FMT1 + 0x018)
392#define TPM_RC_INSUFFICIENT (TPM_RC)(RC_FMT1 + 0x01A)
393#define TPM_RC_SIGNATURE (TPM_RC)(RC_FMT1 + 0x01B)
394#define TPM_RC_KEY (TPM_RC)(RC_FMT1 + 0x01C)
395#define TPM_RC_POLICY_FAIL (TPM_RC)(RC_FMT1 + 0x01D)
396#define TPM_RC_INTEGRITY (TPM_RC)(RC_FMT1 + 0x01F)
397#define TPM_RC_TICKET (TPM_RC)(RC_FMT1 + 0x020)
398#define TPM_RC_RESERVED_BITS (TPM_RC)(RC_FMT1 + 0x021)
399#define TPM_RC_BAD_AUTH (TPM_RC)(RC_FMT1 + 0x022)
400#define TPM_RC_EXPIRED (TPM_RC)(RC_FMT1 + 0x023)
401#define TPM_RC_POLICY_CC (TPM_RC)(RC_FMT1 + 0x024 )
402#define TPM_RC_BINDING (TPM_RC)(RC_FMT1 + 0x025)
403#define TPM_RC_CURVE (TPM_RC)(RC_FMT1 + 0x026)
404#define TPM_RC_ECC_POINT (TPM_RC)(RC_FMT1 + 0x027)
405#define RC_WARN (TPM_RC)(0x900)
406#define TPM_RC_CONTEXT_GAP (TPM_RC)(RC_WARN + 0x001)
407#define TPM_RC_OBJECT_MEMORY (TPM_RC)(RC_WARN + 0x002)
408#define TPM_RC_SESSION_MEMORY (TPM_RC)(RC_WARN + 0x003)
409#define TPM_RC_MEMORY (TPM_RC)(RC_WARN + 0x004)
410#define TPM_RC_SESSION_HANDLES (TPM_RC)(RC_WARN + 0x005)
411#define TPM_RC_OBJECT_HANDLES (TPM_RC)(RC_WARN + 0x006)
412#define TPM_RC_LOCALITY (TPM_RC)(RC_WARN + 0x007)
413#define TPM_RC_YIELDED (TPM_RC)(RC_WARN + 0x008)
414#define TPM_RC_CANCELED (TPM_RC)(RC_WARN + 0x009)
415#define TPM_RC_TESTING (TPM_RC)(RC_WARN + 0x00A)
416#define TPM_RC_REFERENCE_H0 (TPM_RC)(RC_WARN + 0x010)
417#define TPM_RC_REFERENCE_H1 (TPM_RC)(RC_WARN + 0x011)
418#define TPM_RC_REFERENCE_H2 (TPM_RC)(RC_WARN + 0x012)
419#define TPM_RC_REFERENCE_H3 (TPM_RC)(RC_WARN + 0x013)
420#define TPM_RC_REFERENCE_H4 (TPM_RC)(RC_WARN + 0x014)
421#define TPM_RC_REFERENCE_H5 (TPM_RC)(RC_WARN + 0x015)
422#define TPM_RC_REFERENCE_H6 (TPM_RC)(RC_WARN + 0x016)
423#define TPM_RC_REFERENCE_S0 (TPM_RC)(RC_WARN + 0x018)
424#define TPM_RC_REFERENCE_S1 (TPM_RC)(RC_WARN + 0x019)
425#define TPM_RC_REFERENCE_S2 (TPM_RC)(RC_WARN + 0x01A)
426#define TPM_RC_REFERENCE_S3 (TPM_RC)(RC_WARN + 0x01B)
427#define TPM_RC_REFERENCE_S4 (TPM_RC)(RC_WARN + 0x01C)
428#define TPM_RC_REFERENCE_S5 (TPM_RC)(RC_WARN + 0x01D)
429#define TPM_RC_REFERENCE_S6 (TPM_RC)(RC_WARN + 0x01E)
430#define TPM_RC_NV_RATE (TPM_RC)(RC_WARN + 0x020)
431#define TPM_RC_LOCKOUT (TPM_RC)(RC_WARN + 0x021)
432#define TPM_RC_RETRY (TPM_RC)(RC_WARN + 0x022)
433#define TPM_RC_NV_UNAVAILABLE (TPM_RC)(RC_WARN + 0x023)
434#define TPM_RC_NOT_USED (TPM_RC)(RC_WARN + 0x7F)
435#define TPM_RC_H (TPM_RC)(0x000)
436#define TPM_RC_P (TPM_RC)(0x040)
437#define TPM_RC_S (TPM_RC)(0x800)
438#define TPM_RC_1 (TPM_RC)(0x100)
439#define TPM_RC_2 (TPM_RC)(0x200)
440#define TPM_RC_3 (TPM_RC)(0x300)
441#define TPM_RC_4 (TPM_RC)(0x400)
442#define TPM_RC_5 (TPM_RC)(0x500)
443#define TPM_RC_6 (TPM_RC)(0x600)
444#define TPM_RC_7 (TPM_RC)(0x700)
445#define TPM_RC_8 (TPM_RC)(0x800)
446#define TPM_RC_9 (TPM_RC)(0x900)
447#define TPM_RC_A (TPM_RC)(0xA00)
448#define TPM_RC_B (TPM_RC)(0xB00)
449#define TPM_RC_C (TPM_RC)(0xC00)
450#define TPM_RC_D (TPM_RC)(0xD00)
451#define TPM_RC_E (TPM_RC)(0xE00)
452#define TPM_RC_F (TPM_RC)(0xF00)
453#define TPM_RC_N_MASK (TPM_RC)(0xF00)
456typedef INT8 TPM_CLOCK_ADJUST;
457#define TPM_CLOCK_COARSE_SLOWER (TPM_CLOCK_ADJUST)(-3)
458#define TPM_CLOCK_MEDIUM_SLOWER (TPM_CLOCK_ADJUST)(-2)
459#define TPM_CLOCK_FINE_SLOWER (TPM_CLOCK_ADJUST)(-1)
460#define TPM_CLOCK_NO_CHANGE (TPM_CLOCK_ADJUST)(0)
461#define TPM_CLOCK_FINE_FASTER (TPM_CLOCK_ADJUST)(1)
462#define TPM_CLOCK_MEDIUM_FASTER (TPM_CLOCK_ADJUST)(2)
463#define TPM_CLOCK_COARSE_FASTER (TPM_CLOCK_ADJUST)(3)
466typedef UINT16 TPM_EO;
467#define TPM_EO_EQ (TPM_EO)(0x0000)
468#define TPM_EO_NEQ (TPM_EO)(0x0001)
469#define TPM_EO_SIGNED_GT (TPM_EO)(0x0002)
470#define TPM_EO_UNSIGNED_GT (TPM_EO)(0x0003)
471#define TPM_EO_SIGNED_LT (TPM_EO)(0x0004)
472#define TPM_EO_UNSIGNED_LT (TPM_EO)(0x0005)
473#define TPM_EO_SIGNED_GE (TPM_EO)(0x0006)
474#define TPM_EO_UNSIGNED_GE (TPM_EO)(0x0007)
475#define TPM_EO_SIGNED_LE (TPM_EO)(0x0008)
476#define TPM_EO_UNSIGNED_LE (TPM_EO)(0x0009)
477#define TPM_EO_BITSET (TPM_EO)(0x000A)
478#define TPM_EO_BITCLEAR (TPM_EO)(0x000B)
481typedef UINT16 TPM_ST;
482#define TPM_ST_RSP_COMMAND (TPM_ST)(0x00C4)
483#define TPM_ST_NULL (TPM_ST)(0X8000)
484#define TPM_ST_NO_SESSIONS (TPM_ST)(0x8001)
485#define TPM_ST_SESSIONS (TPM_ST)(0x8002)
486#define TPM_ST_ATTEST_NV (TPM_ST)(0x8014)
487#define TPM_ST_ATTEST_COMMAND_AUDIT (TPM_ST)(0x8015)
488#define TPM_ST_ATTEST_SESSION_AUDIT (TPM_ST)(0x8016)
489#define TPM_ST_ATTEST_CERTIFY (TPM_ST)(0x8017)
490#define TPM_ST_ATTEST_QUOTE (TPM_ST)(0x8018)
491#define TPM_ST_ATTEST_TIME (TPM_ST)(0x8019)
492#define TPM_ST_ATTEST_CREATION (TPM_ST)(0x801A)
493#define TPM_ST_CREATION (TPM_ST)(0x8021)
494#define TPM_ST_VERIFIED (TPM_ST)(0x8022)
495#define TPM_ST_AUTH_SECRET (TPM_ST)(0x8023)
496#define TPM_ST_HASHCHECK (TPM_ST)(0x8024)
497#define TPM_ST_AUTH_SIGNED (TPM_ST)(0x8025)
498#define TPM_ST_FU_MANIFEST (TPM_ST)(0x8029)
501typedef UINT16 TPM_SU;
502#define TPM_SU_CLEAR (TPM_SU)(0x0000)
503#define TPM_SU_STATE (TPM_SU)(0x0001)
507#define TPM_SE_HMAC (TPM_SE)(0x00)
508#define TPM_SE_POLICY (TPM_SE)(0x01)
509#define TPM_SE_TRIAL (TPM_SE)(0x03)
512typedef UINT32 TPM_CAP;
513#define TPM_CAP_FIRST (TPM_CAP)(0x00000000)
514#define TPM_CAP_ALGS (TPM_CAP)(0x00000000)
515#define TPM_CAP_HANDLES (TPM_CAP)(0x00000001)
516#define TPM_CAP_COMMANDS (TPM_CAP)(0x00000002)
517#define TPM_CAP_PP_COMMANDS (TPM_CAP)(0x00000003)
518#define TPM_CAP_AUDIT_COMMANDS (TPM_CAP)(0x00000004)
519#define TPM_CAP_PCRS (TPM_CAP)(0x00000005)
520#define TPM_CAP_TPM_PROPERTIES (TPM_CAP)(0x00000006)
521#define TPM_CAP_PCR_PROPERTIES (TPM_CAP)(0x00000007)
522#define TPM_CAP_ECC_CURVES (TPM_CAP)(0x00000008)
523#define TPM_CAP_LAST (TPM_CAP)(0x00000008)
524#define TPM_CAP_VENDOR_PROPERTY (TPM_CAP)(0x00000100)
527typedef UINT32 TPM_PT;
528#define TPM_PT_NONE (TPM_PT)(0x00000000)
529#define PT_GROUP (TPM_PT)(0x00000100)
530#define PT_FIXED (TPM_PT)(PT_GROUP * 1)
531#define TPM_PT_FAMILY_INDICATOR (TPM_PT)(PT_FIXED + 0)
532#define TPM_PT_LEVEL (TPM_PT)(PT_FIXED + 1)
533#define TPM_PT_REVISION (TPM_PT)(PT_FIXED + 2)
534#define TPM_PT_DAY_OF_YEAR (TPM_PT)(PT_FIXED + 3)
535#define TPM_PT_YEAR (TPM_PT)(PT_FIXED + 4)
536#define TPM_PT_MANUFACTURER (TPM_PT)(PT_FIXED + 5)
537#define TPM_PT_VENDOR_STRING_1 (TPM_PT)(PT_FIXED + 6)
538#define TPM_PT_VENDOR_STRING_2 (TPM_PT)(PT_FIXED + 7)
539#define TPM_PT_VENDOR_STRING_3 (TPM_PT)(PT_FIXED + 8)
540#define TPM_PT_VENDOR_STRING_4 (TPM_PT)(PT_FIXED + 9)
541#define TPM_PT_VENDOR_TPM_TYPE (TPM_PT)(PT_FIXED + 10)
542#define TPM_PT_FIRMWARE_VERSION_1 (TPM_PT)(PT_FIXED + 11)
543#define TPM_PT_FIRMWARE_VERSION_2 (TPM_PT)(PT_FIXED + 12)
544#define TPM_PT_INPUT_BUFFER (TPM_PT)(PT_FIXED + 13)
545#define TPM_PT_HR_TRANSIENT_MIN (TPM_PT)(PT_FIXED + 14)
546#define TPM_PT_HR_PERSISTENT_MIN (TPM_PT)(PT_FIXED + 15)
547#define TPM_PT_HR_LOADED_MIN (TPM_PT)(PT_FIXED + 16)
548#define TPM_PT_ACTIVE_SESSIONS_MAX (TPM_PT)(PT_FIXED + 17)
549#define TPM_PT_PCR_COUNT (TPM_PT)(PT_FIXED + 18)
550#define TPM_PT_PCR_SELECT_MIN (TPM_PT)(PT_FIXED + 19)
551#define TPM_PT_CONTEXT_GAP_MAX (TPM_PT)(PT_FIXED + 20)
552#define TPM_PT_NV_COUNTERS_MAX (TPM_PT)(PT_FIXED + 22)
553#define TPM_PT_NV_INDEX_MAX (TPM_PT)(PT_FIXED + 23)
554#define TPM_PT_MEMORY (TPM_PT)(PT_FIXED + 24)
555#define TPM_PT_CLOCK_UPDATE (TPM_PT)(PT_FIXED + 25)
556#define TPM_PT_CONTEXT_HASH (TPM_PT)(PT_FIXED + 26)
557#define TPM_PT_CONTEXT_SYM (TPM_PT)(PT_FIXED + 27)
558#define TPM_PT_CONTEXT_SYM_SIZE (TPM_PT)(PT_FIXED + 28)
559#define TPM_PT_ORDERLY_COUNT (TPM_PT)(PT_FIXED + 29)
560#define TPM_PT_MAX_COMMAND_SIZE (TPM_PT)(PT_FIXED + 30)
561#define TPM_PT_MAX_RESPONSE_SIZE (TPM_PT)(PT_FIXED + 31)
562#define TPM_PT_MAX_DIGEST (TPM_PT)(PT_FIXED + 32)
563#define TPM_PT_MAX_OBJECT_CONTEXT (TPM_PT)(PT_FIXED + 33)
564#define TPM_PT_MAX_SESSION_CONTEXT (TPM_PT)(PT_FIXED + 34)
565#define TPM_PT_PS_FAMILY_INDICATOR (TPM_PT)(PT_FIXED + 35)
566#define TPM_PT_PS_LEVEL (TPM_PT)(PT_FIXED + 36)
567#define TPM_PT_PS_REVISION (TPM_PT)(PT_FIXED + 37)
568#define TPM_PT_PS_DAY_OF_YEAR (TPM_PT)(PT_FIXED + 38)
569#define TPM_PT_PS_YEAR (TPM_PT)(PT_FIXED + 39)
570#define TPM_PT_SPLIT_MAX (TPM_PT)(PT_FIXED + 40)
571#define TPM_PT_TOTAL_COMMANDS (TPM_PT)(PT_FIXED + 41)
572#define TPM_PT_LIBRARY_COMMANDS (TPM_PT)(PT_FIXED + 42)
573#define TPM_PT_VENDOR_COMMANDS (TPM_PT)(PT_FIXED + 43)
574#define PT_VAR (TPM_PT)(PT_GROUP * 2)
575#define TPM_PT_PERMANENT (TPM_PT)(PT_VAR + 0)
576#define TPM_PT_STARTUP_CLEAR (TPM_PT)(PT_VAR + 1)
577#define TPM_PT_HR_NV_INDEX (TPM_PT)(PT_VAR + 2)
578#define TPM_PT_HR_LOADED (TPM_PT)(PT_VAR + 3)
579#define TPM_PT_HR_LOADED_AVAIL (TPM_PT)(PT_VAR + 4)
580#define TPM_PT_HR_ACTIVE (TPM_PT)(PT_VAR + 5)
581#define TPM_PT_HR_ACTIVE_AVAIL (TPM_PT)(PT_VAR + 6)
582#define TPM_PT_HR_TRANSIENT_AVAIL (TPM_PT)(PT_VAR + 7)
583#define TPM_PT_HR_PERSISTENT (TPM_PT)(PT_VAR + 8)
584#define TPM_PT_HR_PERSISTENT_AVAIL (TPM_PT)(PT_VAR + 9)
585#define TPM_PT_NV_COUNTERS (TPM_PT)(PT_VAR + 10)
586#define TPM_PT_NV_COUNTERS_AVAIL (TPM_PT)(PT_VAR + 11)
587#define TPM_PT_ALGORITHM_SET (TPM_PT)(PT_VAR + 12)
588#define TPM_PT_LOADED_CURVES (TPM_PT)(PT_VAR + 13)
589#define TPM_PT_LOCKOUT_COUNTER (TPM_PT)(PT_VAR + 14)
590#define TPM_PT_MAX_AUTH_FAIL (TPM_PT)(PT_VAR + 15)
591#define TPM_PT_LOCKOUT_INTERVAL (TPM_PT)(PT_VAR + 16)
592#define TPM_PT_LOCKOUT_RECOVERY (TPM_PT)(PT_VAR + 17)
593#define TPM_PT_NV_WRITE_RECOVERY (TPM_PT)(PT_VAR + 18)
594#define TPM_PT_AUDIT_COUNTER_0 (TPM_PT)(PT_VAR + 19)
595#define TPM_PT_AUDIT_COUNTER_1 (TPM_PT)(PT_VAR + 20)
598typedef UINT32 TPM_PT_PCR;
599#define TPM_PT_PCR_FIRST (TPM_PT_PCR)(0x00000000)
600#define TPM_PT_PCR_SAVE (TPM_PT_PCR)(0x00000000)
601#define TPM_PT_PCR_EXTEND_L0 (TPM_PT_PCR)(0x00000001)
602#define TPM_PT_PCR_RESET_L0 (TPM_PT_PCR)(0x00000002)
603#define TPM_PT_PCR_EXTEND_L1 (TPM_PT_PCR)(0x00000003)
604#define TPM_PT_PCR_RESET_L1 (TPM_PT_PCR)(0x00000004)
605#define TPM_PT_PCR_EXTEND_L2 (TPM_PT_PCR)(0x00000005)
606#define TPM_PT_PCR_RESET_L2 (TPM_PT_PCR)(0x00000006)
607#define TPM_PT_PCR_EXTEND_L3 (TPM_PT_PCR)(0x00000007)
608#define TPM_PT_PCR_RESET_L3 (TPM_PT_PCR)(0x00000008)
609#define TPM_PT_PCR_EXTEND_L4 (TPM_PT_PCR)(0x00000009)
610#define TPM_PT_PCR_RESET_L4 (TPM_PT_PCR)(0x0000000A)
611#define TPM_PT_PCR_NO_INCREMENT (TPM_PT_PCR)(0x00000011)
612#define TPM_PT_PCR_DRTM_RESET (TPM_PT_PCR)(0x00000012)
613#define TPM_PT_PCR_POLICY (TPM_PT_PCR)(0x00000013)
614#define TPM_PT_PCR_AUTH (TPM_PT_PCR)(0x00000014)
615#define TPM_PT_PCR_LAST (TPM_PT_PCR)(0x00000014)
618typedef UINT32 TPM_PS;
619#define TPM_PS_MAIN (TPM_PS)(0x00000000)
620#define TPM_PS_PC (TPM_PS)(0x00000001)
621#define TPM_PS_PDA (TPM_PS)(0x00000002)
622#define TPM_PS_CELL_PHONE (TPM_PS)(0x00000003)
623#define TPM_PS_SERVER (TPM_PS)(0x00000004)
624#define TPM_PS_PERIPHERAL (TPM_PS)(0x00000005)
625#define TPM_PS_TSS (TPM_PS)(0x00000006)
626#define TPM_PS_STORAGE (TPM_PS)(0x00000007)
627#define TPM_PS_AUTHENTICATION (TPM_PS)(0x00000008)
628#define TPM_PS_EMBEDDED (TPM_PS)(0x00000009)
629#define TPM_PS_HARDCOPY (TPM_PS)(0x0000000A)
630#define TPM_PS_INFRASTRUCTURE (TPM_PS)(0x0000000B)
631#define TPM_PS_VIRTUALIZATION (TPM_PS)(0x0000000C)
632#define TPM_PS_TNC (TPM_PS)(0x0000000D)
633#define TPM_PS_MULTI_TENANT (TPM_PS)(0x0000000E)
634#define TPM_PS_TC (TPM_PS)(0x0000000F)
646#define TPM_HT_PCR (TPM_HT)(0x00)
647#define TPM_HT_NV_INDEX (TPM_HT)(0x01)
648#define TPM_HT_HMAC_SESSION (TPM_HT)(0x02)
649#define TPM_HT_LOADED_SESSION (TPM_HT)(0x02)
650#define TPM_HT_POLICY_SESSION (TPM_HT)(0x03)
651#define TPM_HT_ACTIVE_SESSION (TPM_HT)(0x03)
652#define TPM_HT_PERMANENT (TPM_HT)(0x40)
653#define TPM_HT_TRANSIENT (TPM_HT)(0x80)
654#define TPM_HT_PERSISTENT (TPM_HT)(0x81)
657typedef UINT32 TPM_RH;
658#define TPM_RH_FIRST (TPM_RH)(0x40000000)
659#define TPM_RH_SRK (TPM_RH)(0x40000000)
660#define TPM_RH_OWNER (TPM_RH)(0x40000001)
661#define TPM_RH_REVOKE (TPM_RH)(0x40000002)
662#define TPM_RH_TRANSPORT (TPM_RH)(0x40000003)
663#define TPM_RH_OPERATOR (TPM_RH)(0x40000004)
664#define TPM_RH_ADMIN (TPM_RH)(0x40000005)
665#define TPM_RH_EK (TPM_RH)(0x40000006)
666#define TPM_RH_NULL (TPM_RH)(0x40000007)
667#define TPM_RH_UNASSIGNED (TPM_RH)(0x40000008)
668#define TPM_RS_PW (TPM_RH)(0x40000009)
669#define TPM_RH_LOCKOUT (TPM_RH)(0x4000000A)
670#define TPM_RH_ENDORSEMENT (TPM_RH)(0x4000000B)
671#define TPM_RH_PLATFORM (TPM_RH)(0x4000000C)
672#define TPM_RH_PLATFORM_NV (TPM_RH)(0x4000000D)
673#define TPM_RH_AUTH_00 (TPM_RH)(0x40000010)
674#define TPM_RH_AUTH_FF (TPM_RH)(0x4000010F)
675#define TPM_RH_LAST (TPM_RH)(0x4000010F)
679#define HR_HANDLE_MASK (TPM_HC)(0x00FFFFFF)
680#define HR_RANGE_MASK (TPM_HC)(0xFF000000)
681#define HR_SHIFT (TPM_HC)(24)
682#define HR_PCR (TPM_HC)((TPM_HC)TPM_HT_PCR << HR_SHIFT)
683#define HR_HMAC_SESSION (TPM_HC)((TPM_HC)TPM_HT_HMAC_SESSION << HR_SHIFT)
684#define HR_POLICY_SESSION (TPM_HC)((TPM_HC)TPM_HT_POLICY_SESSION << HR_SHIFT)
685#define HR_TRANSIENT (TPM_HC)((TPM_HC)TPM_HT_TRANSIENT << HR_SHIFT)
686#define HR_PERSISTENT (TPM_HC)((TPM_HC)TPM_HT_PERSISTENT << HR_SHIFT)
687#define HR_NV_INDEX (TPM_HC)((TPM_HC)TPM_HT_NV_INDEX << HR_SHIFT)
688#define HR_PERMANENT (TPM_HC)((TPM_HC)TPM_HT_PERMANENT << HR_SHIFT)
689#define PCR_FIRST (TPM_HC)(HR_PCR + 0)
690#define PCR_LAST (TPM_HC)(PCR_FIRST + IMPLEMENTATION_PCR - 1)
691#define HMAC_SESSION_FIRST (TPM_HC)(HR_HMAC_SESSION + 0)
692#define HMAC_SESSION_LAST (TPM_HC)(HMAC_SESSION_FIRST + MAX_ACTIVE_SESSIONS - 1)
693#define LOADED_SESSION_FIRST (TPM_HC)(HMAC_SESSION_FIRST)
694#define LOADED_SESSION_LAST (TPM_HC)(HMAC_SESSION_LAST)
695#define POLICY_SESSION_FIRST (TPM_HC)(HR_POLICY_SESSION + 0)
696#define POLICY_SESSION_LAST (TPM_HC)(POLICY_SESSION_FIRST + MAX_ACTIVE_SESSIONS - 1)
697#define TRANSIENT_FIRST (TPM_HC)(HR_TRANSIENT + 0)
698#define ACTIVE_SESSION_FIRST (TPM_HC)(POLICY_SESSION_FIRST)
699#define ACTIVE_SESSION_LAST (TPM_HC)(POLICY_SESSION_LAST)
700#define TRANSIENT_LAST (TPM_HC)(TRANSIENT_FIRST+MAX_LOADED_OBJECTS - 1)
701#define PERSISTENT_FIRST (TPM_HC)(HR_PERSISTENT + 0)
702#define PERSISTENT_LAST (TPM_HC)(PERSISTENT_FIRST + 0x00FFFFFF)
703#define PLATFORM_PERSISTENT (TPM_HC)(PERSISTENT_FIRST + 0x00800000)
704#define NV_INDEX_FIRST (TPM_HC)(HR_NV_INDEX + 0)
705#define NV_INDEX_LAST (TPM_HC)(NV_INDEX_FIRST + 0x00FFFFFF)
706#define PERMANENT_FIRST (TPM_HC)(TPM_RH_FIRST)
707#define PERMANENT_LAST (TPM_HC)(TPM_RH_LAST)
713 UINT32 asymmetric : 1;
714 UINT32 symmetric : 1;
717 UINT32 reserved4_7 : 4;
719 UINT32 encrypting : 1;
721 UINT32 reserved11_31 : 21;
726 UINT32 reserved1 : 1;
729 UINT32 reserved4 : 1;
730 UINT32 fixedParent : 1;
731 UINT32 sensitiveDataOrigin : 1;
732 UINT32 userWithAuth : 1;
733 UINT32 adminWithPolicy : 1;
734 UINT32 reserved8_9 : 2;
736 UINT32 encryptedDuplication : 1;
737 UINT32 reserved12_15 : 4;
738 UINT32 restricted : 1;
741 UINT32 reserved19_31 : 13;
746 UINT8 continueSession : 1;
747 UINT8 auditExclusive : 1;
748 UINT8 auditReset : 1;
749 UINT8 reserved3_4 : 2;
770 UINT32 ownerAuthSet : 1;
771 UINT32 endorsementAuthSet : 1;
772 UINT32 lockoutAuthSet : 1;
773 UINT32 reserved3_7 : 5;
774 UINT32 disableClear : 1;
775 UINT32 inLockout : 1;
776 UINT32 tpmGeneratedEPS : 1;
777 UINT32 reserved11_31 : 21;
785 UINT32 reserved3_30 : 28;
791 UINT32 sharedRAM : 1;
793 UINT32 objectCopiedToRam : 1;
794 UINT32 reserved3_31 : 29;
799 UINT32 commandIndex : 16;
800 UINT32 reserved16_21 : 6;
802 UINT32 extensive : 1;
813typedef BYTE TPMI_YES_NO;
870typedef TPM_ALG_ID TPMI_ALG_HASH;
873typedef TPM_ALG_ID TPMI_ALG_ASYM;
876typedef TPM_ALG_ID TPMI_ALG_SYM;
879typedef TPM_ALG_ID TPMI_ALG_SYM_OBJECT;
882typedef TPM_ALG_ID TPMI_ALG_SYM_MODE;
885typedef TPM_ALG_ID TPMI_ALG_KDF;
888typedef TPM_ALG_ID TPMI_ALG_SIG_SCHEME;
891typedef TPM_ALG_ID TPMI_ECC_KEY_EXCHANGE;
894typedef TPM_ST TPMI_ST_COMMAND_TAG;
915 TPMI_ALG_HASH hashAlg;
949 BYTE buffer[MAX_DIGEST_BUFFER];
955 BYTE buffer[MAX_NV_INDEX_SIZE];
961 BYTE buffer[
sizeof (UINT64)];
967 BYTE buffer[MAX_SYM_BLOCK_SIZE];
985 BYTE pcrSelect[PCR_SELECT_MAX];
992 BYTE pcrSelect[PCR_SELECT_MAX];
998 TPMI_RH_HIERARCHY hierarchy;
1005 TPMI_RH_HIERARCHY hierarchy;
1012 TPMI_RH_HIERARCHY hierarchy;
1019 TPMI_RH_HIERARCHY hierarchy;
1039 BYTE pcrSelect[PCR_SELECT_MAX];
1045 TPM_CC commandCodes[MAX_CAP_CC];
1051 TPMA_CC commandAttributes[MAX_CAP_CC];
1057 TPM_ALG_ID algorithms[MAX_ALG_LIST_SIZE];
1111 TPM_ECC_CURVE eccCurves[MAX_ECC_CURVES];
1137 UINT32 restartCount;
1150 UINT64 firmwareVersion;
1167 UINT64 auditCounter;
1168 TPM_ALG_ID digestAlg;
1175 TPMI_YES_NO exclusiveSession;
1193typedef TPM_ST TPMI_ST_ATTEST;
1208 TPM_GENERATED magic;
1209 TPMI_ST_ATTEST type;
1213 UINT64 firmwareVersion;
1225 TPMI_SH_AUTH_SESSION sessionHandle;
1241typedef TPM_KEY_BITS TPMI_AES_KEY_BITS;
1244typedef TPM_KEY_BITS TPMI_SM4_KEY_BITS;
1248 TPMI_AES_KEY_BITS aes;
1249 TPMI_SM4_KEY_BITS SM4;
1256 TPMI_ALG_SYM_MODE aes;
1257 TPMI_ALG_SYM_MODE SM4;
1258 TPMI_ALG_SYM_MODE sym;
1263 TPMI_ALG_SYM algorithm;
1270 TPMI_ALG_SYM_OBJECT algorithm;
1278 BYTE buffer[MAX_SYM_KEY_BYTES];
1289 BYTE buffer[MAX_SYM_DATA];
1306 TPMI_ALG_HASH hashAlg;
1310typedef TPM_ALG_ID TPMI_ALG_KEYEDHASH_SCHEME;
1317 TPMI_ALG_HASH hashAlg;
1329 TPMI_ALG_KEYEDHASH_SCHEME scheme;
1344 TPMI_ALG_HASH hashAlg;
1361 TPMI_ALG_SIG_SCHEME scheme;
1367 TPMI_ALG_HASH hashAlg;
1372 TPMI_ALG_HASH hashAlg;
1377 TPMI_ALG_HASH hashAlg;
1382 TPMI_ALG_HASH hashAlg;
1387 TPMI_ALG_HASH hashAlg;
1392 TPMI_ALG_HASH hashAlg;
1405 TPMI_ALG_KDF scheme;
1410typedef TPM_ALG_ID TPMI_ALG_ASYM_SCHEME;
1425 TPMI_ALG_ASYM_SCHEME scheme;
1430typedef TPM_ALG_ID TPMI_ALG_RSA_SCHEME;
1434 TPMI_ALG_RSA_SCHEME scheme;
1439typedef TPM_ALG_ID TPMI_ALG_RSA_DECRYPT;
1443 TPMI_ALG_RSA_DECRYPT scheme;
1450 BYTE buffer[MAX_RSA_KEY_BYTES];
1454typedef TPM_KEY_BITS TPMI_RSA_KEY_BITS;
1459 BYTE buffer[MAX_RSA_KEY_BYTES/2];
1465 BYTE buffer[MAX_ECC_KEY_BYTES];
1481typedef TPM_ALG_ID TPMI_ALG_ECC_SCHEME;
1484typedef TPM_ECC_CURVE TPMI_ECC_CURVE;
1488 TPMI_ALG_ECC_SCHEME scheme;
1494 TPM_ECC_CURVE curveID;
1540 TPMI_ALG_SIG_SCHEME sigAlg;
1547 BYTE rsa[MAX_RSA_KEY_BYTES];
1561typedef TPM_ALG_ID TPMI_ALG_PUBLIC;
1586 TPMI_RSA_KEY_BITS keyBits;
1594 TPMI_ECC_CURVE curveID;
1609 TPMI_ALG_PUBLIC type;
1615 TPMI_ALG_PUBLIC type;
1616 TPMI_ALG_HASH nameAlg;
1632 BYTE buffer[PRIVATE_VENDOR_SPECIFIC_BYTES];
1646 TPMI_ALG_PUBLIC sensitiveType;
1697 UINT32 TPMA_NV_PPWRITE : 1;
1698 UINT32 TPMA_NV_OWNERWRITE : 1;
1699 UINT32 TPMA_NV_AUTHWRITE : 1;
1700 UINT32 TPMA_NV_POLICYWRITE : 1;
1701 UINT32 TPMA_NV_COUNTER : 1;
1702 UINT32 TPMA_NV_BITS : 1;
1703 UINT32 TPMA_NV_EXTEND : 1;
1704 UINT32 reserved7_9 : 3;
1705 UINT32 TPMA_NV_POLICY_DELETE : 1;
1706 UINT32 TPMA_NV_WRITELOCKED : 1;
1707 UINT32 TPMA_NV_WRITEALL : 1;
1708 UINT32 TPMA_NV_WRITEDEFINE : 1;
1709 UINT32 TPMA_NV_WRITE_STCLEAR : 1;
1710 UINT32 TPMA_NV_GLOBALLOCK : 1;
1711 UINT32 TPMA_NV_PPREAD : 1;
1712 UINT32 TPMA_NV_OWNERREAD : 1;
1713 UINT32 TPMA_NV_AUTHREAD : 1;
1714 UINT32 TPMA_NV_POLICYREAD : 1;
1715 UINT32 reserved20_24 : 5;
1716 UINT32 TPMA_NV_NO_DA : 1;
1717 UINT32 TPMA_NV_ORDERLY : 1;
1718 UINT32 TPMA_NV_CLEAR_STCLEAR : 1;
1719 UINT32 TPMA_NV_READLOCKED : 1;
1720 UINT32 TPMA_NV_WRITTEN : 1;
1721 UINT32 TPMA_NV_PLATFORMCREATE : 1;
1722 UINT32 TPMA_NV_READ_STCLEAR : 1;
1727 TPMI_RH_NV_INDEX nvIndex;
1728 TPMI_ALG_HASH nameAlg;
1745 BYTE buffer[MAX_CONTEXT_SIZE];
1763 TPMI_DH_CONTEXT savedHandle;
1764 TPMI_RH_HIERARCHY hierarchy;
1775 TPM_ALG_ID parentNameAlg;
1799 TPM_RC responseCode;
1807#define HASH_ALG_SHA1 0x00000001
1808#define HASH_ALG_SHA256 0x00000002
1809#define HASH_ALG_SHA384 0x00000004
1810#define HASH_ALG_SHA512 0x00000008
1811#define HASH_ALG_SM3_256 0x00000010
#define SM3_256_DIGEST_SIZE
#define SHA512_DIGEST_SIZE
#define SHA256_DIGEST_SIZE
#define SHA384_DIGEST_SIZE