2 TPM Specification data structures (TCG TPM Specification Version 1.2 Revision 103)
3 See http://trustedcomputinggroup.org for latest specification updates
5 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 /// The start of TPM return codes
25 // All structures MUST be packed on a byte boundary.
31 // Part 2, section 2.2.3: Helper redefinitions
34 /// Indicates the conditions where it is required that authorization be presented
36 typedef UINT8 TPM_AUTH_DATA_USAGE
;
38 /// The information as to what the payload is in an encrypted structure
40 typedef UINT8 TPM_PAYLOAD_TYPE
;
42 /// The version info breakdown
44 typedef UINT8 TPM_VERSION_BYTE
;
46 /// The state of the dictionary attack mitigation logic
48 typedef UINT8 TPM_DA_STATE
;
50 /// The request or response authorization type
52 typedef UINT16 TPM_TAG
;
54 /// The protocol in use
56 typedef UINT16 TPM_PROTOCOL_ID
;
58 /// Indicates the start state
60 typedef UINT16 TPM_STARTUP_TYPE
;
62 /// The definition of the encryption scheme
64 typedef UINT16 TPM_ENC_SCHEME
;
66 /// The definition of the signature scheme
68 typedef UINT16 TPM_SIG_SCHEME
;
70 /// The definition of the migration scheme
72 typedef UINT16 TPM_MIGRATE_SCHEME
;
74 /// Sets the state of the physical presence mechanism
76 typedef UINT16 TPM_PHYSICAL_PRESENCE
;
78 /// Indicates the types of entity that are supported by the TPM
80 typedef UINT16 TPM_ENTITY_TYPE
;
82 /// Indicates the permitted usage of the key
84 typedef UINT16 TPM_KEY_USAGE
;
86 /// The type of asymmetric encrypted structure in use by the endorsement key
88 typedef UINT16 TPM_EK_TYPE
;
90 /// The tag for the structure
92 typedef UINT16 TPM_STRUCTURE_TAG
;
94 /// The platform specific spec to which the information relates to
96 typedef UINT16 TPM_PLATFORM_SPECIFIC
;
98 /// The command ordinal
100 typedef UINT32 TPM_COMMAND_CODE
;
102 /// Identifies a TPM capability area
104 typedef UINT32 TPM_CAPABILITY_AREA
;
106 /// Indicates information regarding a key
108 typedef UINT32 TPM_KEY_FLAGS
;
110 /// Indicates the type of algorithm
112 typedef UINT32 TPM_ALGORITHM_ID
;
114 /// The locality modifier
116 typedef UINT32 TPM_MODIFIER_INDICATOR
;
118 /// The actual number of a counter
120 typedef UINT32 TPM_ACTUAL_COUNT
;
122 /// Attributes that define what options are in use for a transport session
124 typedef UINT32 TPM_TRANSPORT_ATTRIBUTES
;
126 /// Handle to an authorization session
128 typedef UINT32 TPM_AUTHHANDLE
;
130 /// Index to a DIR register
132 typedef UINT32 TPM_DIRINDEX
;
134 /// The area where a key is held assigned by the TPM
136 typedef UINT32 TPM_KEY_HANDLE
;
138 /// Index to a PCR register
140 typedef UINT32 TPM_PCRINDEX
;
142 /// The return code from a function
144 typedef UINT32 TPM_RESULT
;
146 /// The types of resources that a TPM may have using internal resources
148 typedef UINT32 TPM_RESOURCE_TYPE
;
150 /// Allows for controlling of the key when loaded and how to handle TPM_Startup issues
152 typedef UINT32 TPM_KEY_CONTROL
;
154 /// The index into the NV storage area
156 typedef UINT32 TPM_NV_INDEX
;
158 /// The family ID. Family IDs are automatically assigned a sequence number by the TPM.
159 /// A trusted process can set the FamilyID value in an individual row to NULL, which
160 /// invalidates that row. The family ID resets to NULL on each change of TPM Owner.
162 typedef UINT32 TPM_FAMILY_ID
;
164 /// IA value used as a label for the most recent verification of this family. Set to zero when not in use.
166 typedef UINT32 TPM_FAMILY_VERIFICATION
;
168 /// How the TPM handles var
170 typedef UINT32 TPM_STARTUP_EFFECTS
;
172 /// The mode of a symmetric encryption
174 typedef UINT32 TPM_SYM_MODE
;
178 typedef UINT32 TPM_FAMILY_FLAGS
;
180 /// The index value for the delegate NV table
182 typedef UINT32 TPM_DELEGATE_INDEX
;
184 /// The restrictions placed on delegation of CMK commands
186 typedef UINT32 TPM_CMK_DELEGATE
;
188 /// The ID value of a monotonic counter
190 typedef UINT32 TPM_COUNT_ID
;
192 /// A command to execute
194 typedef UINT32 TPM_REDIT_COMMAND
;
196 /// A transport session handle
198 typedef UINT32 TPM_TRANSHANDLE
;
200 /// A generic handle could be key, transport etc
202 typedef UINT32 TPM_HANDLE
;
204 /// What operation is happening
206 typedef UINT32 TPM_FAMILY_OPERATION
;
209 // Part 2, section 2.2.4: Vendor specific
210 // The following defines allow for the quick specification of a
211 // vendor specific item.
213 #define TPM_Vendor_Specific32 ((UINT32) 0x00000400)
214 #define TPM_Vendor_Specific8 ((UINT8) 0x80)
217 // Part 2, section 3.1: TPM_STRUCTURE_TAG
219 #define TPM_TAG_CONTEXTBLOB ((TPM_STRUCTURE_TAG) 0x0001)
220 #define TPM_TAG_CONTEXT_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0002)
221 #define TPM_TAG_CONTEXTPOINTER ((TPM_STRUCTURE_TAG) 0x0003)
222 #define TPM_TAG_CONTEXTLIST ((TPM_STRUCTURE_TAG) 0x0004)
223 #define TPM_TAG_SIGNINFO ((TPM_STRUCTURE_TAG) 0x0005)
224 #define TPM_TAG_PCR_INFO_LONG ((TPM_STRUCTURE_TAG) 0x0006)
225 #define TPM_TAG_PERSISTENT_FLAGS ((TPM_STRUCTURE_TAG) 0x0007)
226 #define TPM_TAG_VOLATILE_FLAGS ((TPM_STRUCTURE_TAG) 0x0008)
227 #define TPM_TAG_PERSISTENT_DATA ((TPM_STRUCTURE_TAG) 0x0009)
228 #define TPM_TAG_VOLATILE_DATA ((TPM_STRUCTURE_TAG) 0x000A)
229 #define TPM_TAG_SV_DATA ((TPM_STRUCTURE_TAG) 0x000B)
230 #define TPM_TAG_EK_BLOB ((TPM_STRUCTURE_TAG) 0x000C)
231 #define TPM_TAG_EK_BLOB_AUTH ((TPM_STRUCTURE_TAG) 0x000D)
232 #define TPM_TAG_COUNTER_VALUE ((TPM_STRUCTURE_TAG) 0x000E)
233 #define TPM_TAG_TRANSPORT_INTERNAL ((TPM_STRUCTURE_TAG) 0x000F)
234 #define TPM_TAG_TRANSPORT_LOG_IN ((TPM_STRUCTURE_TAG) 0x0010)
235 #define TPM_TAG_TRANSPORT_LOG_OUT ((TPM_STRUCTURE_TAG) 0x0011)
236 #define TPM_TAG_AUDIT_EVENT_IN ((TPM_STRUCTURE_TAG) 0x0012)
237 #define TPM_TAG_AUDIT_EVENT_OUT ((TPM_STRUCTURE_TAG) 0x0013)
238 #define TPM_TAG_CURRENT_TICKS ((TPM_STRUCTURE_TAG) 0x0014)
239 #define TPM_TAG_KEY ((TPM_STRUCTURE_TAG) 0x0015)
240 #define TPM_TAG_STORED_DATA12 ((TPM_STRUCTURE_TAG) 0x0016)
241 #define TPM_TAG_NV_ATTRIBUTES ((TPM_STRUCTURE_TAG) 0x0017)
242 #define TPM_TAG_NV_DATA_PUBLIC ((TPM_STRUCTURE_TAG) 0x0018)
243 #define TPM_TAG_NV_DATA_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0019)
244 #define TPM_TAG_DELEGATIONS ((TPM_STRUCTURE_TAG) 0x001A)
245 #define TPM_TAG_DELEGATE_PUBLIC ((TPM_STRUCTURE_TAG) 0x001B)
246 #define TPM_TAG_DELEGATE_TABLE_ROW ((TPM_STRUCTURE_TAG) 0x001C)
247 #define TPM_TAG_TRANSPORT_AUTH ((TPM_STRUCTURE_TAG) 0x001D)
248 #define TPM_TAG_TRANSPORT_PUBLIC ((TPM_STRUCTURE_TAG) 0x001E)
249 #define TPM_TAG_PERMANENT_FLAGS ((TPM_STRUCTURE_TAG) 0x001F)
250 #define TPM_TAG_STCLEAR_FLAGS ((TPM_STRUCTURE_TAG) 0x0020)
251 #define TPM_TAG_STANY_FLAGS ((TPM_STRUCTURE_TAG) 0x0021)
252 #define TPM_TAG_PERMANENT_DATA ((TPM_STRUCTURE_TAG) 0x0022)
253 #define TPM_TAG_STCLEAR_DATA ((TPM_STRUCTURE_TAG) 0x0023)
254 #define TPM_TAG_STANY_DATA ((TPM_STRUCTURE_TAG) 0x0024)
255 #define TPM_TAG_FAMILY_TABLE_ENTRY ((TPM_STRUCTURE_TAG) 0x0025)
256 #define TPM_TAG_DELEGATE_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0026)
257 #define TPM_TAG_DELG_KEY_BLOB ((TPM_STRUCTURE_TAG) 0x0027)
258 #define TPM_TAG_KEY12 ((TPM_STRUCTURE_TAG) 0x0028)
259 #define TPM_TAG_CERTIFY_INFO2 ((TPM_STRUCTURE_TAG) 0x0029)
260 #define TPM_TAG_DELEGATE_OWNER_BLOB ((TPM_STRUCTURE_TAG) 0x002A)
261 #define TPM_TAG_EK_BLOB_ACTIVATE ((TPM_STRUCTURE_TAG) 0x002B)
262 #define TPM_TAG_DAA_BLOB ((TPM_STRUCTURE_TAG) 0x002C)
263 #define TPM_TAG_DAA_CONTEXT ((TPM_STRUCTURE_TAG) 0x002D)
264 #define TPM_TAG_DAA_ENFORCE ((TPM_STRUCTURE_TAG) 0x002E)
265 #define TPM_TAG_DAA_ISSUER ((TPM_STRUCTURE_TAG) 0x002F)
266 #define TPM_TAG_CAP_VERSION_INFO ((TPM_STRUCTURE_TAG) 0x0030)
267 #define TPM_TAG_DAA_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0031)
268 #define TPM_TAG_DAA_TPM ((TPM_STRUCTURE_TAG) 0x0032)
269 #define TPM_TAG_CMK_MIGAUTH ((TPM_STRUCTURE_TAG) 0x0033)
270 #define TPM_TAG_CMK_SIGTICKET ((TPM_STRUCTURE_TAG) 0x0034)
271 #define TPM_TAG_CMK_MA_APPROVAL ((TPM_STRUCTURE_TAG) 0x0035)
272 #define TPM_TAG_QUOTE_INFO2 ((TPM_STRUCTURE_TAG) 0x0036)
273 #define TPM_TAG_DA_INFO ((TPM_STRUCTURE_TAG) 0x0037)
274 #define TPM_TAG_DA_LIMITED ((TPM_STRUCTURE_TAG) 0x0038)
275 #define TPM_TAG_DA_ACTION_TYPE ((TPM_STRUCTURE_TAG) 0x0039)
278 // Part 2, section 4: TPM Types
282 // Part 2, section 4.1: TPM_RESOURCE_TYPE
284 #define TPM_RT_KEY ((TPM_RESOURCE_TYPE) 0x00000001) ///< The handle is a key handle and is the result of a LoadKey type operation
285 #define TPM_RT_AUTH ((TPM_RESOURCE_TYPE) 0x00000002) ///< The handle is an authorization handle. Auth handles come from TPM_OIAP, TPM_OSAP and TPM_DSAP
286 #define TPM_RT_HASH ((TPM_RESOURCE_TYPE) 0x00000003) ///< Reserved for hashes
287 #define TPM_RT_TRANS ((TPM_RESOURCE_TYPE) 0x00000004) ///< The handle is for a transport session. Transport handles come from TPM_EstablishTransport
288 #define TPM_RT_CONTEXT ((TPM_RESOURCE_TYPE) 0x00000005) ///< Resource wrapped and held outside the TPM using the context save/restore commands
289 #define TPM_RT_COUNTER ((TPM_RESOURCE_TYPE) 0x00000006) ///< Reserved for counters
290 #define TPM_RT_DELEGATE ((TPM_RESOURCE_TYPE) 0x00000007) ///< The handle is for a delegate row. These are the internal rows held in NV storage by the TPM
291 #define TPM_RT_DAA_TPM ((TPM_RESOURCE_TYPE) 0x00000008) ///< The value is a DAA TPM specific blob
292 #define TPM_RT_DAA_V0 ((TPM_RESOURCE_TYPE) 0x00000009) ///< The value is a DAA V0 parameter
293 #define TPM_RT_DAA_V1 ((TPM_RESOURCE_TYPE) 0x0000000A) ///< The value is a DAA V1 parameter
296 // Part 2, section 4.2: TPM_PAYLOAD_TYPE
298 #define TPM_PT_ASYM ((TPM_PAYLOAD_TYPE) 0x01) ///< The entity is an asymmetric key
299 #define TPM_PT_BIND ((TPM_PAYLOAD_TYPE) 0x02) ///< The entity is bound data
300 #define TPM_PT_MIGRATE ((TPM_PAYLOAD_TYPE) 0x03) ///< The entity is a migration blob
301 #define TPM_PT_MAINT ((TPM_PAYLOAD_TYPE) 0x04) ///< The entity is a maintenance blob
302 #define TPM_PT_SEAL ((TPM_PAYLOAD_TYPE) 0x05) ///< The entity is sealed data
303 #define TPM_PT_MIGRATE_RESTRICTED ((TPM_PAYLOAD_TYPE) 0x06) ///< The entity is a restricted-migration asymmetric key
304 #define TPM_PT_MIGRATE_EXTERNAL ((TPM_PAYLOAD_TYPE) 0x07) ///< The entity is a external migratable key
305 #define TPM_PT_CMK_MIGRATE ((TPM_PAYLOAD_TYPE) 0x08) ///< The entity is a CMK migratable blob
306 #define TPM_PT_VENDOR_SPECIFIC ((TPM_PAYLOAD_TYPE) 0x80) ///< 0x80 - 0xFF Vendor specific payloads
309 // Part 2, section 4.3: TPM_ENTITY_TYPE
311 #define TPM_ET_KEYHANDLE ((UINT16) 0x0001) ///< The entity is a keyHandle or key
312 #define TPM_ET_OWNER ((UINT16) 0x0002) ///< The entity is the TPM Owner
313 #define TPM_ET_DATA ((UINT16) 0x0003) ///< The entity is some data
314 #define TPM_ET_SRK ((UINT16) 0x0004) ///< The entity is the SRK
315 #define TPM_ET_KEY ((UINT16) 0x0005) ///< The entity is a key or keyHandle
316 #define TPM_ET_REVOKE ((UINT16) 0x0006) ///< The entity is the RevokeTrust value
317 #define TPM_ET_DEL_OWNER_BLOB ((UINT16) 0x0007) ///< The entity is a delegate owner blob
318 #define TPM_ET_DEL_ROW ((UINT16) 0x0008) ///< The entity is a delegate row
319 #define TPM_ET_DEL_KEY_BLOB ((UINT16) 0x0009) ///< The entity is a delegate key blob
320 #define TPM_ET_COUNTER ((UINT16) 0x000A) ///< The entity is a counter
321 #define TPM_ET_NV ((UINT16) 0x000B) ///< The entity is a NV index
322 #define TPM_ET_OPERATOR ((UINT16) 0x000C) ///< The entity is the operator
323 #define TPM_ET_RESERVED_HANDLE ((UINT16) 0x0040) ///< Reserved. This value avoids collisions with the handle MSB setting.
325 // TPM_ENTITY_TYPE MSB Values: The MSB is used to indicate the ADIP encryption sheme when applicable
327 #define TPM_ET_XOR ((UINT16) 0x0000) ///< ADIP encryption scheme: XOR
328 #define TPM_ET_AES128 ((UINT16) 0x0006) ///< ADIP encryption scheme: AES 128 bits
331 // Part 2, section 4.4.1: Reserved Key Handles
333 #define TPM_KH_SRK ((TPM_KEY_HANDLE) 0x40000000) ///< The handle points to the SRK
334 #define TPM_KH_OWNER ((TPM_KEY_HANDLE) 0x40000001) ///< The handle points to the TPM Owner
335 #define TPM_KH_REVOKE ((TPM_KEY_HANDLE) 0x40000002) ///< The handle points to the RevokeTrust value
336 #define TPM_KH_TRANSPORT ((TPM_KEY_HANDLE) 0x40000003) ///< The handle points to the EstablishTransport static authorization
337 #define TPM_KH_OPERATOR ((TPM_KEY_HANDLE) 0x40000004) ///< The handle points to the Operator auth
338 #define TPM_KH_ADMIN ((TPM_KEY_HANDLE) 0x40000005) ///< The handle points to the delegation administration auth
339 #define TPM_KH_EK ((TPM_KEY_HANDLE) 0x40000006) ///< The handle points to the PUBEK, only usable with TPM_OwnerReadInternalPub
342 // Part 2, section 4.5: TPM_STARTUP_TYPE
344 #define TPM_ST_CLEAR ((TPM_STARTUP_TYPE) 0x0001) ///< The TPM is starting up from a clean state
345 #define TPM_ST_STATE ((TPM_STARTUP_TYPE) 0x0002) ///< The TPM is starting up from a saved state
346 #define TPM_ST_DEACTIVATED ((TPM_STARTUP_TYPE) 0x0003) ///< The TPM is to startup and set the deactivated flag to TRUE
349 // Part 2, section 4.6: TPM_STATUP_EFFECTS
350 // The table makeup is still an open issue.
354 // Part 2, section 4.7: TPM_PROTOCOL_ID
356 #define TPM_PID_OIAP ((TPM_PROTOCOL_ID) 0x0001) ///< The OIAP protocol.
357 #define TPM_PID_OSAP ((TPM_PROTOCOL_ID) 0x0002) ///< The OSAP protocol.
358 #define TPM_PID_ADIP ((TPM_PROTOCOL_ID) 0x0003) ///< The ADIP protocol.
359 #define TPM_PID_ADCP ((TPM_PROTOCOL_ID) 0x0004) ///< The ADCP protocol.
360 #define TPM_PID_OWNER ((TPM_PROTOCOL_ID) 0x0005) ///< The protocol for taking ownership of a TPM.
361 #define TPM_PID_DSAP ((TPM_PROTOCOL_ID) 0x0006) ///< The DSAP protocol
362 #define TPM_PID_TRANSPORT ((TPM_PROTOCOL_ID) 0x0007) ///< The transport protocol
365 // Part 2, section 4.8: TPM_ALGORITHM_ID
366 // The TPM MUST support the algorithms TPM_ALG_RSA, TPM_ALG_SHA, TPM_ALG_HMAC,
369 #define TPM_ALG_RSA ((TPM_ALGORITHM_ID) 0x00000001) ///< The RSA algorithm.
370 #define TPM_ALG_DES ((TPM_ALGORITHM_ID) 0x00000002) ///< The DES algorithm
371 #define TPM_ALG_3DES ((TPM_ALGORITHM_ID) 0x00000003) ///< The 3DES algorithm in EDE mode
372 #define TPM_ALG_SHA ((TPM_ALGORITHM_ID) 0x00000004) ///< The SHA1 algorithm
373 #define TPM_ALG_HMAC ((TPM_ALGORITHM_ID) 0x00000005) ///< The RFC 2104 HMAC algorithm
374 #define TPM_ALG_AES128 ((TPM_ALGORITHM_ID) 0x00000006) ///< The AES algorithm, key size 128
375 #define TPM_ALG_MGF1 ((TPM_ALGORITHM_ID) 0x00000007) ///< The XOR algorithm using MGF1 to create a string the size of the encrypted block
376 #define TPM_ALG_AES192 ((TPM_ALGORITHM_ID) 0x00000008) ///< AES, key size 192
377 #define TPM_ALG_AES256 ((TPM_ALGORITHM_ID) 0x00000009) ///< AES, key size 256
378 #define TPM_ALG_XOR ((TPM_ALGORITHM_ID) 0x0000000A) ///< XOR using the rolling nonces
381 // Part 2, section 4.9: TPM_PHYSICAL_PRESENCE
383 #define TPM_PHYSICAL_PRESENCE_HW_DISABLE ((TPM_PHYSICAL_PRESENCE) 0x0200) ///< Sets the physicalPresenceHWEnable to FALSE
384 #define TPM_PHYSICAL_PRESENCE_CMD_DISABLE ((TPM_PHYSICAL_PRESENCE) 0x0100) ///< Sets the physicalPresenceCMDEnable to FALSE
385 #define TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK ((TPM_PHYSICAL_PRESENCE) 0x0080) ///< Sets the physicalPresenceLifetimeLock to TRUE
386 #define TPM_PHYSICAL_PRESENCE_HW_ENABLE ((TPM_PHYSICAL_PRESENCE) 0x0040) ///< Sets the physicalPresenceHWEnable to TRUE
387 #define TPM_PHYSICAL_PRESENCE_CMD_ENABLE ((TPM_PHYSICAL_PRESENCE) 0x0020) ///< Sets the physicalPresenceCMDEnable to TRUE
388 #define TPM_PHYSICAL_PRESENCE_NOTPRESENT ((TPM_PHYSICAL_PRESENCE) 0x0010) ///< Sets PhysicalPresence = FALSE
389 #define TPM_PHYSICAL_PRESENCE_PRESENT ((TPM_PHYSICAL_PRESENCE) 0x0008) ///< Sets PhysicalPresence = TRUE
390 #define TPM_PHYSICAL_PRESENCE_LOCK ((TPM_PHYSICAL_PRESENCE) 0x0004) ///< Sets PhysicalPresenceLock = TRUE
393 // Part 2, section 4.10: TPM_MIGRATE_SCHEME
395 #define TPM_MS_MIGRATE ((TPM_MIGRATE_SCHEME) 0x0001) ///< A public key that can be used with all TPM migration commands other than 'ReWrap' mode.
396 #define TPM_MS_REWRAP ((TPM_MIGRATE_SCHEME) 0x0002) ///< A public key that can be used for the ReWrap mode of TPM_CreateMigrationBlob.
397 #define TPM_MS_MAINT ((TPM_MIGRATE_SCHEME) 0x0003) ///< A public key that can be used for the Maintenance commands
398 #define TPM_MS_RESTRICT_MIGRATE ((TPM_MIGRATE_SCHEME) 0x0004) ///< The key is to be migrated to a Migration Authority.
399 #define TPM_MS_RESTRICT_APPROVE_DOUBLE ((TPM_MIGRATE_SCHEME) 0x0005) ///< The key is to be migrated to an entity approved by a Migration Authority using double wrapping
402 // Part 2, section 4.11: TPM_EK_TYPE
404 #define TPM_EK_TYPE_ACTIVATE ((TPM_EK_TYPE) 0x0001) ///< The blob MUST be TPM_EK_BLOB_ACTIVATE
405 #define TPM_EK_TYPE_AUTH ((TPM_EK_TYPE) 0x0002) ///< The blob MUST be TPM_EK_BLOB_AUTH
408 // Part 2, section 4.12: TPM_PLATFORM_SPECIFIC
410 #define TPM_PS_PC_11 ((TPM_PLATFORM_SPECIFIC) 0x0001) ///< PC Specific version 1.1
411 #define TPM_PS_PC_12 ((TPM_PLATFORM_SPECIFIC) 0x0002) ///< PC Specific version 1.2
412 #define TPM_PS_PDA_12 ((TPM_PLATFORM_SPECIFIC) 0x0003) ///< PDA Specific version 1.2
413 #define TPM_PS_Server_12 ((TPM_PLATFORM_SPECIFIC) 0x0004) ///< Server Specific version 1.2
414 #define TPM_PS_Mobile_12 ((TPM_PLATFORM_SPECIFIC) 0x0005) ///< Mobil Specific version 1.2
417 // Part 2, section 5: Basic Structures
421 /// Part 2, section 5.1: TPM_STRUCT_VER
423 typedef struct tdTPM_STRUCT_VER
{
431 /// Part 2, section 5.3: TPM_VERSION
433 typedef struct tdTPM_VERSION
{
434 TPM_VERSION_BYTE major
;
435 TPM_VERSION_BYTE minor
;
441 #define TPM_SHA1_160_HASH_LEN 0x14
442 #define TPM_SHA1BASED_NONCE_LEN TPM_SHA1_160_HASH_LEN
445 /// Part 2, section 5.4: TPM_DIGEST
447 typedef struct tdTPM_DIGEST
{
448 UINT8 digest
[TPM_SHA1_160_HASH_LEN
];
452 /// This SHALL be the digest of the chosen identityLabel and privacyCA for a new TPM identity
454 typedef TPM_DIGEST TPM_CHOSENID_HASH
;
456 /// This SHALL be the hash of a list of PCR indexes and PCR values that a key or data is bound to
458 typedef TPM_DIGEST TPM_COMPOSITE_HASH
;
460 /// This SHALL be the value of a DIR register
462 typedef TPM_DIGEST TPM_DIRVALUE
;
464 typedef TPM_DIGEST TPM_HMAC
;
466 /// The value inside of the PCR
468 typedef TPM_DIGEST TPM_PCRVALUE
;
470 /// This SHALL be the value of the current internal audit state
472 typedef TPM_DIGEST TPM_AUDITDIGEST
;
475 /// Part 2, section 5.5: TPM_NONCE
477 typedef struct tdTPM_NONCE
{
482 /// This SHALL be a random value generated by a TPM immediately after the EK is installed
483 /// in that TPM, whenever an EK is installed in that TPM
485 typedef TPM_NONCE TPM_DAA_TPM_SEED
;
487 /// This SHALL be a random value
489 typedef TPM_NONCE TPM_DAA_CONTEXT_SEED
;
492 // Part 2, section 5.6: TPM_AUTHDATA
495 /// The AuthData data is the information that is saved or passed to provide proof of ownership
498 typedef UINT8 tdTPM_AUTHDATA
[20];
500 typedef tdTPM_AUTHDATA TPM_AUTHDATA
;
502 /// A secret plaintext value used in the authorization process
504 typedef TPM_AUTHDATA TPM_SECRET
;
506 /// A ciphertext (encrypted) version of AuthData data. The encryption mechanism depends on the context
508 typedef TPM_AUTHDATA TPM_ENCAUTH
;
511 /// Part 2, section 5.7: TPM_KEY_HANDLE_LIST
512 /// Size of handle is loaded * sizeof(TPM_KEY_HANDLE)
514 typedef struct tdTPM_KEY_HANDLE_LIST
{
516 TPM_KEY_HANDLE handle
[1];
517 } TPM_KEY_HANDLE_LIST
;
520 // Part 2, section 5.8: TPM_KEY_USAGE values
523 /// TPM_KEY_SIGNING SHALL indicate a signing key. The [private] key SHALL be
524 /// used for signing operations, only. This means that it MUST be a leaf of the
525 /// Protected Storage key hierarchy.
527 #define TPM_KEY_SIGNING ((UINT16) 0x0010)
529 /// TPM_KEY_STORAGE SHALL indicate a storage key. The key SHALL be used to wrap
530 /// and unwrap other keys in the Protected Storage hierarchy
532 #define TPM_KEY_STORAGE ((UINT16) 0x0011)
534 /// TPM_KEY_IDENTITY SHALL indicate an identity key. The key SHALL be used for
535 /// operations that require a TPM identity, only.
537 #define TPM_KEY_IDENTITY ((UINT16) 0x0012)
539 /// TPM_KEY_AUTHCHANGE SHALL indicate an ephemeral key that is in use during
540 /// the ChangeAuthAsym process, only.
542 #define TPM_KEY_AUTHCHANGE ((UINT16) 0x0013)
544 /// TPM_KEY_BIND SHALL indicate a key that can be used for TPM_Bind and
545 /// TPM_Unbind operations only.
547 #define TPM_KEY_BIND ((UINT16) 0x0014)
549 /// TPM_KEY_LEGACY SHALL indicate a key that can perform signing and binding
550 /// operations. The key MAY be used for both signing and binding operations.
551 /// The TPM_KEY_LEGACY key type is to allow for use by applications where both
552 /// signing and encryption operations occur with the same key. The use of this
553 /// key type is not recommended TPM_KEY_MIGRATE 0x0016 This SHALL indicate a
554 /// key in use for TPM_MigrateKey
556 #define TPM_KEY_LEGACY ((UINT16) 0x0015)
558 /// TPM_KEY_MIGRAGE SHALL indicate a key in use for TPM_MigrateKey
560 #define TPM_KEY_MIGRATE ((UINT16) 0x0016)
563 // Part 2, section 5.8.1: Mandatory Key Usage Schemes
566 #define TPM_ES_NONE ((TPM_ENC_SCHEME) 0x0001)
567 #define TPM_ES_RSAESPKCSv15 ((TPM_ENC_SCHEME) 0x0002)
568 #define TPM_ES_RSAESOAEP_SHA1_MGF1 ((TPM_ENC_SCHEME) 0x0003)
569 #define TPM_ES_SYM_CNT ((TPM_ENC_SCHEME) 0x0004) ///< rev94 defined
570 #define TPM_ES_SYM_CTR ((TPM_ENC_SCHEME) 0x0004)
571 #define TPM_ES_SYM_OFB ((TPM_ENC_SCHEME) 0x0005)
573 #define TPM_SS_NONE ((TPM_SIG_SCHEME) 0x0001)
574 #define TPM_SS_RSASSAPKCS1v15_SHA1 ((TPM_SIG_SCHEME) 0x0002)
575 #define TPM_SS_RSASSAPKCS1v15_DER ((TPM_SIG_SCHEME) 0x0003)
576 #define TPM_SS_RSASSAPKCS1v15_INFO ((TPM_SIG_SCHEME) 0x0004)
579 // Part 2, section 5.9: TPM_AUTH_DATA_USAGE values
581 #define TPM_AUTH_NEVER ((TPM_AUTH_DATA_USAGE) 0x00)
582 #define TPM_AUTH_ALWAYS ((TPM_AUTH_DATA_USAGE) 0x01)
583 #define TPM_AUTH_PRIV_USE_ONLY ((TPM_AUTH_DATA_USAGE) 0x03)
586 /// Part 2, section 5.10: TPM_KEY_FLAGS
588 typedef enum tdTPM_KEY_FLAGS
{
589 redirection
= 0x00000001,
590 migratable
= 0x00000002,
591 isVolatile
= 0x00000004,
592 pcrIgnoredOnRead
= 0x00000008,
593 migrateAuthority
= 0x00000010
594 } TPM_KEY_FLAGS_BITS
;
597 /// Part 2, section 5.11: TPM_CHANGEAUTH_VALIDATE
599 typedef struct tdTPM_CHANGEAUTH_VALIDATE
{
600 TPM_SECRET newAuthSecret
;
602 } TPM_CHANGEAUTH_VALIDATE
;
605 /// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH
606 /// decalared after section 10 to catch declaration of TPM_PUBKEY
608 /// Part 2 section 10.1: TPM_KEY_PARMS
609 /// [size_is(parmSize)] BYTE* parms;
611 typedef struct tdTPM_KEY_PARMS
{
612 TPM_ALGORITHM_ID algorithmID
;
613 TPM_ENC_SCHEME encScheme
;
614 TPM_SIG_SCHEME sigScheme
;
620 /// Part 2, section 10.4: TPM_STORE_PUBKEY
622 typedef struct tdTPM_STORE_PUBKEY
{
628 /// Part 2, section 10.5: TPM_PUBKEY
630 typedef struct tdTPM_PUBKEY
{
631 TPM_KEY_PARMS algorithmParms
;
632 TPM_STORE_PUBKEY pubKey
;
636 /// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH
638 typedef struct tdTPM_MIGRATIONKEYAUTH
{
639 TPM_PUBKEY migrationKey
;
640 TPM_MIGRATE_SCHEME migrationScheme
;
642 } TPM_MIGRATIONKEYAUTH
;
645 /// Part 2, section 5.13: TPM_COUNTER_VALUE
647 typedef struct tdTPM_COUNTER_VALUE
{
648 TPM_STRUCTURE_TAG tag
;
650 TPM_ACTUAL_COUNT counter
;
654 /// Part 2, section 5.14: TPM_SIGN_INFO
655 /// Size of data indicated by dataLen
657 typedef struct tdTPM_SIGN_INFO
{
658 TPM_STRUCTURE_TAG tag
;
666 /// Part 2, section 5.15: TPM_MSA_COMPOSITE
667 /// Number of migAuthDigest indicated by MSAlist
669 typedef struct tdTPM_MSA_COMPOSITE
{
671 TPM_DIGEST migAuthDigest
[1];
675 /// Part 2, section 5.16: TPM_CMK_AUTH
677 typedef struct tdTPM_CMK_AUTH
{
678 TPM_DIGEST migrationAuthorityDigest
;
679 TPM_DIGEST destinationKeyDigest
;
680 TPM_DIGEST sourceKeyDigest
;
684 // Part 2, section 5.17: TPM_CMK_DELEGATE
686 #define TPM_CMK_DELEGATE_SIGNING ((TPM_CMK_DELEGATE) BIT31)
687 #define TPM_CMK_DELEGATE_STORAGE ((TPM_CMK_DELEGATE) BIT30)
688 #define TPM_CMK_DELEGATE_BIND ((TPM_CMK_DELEGATE) BIT29)
689 #define TPM_CMK_DELEGATE_LEGACY ((TPM_CMK_DELEGATE) BIT28)
690 #define TPM_CMK_DELEGATE_MIGRATE ((TPM_CMK_DELEGATE) BIT27)
693 /// Part 2, section 5.18: TPM_SELECT_SIZE
695 typedef struct tdTPM_SELECT_SIZE
{
702 /// Part 2, section 5,19: TPM_CMK_MIGAUTH
704 typedef struct tdTPM_CMK_MIGAUTH
{
705 TPM_STRUCTURE_TAG tag
;
706 TPM_DIGEST msaDigest
;
707 TPM_DIGEST pubKeyDigest
;
711 /// Part 2, section 5.20: TPM_CMK_SIGTICKET
713 typedef struct tdTPM_CMK_SIGTICKET
{
714 TPM_STRUCTURE_TAG tag
;
715 TPM_DIGEST verKeyDigest
;
716 TPM_DIGEST signedData
;
720 /// Part 2, section 5.21: TPM_CMK_MA_APPROVAL
722 typedef struct tdTPM_CMK_MA_APPROVAL
{
723 TPM_STRUCTURE_TAG tag
;
724 TPM_DIGEST migrationAuthorityDigest
;
725 } TPM_CMK_MA_APPROVAL
;
728 // Part 2, section 6: Command Tags
730 #define TPM_TAG_RQU_COMMAND ((TPM_STRUCTURE_TAG) 0x00C1)
731 #define TPM_TAG_RQU_AUTH1_COMMAND ((TPM_STRUCTURE_TAG) 0x00C2)
732 #define TPM_TAG_RQU_AUTH2_COMMAND ((TPM_STRUCTURE_TAG) 0x00C3)
733 #define TPM_TAG_RSP_COMMAND ((TPM_STRUCTURE_TAG) 0x00C4)
734 #define TPM_TAG_RSP_AUTH1_COMMAND ((TPM_STRUCTURE_TAG) 0x00C5)
735 #define TPM_TAG_RSP_AUTH2_COMMAND ((TPM_STRUCTURE_TAG) 0x00C6)
738 /// Part 2, section 7.1: TPM_PERMANENT_FLAGS
740 typedef struct tdTPM_PERMANENT_FLAGS
{
741 TPM_STRUCTURE_TAG tag
;
746 BOOLEAN disableOwnerClear
;
747 BOOLEAN allowMaintenance
;
748 BOOLEAN physicalPresenceLifetimeLock
;
749 BOOLEAN physicalPresenceHWEnable
;
750 BOOLEAN physicalPresenceCMDEnable
;
756 BOOLEAN enableRevokeEK
;
759 BOOLEAN tpmEstablished
;
760 BOOLEAN maintenanceDone
;
761 BOOLEAN disableFullDALogicInfo
;
762 } TPM_PERMANENT_FLAGS
;
765 // Part 2, section 7.1.1: Flag Restrictions (of TPM_PERMANENT_FLAGS)
767 #define TPM_PF_DISABLE ((TPM_CAPABILITY_AREA) 1)
768 #define TPM_PF_OWNERSHIP ((TPM_CAPABILITY_AREA) 2)
769 #define TPM_PF_DEACTIVATED ((TPM_CAPABILITY_AREA) 3)
770 #define TPM_PF_READPUBEK ((TPM_CAPABILITY_AREA) 4)
771 #define TPM_PF_DISABLEOWNERCLEAR ((TPM_CAPABILITY_AREA) 5)
772 #define TPM_PF_ALLOWMAINTENANCE ((TPM_CAPABILITY_AREA) 6)
773 #define TPM_PF_PHYSICALPRESENCELIFETIMELOCK ((TPM_CAPABILITY_AREA) 7)
774 #define TPM_PF_PHYSICALPRESENCEHWENABLE ((TPM_CAPABILITY_AREA) 8)
775 #define TPM_PF_PHYSICALPRESENCECMDENABLE ((TPM_CAPABILITY_AREA) 9)
776 #define TPM_PF_CEKPUSED ((TPM_CAPABILITY_AREA) 10)
777 #define TPM_PF_TPMPOST ((TPM_CAPABILITY_AREA) 11)
778 #define TPM_PF_TPMPOSTLOCK ((TPM_CAPABILITY_AREA) 12)
779 #define TPM_PF_FIPS ((TPM_CAPABILITY_AREA) 13)
780 #define TPM_PF_OPERATOR ((TPM_CAPABILITY_AREA) 14)
781 #define TPM_PF_ENABLEREVOKEEK ((TPM_CAPABILITY_AREA) 15)
782 #define TPM_PF_NV_LOCKED ((TPM_CAPABILITY_AREA) 16)
783 #define TPM_PF_READSRKPUB ((TPM_CAPABILITY_AREA) 17)
784 #define TPM_PF_TPMESTABLISHED ((TPM_CAPABILITY_AREA) 18)
785 #define TPM_PF_MAINTENANCEDONE ((TPM_CAPABILITY_AREA) 19)
786 #define TPM_PF_DISABLEFULLDALOGICINFO ((TPM_CAPABILITY_AREA) 20)
789 /// Part 2, section 7.2: TPM_STCLEAR_FLAGS
791 typedef struct tdTPM_STCLEAR_FLAGS
{
792 TPM_STRUCTURE_TAG tag
;
794 BOOLEAN disableForceClear
;
795 BOOLEAN physicalPresence
;
796 BOOLEAN physicalPresenceLock
;
801 // Part 2, section 7.2.1: Flag Restrictions (of TPM_STCLEAR_FLAGS)
803 #define TPM_SF_DEACTIVATED ((TPM_CAPABILITY_AREA) 1)
804 #define TPM_SF_DISABLEFORCECLEAR ((TPM_CAPABILITY_AREA) 2)
805 #define TPM_SF_PHYSICALPRESENCE ((TPM_CAPABILITY_AREA) 3)
806 #define TPM_SF_PHYSICALPRESENCELOCK ((TPM_CAPABILITY_AREA) 4)
807 #define TPM_SF_BGLOBALLOCK ((TPM_CAPABILITY_AREA) 5)
810 /// Part 2, section 7.3: TPM_STANY_FLAGS
812 typedef struct tdTPM_STANY_FLAGS
{
813 TPM_STRUCTURE_TAG tag
;
814 BOOLEAN postInitialise
;
815 TPM_MODIFIER_INDICATOR localityModifier
;
816 BOOLEAN transportExclusive
;
821 // Part 2, section 7.3.1: Flag Restrictions (of TPM_STANY_FLAGS)
823 #define TPM_AF_POSTINITIALISE ((TPM_CAPABILITY_AREA) 1)
824 #define TPM_AF_LOCALITYMODIFIER ((TPM_CAPABILITY_AREA) 2)
825 #define TPM_AF_TRANSPORTEXCLUSIVE ((TPM_CAPABILITY_AREA) 3)
826 #define TPM_AF_TOSPRESENT ((TPM_CAPABILITY_AREA) 4)
829 // All those structures defined in section 7.4, 7.5, 7.6 are not normative and
830 // thus no definitions here
832 // Part 2, section 7.4: TPM_PERMANENT_DATA
834 #define TPM_MIN_COUNTERS 4 ///< the minimum number of counters is 4
835 #define TPM_DELEGATE_KEY TPM_KEY
836 #define TPM_NUM_PCR 16
837 #define TPM_MAX_NV_WRITE_NOOWNER 64
840 // Part 2, section 7.4.1: PERMANENT_DATA Subcap for SetCapability
842 #define TPM_PD_REVMAJOR ((TPM_CAPABILITY_AREA) 1)
843 #define TPM_PD_REVMINOR ((TPM_CAPABILITY_AREA) 2)
844 #define TPM_PD_TPMPROOF ((TPM_CAPABILITY_AREA) 3)
845 #define TPM_PD_OWNERAUTH ((TPM_CAPABILITY_AREA) 4)
846 #define TPM_PD_OPERATORAUTH ((TPM_CAPABILITY_AREA) 5)
847 #define TPM_PD_MANUMAINTPUB ((TPM_CAPABILITY_AREA) 6)
848 #define TPM_PD_ENDORSEMENTKEY ((TPM_CAPABILITY_AREA) 7)
849 #define TPM_PD_SRK ((TPM_CAPABILITY_AREA) 8)
850 #define TPM_PD_DELEGATEKEY ((TPM_CAPABILITY_AREA) 9)
851 #define TPM_PD_CONTEXTKEY ((TPM_CAPABILITY_AREA) 10)
852 #define TPM_PD_AUDITMONOTONICCOUNTER ((TPM_CAPABILITY_AREA) 11)
853 #define TPM_PD_MONOTONICCOUNTER ((TPM_CAPABILITY_AREA) 12)
854 #define TPM_PD_PCRATTRIB ((TPM_CAPABILITY_AREA) 13)
855 #define TPM_PD_ORDINALAUDITSTATUS ((TPM_CAPABILITY_AREA) 14)
856 #define TPM_PD_AUTHDIR ((TPM_CAPABILITY_AREA) 15)
857 #define TPM_PD_RNGSTATE ((TPM_CAPABILITY_AREA) 16)
858 #define TPM_PD_FAMILYTABLE ((TPM_CAPABILITY_AREA) 17)
859 #define TPM_DELEGATETABLE ((TPM_CAPABILITY_AREA) 18)
860 #define TPM_PD_EKRESET ((TPM_CAPABILITY_AREA) 19)
861 #define TPM_PD_MAXNVBUFSIZE ((TPM_CAPABILITY_AREA) 20)
862 #define TPM_PD_LASTFAMILYID ((TPM_CAPABILITY_AREA) 21)
863 #define TPM_PD_NOOWNERNVWRITE ((TPM_CAPABILITY_AREA) 22)
864 #define TPM_PD_RESTRICTDELEGATE ((TPM_CAPABILITY_AREA) 23)
865 #define TPM_PD_TPMDAASEED ((TPM_CAPABILITY_AREA) 24)
866 #define TPM_PD_DAAPROOF ((TPM_CAPABILITY_AREA) 25)
869 /// Part 2, section 7.5: TPM_STCLEAR_DATA
870 /// available inside TPM only
872 typedef struct tdTPM_STCLEAR_DATA
{
873 TPM_STRUCTURE_TAG tag
;
874 TPM_NONCE contextNonceKey
;
875 TPM_COUNT_ID countID
;
876 UINT32 ownerReference
;
877 BOOLEAN disableResetLock
;
878 TPM_PCRVALUE PCR
[TPM_NUM_PCR
];
879 UINT32 deferredPhysicalPresence
;
883 // Part 2, section 7.5.1: STCLEAR_DATA Subcap for SetCapability
885 #define TPM_SD_CONTEXTNONCEKEY ((TPM_CAPABILITY_AREA)0x00000001)
886 #define TPM_SD_COUNTID ((TPM_CAPABILITY_AREA)0x00000002)
887 #define TPM_SD_OWNERREFERENCE ((TPM_CAPABILITY_AREA)0x00000003)
888 #define TPM_SD_DISABLERESETLOCK ((TPM_CAPABILITY_AREA)0x00000004)
889 #define TPM_SD_PCR ((TPM_CAPABILITY_AREA)0x00000005)
890 #define TPM_SD_DEFERREDPHYSICALPRESENCE ((TPM_CAPABILITY_AREA)0x00000006)
893 // Part 2, section 7.6.1: STANY_DATA Subcap for SetCapability
895 #define TPM_AD_CONTEXTNONCESESSION ((TPM_CAPABILITY_AREA) 1)
896 #define TPM_AD_AUDITDIGEST ((TPM_CAPABILITY_AREA) 2)
897 #define TPM_AD_CURRENTTICKS ((TPM_CAPABILITY_AREA) 3)
898 #define TPM_AD_CONTEXTCOUNT ((TPM_CAPABILITY_AREA) 4)
899 #define TPM_AD_CONTEXTLIST ((TPM_CAPABILITY_AREA) 5)
900 #define TPM_AD_SESSIONS ((TPM_CAPABILITY_AREA) 6)
903 // Part 2, section 8: PCR Structures
907 /// Part 2, section 8.1: TPM_PCR_SELECTION
908 /// Size of pcrSelect[] indicated by sizeOfSelect
910 typedef struct tdTPM_PCR_SELECTION
{
916 /// Part 2, section 8.2: TPM_PCR_COMPOSITE
917 /// Size of pcrValue[] indicated by valueSize
919 typedef struct tdTPM_PCR_COMPOSITE
{
920 TPM_PCR_SELECTION select
;
922 TPM_PCRVALUE pcrValue
[1];
926 /// Part 2, section 8.3: TPM_PCR_INFO
928 typedef struct tdTPM_PCR_INFO
{
929 TPM_PCR_SELECTION pcrSelection
;
930 TPM_COMPOSITE_HASH digestAtRelease
;
931 TPM_COMPOSITE_HASH digestAtCreation
;
935 /// Part 2, section 8.6: TPM_LOCALITY_SELECTION
937 typedef UINT8 TPM_LOCALITY_SELECTION
;
939 #define TPM_LOC_FOUR ((UINT8) 0x10)
940 #define TPM_LOC_THREE ((UINT8) 0x08)
941 #define TPM_LOC_TWO ((UINT8) 0x04)
942 #define TPM_LOC_ONE ((UINT8) 0x02)
943 #define TPM_LOC_ZERO ((UINT8) 0x01)
946 /// Part 2, section 8.4: TPM_PCR_INFO_LONG
948 typedef struct tdTPM_PCR_INFO_LONG
{
949 TPM_STRUCTURE_TAG tag
;
950 TPM_LOCALITY_SELECTION localityAtCreation
;
951 TPM_LOCALITY_SELECTION localityAtRelease
;
952 TPM_PCR_SELECTION creationPCRSelection
;
953 TPM_PCR_SELECTION releasePCRSelection
;
954 TPM_COMPOSITE_HASH digestAtCreation
;
955 TPM_COMPOSITE_HASH digestAtRelease
;
959 /// Part 2, section 8.5: TPM_PCR_INFO_SHORT
961 typedef struct tdTPM_PCR_INFO_SHORT
{
962 TPM_PCR_SELECTION pcrSelection
;
963 TPM_LOCALITY_SELECTION localityAtRelease
;
964 TPM_COMPOSITE_HASH digestAtRelease
;
965 } TPM_PCR_INFO_SHORT
;
968 /// Part 2, section 8.8: TPM_PCR_ATTRIBUTES
970 typedef struct tdTPM_PCR_ATTRIBUTES
{
972 TPM_LOCALITY_SELECTION pcrExtendLocal
;
973 TPM_LOCALITY_SELECTION pcrResetLocal
;
974 } TPM_PCR_ATTRIBUTES
;
977 // Part 2, section 9: Storage Structures
981 /// Part 2, section 9.1: TPM_STORED_DATA
982 /// [size_is(sealInfoSize)] BYTE* sealInfo;
983 /// [size_is(encDataSize)] BYTE* encData;
985 typedef struct tdTPM_STORED_DATA
{
994 /// Part 2, section 9.2: TPM_STORED_DATA12
995 /// [size_is(sealInfoSize)] BYTE* sealInfo;
996 /// [size_is(encDataSize)] BYTE* encData;
998 typedef struct tdTPM_STORED_DATA12
{
999 TPM_STRUCTURE_TAG tag
;
1001 UINT32 sealInfoSize
;
1005 } TPM_STORED_DATA12
;
1008 /// Part 2, section 9.3: TPM_SEALED_DATA
1009 /// [size_is(dataSize)] BYTE* data;
1011 typedef struct tdTPM_SEALED_DATA
{
1012 TPM_PAYLOAD_TYPE payload
;
1013 TPM_SECRET authData
;
1015 TPM_DIGEST storedDigest
;
1021 /// Part 2, section 9.4: TPM_SYMMETRIC_KEY
1022 /// [size_is(size)] BYTE* data;
1024 typedef struct tdTPM_SYMMETRIC_KEY
{
1025 TPM_ALGORITHM_ID algId
;
1026 TPM_ENC_SCHEME encScheme
;
1029 } TPM_SYMMETRIC_KEY
;
1032 /// Part 2, section 9.5: TPM_BOUND_DATA
1034 typedef struct tdTPM_BOUND_DATA
{
1036 TPM_PAYLOAD_TYPE payload
;
1037 UINT8 payloadData
[1];
1041 // Part 2 section 10: TPM_KEY complex
1045 // Section 10.1, 10.4, and 10.5 have been defined previously
1049 /// Part 2, section 10.2: TPM_KEY
1050 /// [size_is(encDataSize)] BYTE* encData;
1052 typedef struct tdTPM_KEY
{
1054 TPM_KEY_USAGE keyUsage
;
1055 TPM_KEY_FLAGS keyFlags
;
1056 TPM_AUTH_DATA_USAGE authDataUsage
;
1057 TPM_KEY_PARMS algorithmParms
;
1060 TPM_STORE_PUBKEY pubKey
;
1066 /// Part 2, section 10.3: TPM_KEY12
1067 /// [size_is(encDataSize)] BYTE* encData;
1069 typedef struct tdTPM_KEY12
{
1070 TPM_STRUCTURE_TAG tag
;
1072 TPM_KEY_USAGE keyUsage
;
1073 TPM_KEY_FLAGS keyFlags
;
1074 TPM_AUTH_DATA_USAGE authDataUsage
;
1075 TPM_KEY_PARMS algorithmParms
;
1078 TPM_STORE_PUBKEY pubKey
;
1084 /// Part 2, section 10.7: TPM_STORE_PRIVKEY
1085 /// [size_is(keyLength)] BYTE* key;
1087 typedef struct tdTPM_STORE_PRIVKEY
{
1090 } TPM_STORE_PRIVKEY
;
1093 /// Part 2, section 10.6: TPM_STORE_ASYMKEY
1095 typedef struct tdTPM_STORE_ASYMKEY
{ // pos len total
1096 TPM_PAYLOAD_TYPE payload
; // 0 1 1
1097 TPM_SECRET usageAuth
; // 1 20 21
1098 TPM_SECRET migrationAuth
; // 21 20 41
1099 TPM_DIGEST pubDataDigest
; // 41 20 61
1100 TPM_STORE_PRIVKEY privKey
; // 61 132-151 193-214
1101 } TPM_STORE_ASYMKEY
;
1104 /// Part 2, section 10.8: TPM_MIGRATE_ASYMKEY
1105 /// [size_is(partPrivKeyLen)] BYTE* partPrivKey;
1107 typedef struct tdTPM_MIGRATE_ASYMKEY
{ // pos len total
1108 TPM_PAYLOAD_TYPE payload
; // 0 1 1
1109 TPM_SECRET usageAuth
; // 1 20 21
1110 TPM_DIGEST pubDataDigest
; // 21 20 41
1111 UINT32 partPrivKeyLen
; // 41 4 45
1112 UINT8
*partPrivKey
; // 45 112-127 157-172
1113 } TPM_MIGRATE_ASYMKEY
;
1116 /// Part 2, section 10.9: TPM_KEY_CONTROL
1118 #define TPM_KEY_CONTROL_OWNER_EVICT ((UINT32) 0x00000001)
1121 // Part 2, section 11: Signed Structures
1125 /// Part 2, section 11.1: TPM_CERTIFY_INFO Structure
1127 typedef struct tdTPM_CERTIFY_INFO
{
1128 TPM_STRUCT_VER version
;
1129 TPM_KEY_USAGE keyUsage
;
1130 TPM_KEY_FLAGS keyFlags
;
1131 TPM_AUTH_DATA_USAGE authDataUsage
;
1132 TPM_KEY_PARMS algorithmParms
;
1133 TPM_DIGEST pubkeyDigest
;
1135 BOOLEAN parentPCRStatus
;
1141 /// Part 2, section 11.2: TPM_CERTIFY_INFO2 Structure
1143 typedef struct tdTPM_CERTIFY_INFO2
{
1144 TPM_STRUCTURE_TAG tag
;
1146 TPM_PAYLOAD_TYPE payloadType
;
1147 TPM_KEY_USAGE keyUsage
;
1148 TPM_KEY_FLAGS keyFlags
;
1149 TPM_AUTH_DATA_USAGE authDataUsage
;
1150 TPM_KEY_PARMS algorithmParms
;
1151 TPM_DIGEST pubkeyDigest
;
1153 BOOLEAN parentPCRStatus
;
1156 UINT32 migrationAuthoritySize
;
1157 UINT8
*migrationAuthority
;
1158 } TPM_CERTIFY_INFO2
;
1161 /// Part 2, section 11.3 TPM_QUOTE_INFO Structure
1163 typedef struct tdTPM_QUOTE_INFO
{
1164 TPM_STRUCT_VER version
;
1166 TPM_COMPOSITE_HASH digestValue
;
1167 TPM_NONCE externalData
;
1171 /// Part 2, section 11.4 TPM_QUOTE_INFO2 Structure
1173 typedef struct tdTPM_QUOTE_INFO2
{
1174 TPM_STRUCTURE_TAG tag
;
1176 TPM_NONCE externalData
;
1177 TPM_PCR_INFO_SHORT infoShort
;
1181 // Part 2, section 12: Identity Structures
1185 /// Part 2, section 12.1 TPM_EK_BLOB
1187 typedef struct tdTPM_EK_BLOB
{
1188 TPM_STRUCTURE_TAG tag
;
1195 /// Part 2, section 12.2 TPM_EK_BLOB_ACTIVATE
1197 typedef struct tdTPM_EK_BLOB_ACTIVATE
{
1198 TPM_STRUCTURE_TAG tag
;
1199 TPM_SYMMETRIC_KEY sessionKey
;
1200 TPM_DIGEST idDigest
;
1201 TPM_PCR_INFO_SHORT pcrInfo
;
1202 } TPM_EK_BLOB_ACTIVATE
;
1205 /// Part 2, section 12.3 TPM_EK_BLOB_AUTH
1207 typedef struct tdTPM_EK_BLOB_AUTH
{
1208 TPM_STRUCTURE_TAG tag
;
1209 TPM_SECRET authValue
;
1214 /// Part 2, section 12.5 TPM_IDENTITY_CONTENTS
1216 typedef struct tdTPM_IDENTITY_CONTENTS
{
1219 TPM_CHOSENID_HASH labelPrivCADigest
;
1220 TPM_PUBKEY identityPubKey
;
1221 } TPM_IDENTITY_CONTENTS
;
1224 /// Part 2, section 12.6 TPM_IDENTITY_REQ
1226 typedef struct tdTPM_IDENTITY_REQ
{
1229 TPM_KEY_PARMS asymAlgorithm
;
1230 TPM_KEY_PARMS symAlgorithm
;
1236 /// Part 2, section 12.7 TPM_IDENTITY_PROOF
1238 typedef struct tdTPM_IDENTITY_PROOF
{
1241 UINT32 identityBindingSize
;
1242 UINT32 endorsementSize
;
1243 UINT32 platformSize
;
1244 UINT32 conformanceSize
;
1245 TPM_PUBKEY identityKey
;
1247 UINT8
*identityBinding
;
1248 UINT8
*endorsementCredential
;
1249 UINT8
*platformCredential
;
1250 UINT8
*conformanceCredential
;
1251 } TPM_IDENTITY_PROOF
;
1254 /// Part 2, section 12.8 TPM_ASYM_CA_CONTENTS
1256 typedef struct tdTPM_ASYM_CA_CONTENTS
{
1257 TPM_SYMMETRIC_KEY sessionKey
;
1258 TPM_DIGEST idDigest
;
1259 } TPM_ASYM_CA_CONTENTS
;
1262 /// Part 2, section 12.9 TPM_SYM_CA_ATTESTATION
1264 typedef struct tdTPM_SYM_CA_ATTESTATION
{
1266 TPM_KEY_PARMS algorithm
;
1268 } TPM_SYM_CA_ATTESTATION
;
1271 /// Part 2, section 15: Tick Structures
1272 /// Placed here out of order because definitions are used in section 13.
1274 typedef struct tdTPM_CURRENT_TICKS
{
1275 TPM_STRUCTURE_TAG tag
;
1276 UINT64 currentTicks
;
1278 TPM_NONCE tickNonce
;
1279 } TPM_CURRENT_TICKS
;
1282 /// Part 2, section 13: Transport structures
1286 /// Part 2, section 13.1: TPM _TRANSPORT_PUBLIC
1288 typedef struct tdTPM_TRANSPORT_PUBLIC
{
1289 TPM_STRUCTURE_TAG tag
;
1290 TPM_TRANSPORT_ATTRIBUTES transAttributes
;
1291 TPM_ALGORITHM_ID algId
;
1292 TPM_ENC_SCHEME encScheme
;
1293 } TPM_TRANSPORT_PUBLIC
;
1296 // Part 2, section 13.1.1 TPM_TRANSPORT_ATTRIBUTES Definitions
1298 #define TPM_TRANSPORT_ENCRYPT ((UINT32)BIT0)
1299 #define TPM_TRANSPORT_LOG ((UINT32)BIT1)
1300 #define TPM_TRANSPORT_EXCLUSIVE ((UINT32)BIT2)
1303 /// Part 2, section 13.2 TPM_TRANSPORT_INTERNAL
1305 typedef struct tdTPM_TRANSPORT_INTERNAL
{
1306 TPM_STRUCTURE_TAG tag
;
1307 TPM_AUTHDATA authData
;
1308 TPM_TRANSPORT_PUBLIC transPublic
;
1309 TPM_TRANSHANDLE transHandle
;
1310 TPM_NONCE transNonceEven
;
1311 TPM_DIGEST transDigest
;
1312 } TPM_TRANSPORT_INTERNAL
;
1315 /// Part 2, section 13.3 TPM_TRANSPORT_LOG_IN structure
1317 typedef struct tdTPM_TRANSPORT_LOG_IN
{
1318 TPM_STRUCTURE_TAG tag
;
1319 TPM_DIGEST parameters
;
1320 TPM_DIGEST pubKeyHash
;
1321 } TPM_TRANSPORT_LOG_IN
;
1324 /// Part 2, section 13.4 TPM_TRANSPORT_LOG_OUT structure
1326 typedef struct tdTPM_TRANSPORT_LOG_OUT
{
1327 TPM_STRUCTURE_TAG tag
;
1328 TPM_CURRENT_TICKS currentTicks
;
1329 TPM_DIGEST parameters
;
1330 TPM_MODIFIER_INDICATOR locality
;
1331 } TPM_TRANSPORT_LOG_OUT
;
1334 /// Part 2, section 13.5 TPM_TRANSPORT_AUTH structure
1336 typedef struct tdTPM_TRANSPORT_AUTH
{
1337 TPM_STRUCTURE_TAG tag
;
1338 TPM_AUTHDATA authData
;
1339 } TPM_TRANSPORT_AUTH
;
1342 // Part 2, section 14: Audit Structures
1346 /// Part 2, section 14.1 TPM_AUDIT_EVENT_IN structure
1348 typedef struct tdTPM_AUDIT_EVENT_IN
{
1349 TPM_STRUCTURE_TAG tag
;
1350 TPM_DIGEST inputParms
;
1351 TPM_COUNTER_VALUE auditCount
;
1352 } TPM_AUDIT_EVENT_IN
;
1355 /// Part 2, section 14.2 TPM_AUDIT_EVENT_OUT structure
1357 typedef struct tdTPM_AUDIT_EVENT_OUT
{
1358 TPM_STRUCTURE_TAG tag
;
1359 TPM_COMMAND_CODE ordinal
;
1360 TPM_DIGEST outputParms
;
1361 TPM_COUNTER_VALUE auditCount
;
1362 TPM_RESULT returnCode
;
1363 } TPM_AUDIT_EVENT_OUT
;
1366 // Part 2, section 16: Return Codes
1369 #define TPM_VENDOR_ERROR TPM_Vendor_Specific32
1370 #define TPM_NON_FATAL 0x00000800
1372 #define TPM_SUCCESS ((TPM_RESULT) TPM_BASE)
1373 #define TPM_AUTHFAIL ((TPM_RESULT) (TPM_BASE + 1))
1374 #define TPM_BADINDEX ((TPM_RESULT) (TPM_BASE + 2))
1375 #define TPM_BAD_PARAMETER ((TPM_RESULT) (TPM_BASE + 3))
1376 #define TPM_AUDITFAILURE ((TPM_RESULT) (TPM_BASE + 4))
1377 #define TPM_CLEAR_DISABLED ((TPM_RESULT) (TPM_BASE + 5))
1378 #define TPM_DEACTIVATED ((TPM_RESULT) (TPM_BASE + 6))
1379 #define TPM_DISABLED ((TPM_RESULT) (TPM_BASE + 7))
1380 #define TPM_DISABLED_CMD ((TPM_RESULT) (TPM_BASE + 8))
1381 #define TPM_FAIL ((TPM_RESULT) (TPM_BASE + 9))
1382 #define TPM_BAD_ORDINAL ((TPM_RESULT) (TPM_BASE + 10))
1383 #define TPM_INSTALL_DISABLED ((TPM_RESULT) (TPM_BASE + 11))
1384 #define TPM_INVALID_KEYHANDLE ((TPM_RESULT) (TPM_BASE + 12))
1385 #define TPM_KEYNOTFOUND ((TPM_RESULT) (TPM_BASE + 13))
1386 #define TPM_INAPPROPRIATE_ENC ((TPM_RESULT) (TPM_BASE + 14))
1387 #define TPM_MIGRATEFAIL ((TPM_RESULT) (TPM_BASE + 15))
1388 #define TPM_INVALID_PCR_INFO ((TPM_RESULT) (TPM_BASE + 16))
1389 #define TPM_NOSPACE ((TPM_RESULT) (TPM_BASE + 17))
1390 #define TPM_NOSRK ((TPM_RESULT) (TPM_BASE + 18))
1391 #define TPM_NOTSEALED_BLOB ((TPM_RESULT) (TPM_BASE + 19))
1392 #define TPM_OWNER_SET ((TPM_RESULT) (TPM_BASE + 20))
1393 #define TPM_RESOURCES ((TPM_RESULT) (TPM_BASE + 21))
1394 #define TPM_SHORTRANDOM ((TPM_RESULT) (TPM_BASE + 22))
1395 #define TPM_SIZE ((TPM_RESULT) (TPM_BASE + 23))
1396 #define TPM_WRONGPCRVAL ((TPM_RESULT) (TPM_BASE + 24))
1397 #define TPM_BAD_PARAM_SIZE ((TPM_RESULT) (TPM_BASE + 25))
1398 #define TPM_SHA_THREAD ((TPM_RESULT) (TPM_BASE + 26))
1399 #define TPM_SHA_ERROR ((TPM_RESULT) (TPM_BASE + 27))
1400 #define TPM_FAILEDSELFTEST ((TPM_RESULT) (TPM_BASE + 28))
1401 #define TPM_AUTH2FAIL ((TPM_RESULT) (TPM_BASE + 29))
1402 #define TPM_BADTAG ((TPM_RESULT) (TPM_BASE + 30))
1403 #define TPM_IOERROR ((TPM_RESULT) (TPM_BASE + 31))
1404 #define TPM_ENCRYPT_ERROR ((TPM_RESULT) (TPM_BASE + 32))
1405 #define TPM_DECRYPT_ERROR ((TPM_RESULT) (TPM_BASE + 33))
1406 #define TPM_INVALID_AUTHHANDLE ((TPM_RESULT) (TPM_BASE + 34))
1407 #define TPM_NO_ENDORSEMENT ((TPM_RESULT) (TPM_BASE + 35))
1408 #define TPM_INVALID_KEYUSAGE ((TPM_RESULT) (TPM_BASE + 36))
1409 #define TPM_WRONG_ENTITYTYPE ((TPM_RESULT) (TPM_BASE + 37))
1410 #define TPM_INVALID_POSTINIT ((TPM_RESULT) (TPM_BASE + 38))
1411 #define TPM_INAPPROPRIATE_SIG ((TPM_RESULT) (TPM_BASE + 39))
1412 #define TPM_BAD_KEY_PROPERTY ((TPM_RESULT) (TPM_BASE + 40))
1413 #define TPM_BAD_MIGRATION ((TPM_RESULT) (TPM_BASE + 41))
1414 #define TPM_BAD_SCHEME ((TPM_RESULT) (TPM_BASE + 42))
1415 #define TPM_BAD_DATASIZE ((TPM_RESULT) (TPM_BASE + 43))
1416 #define TPM_BAD_MODE ((TPM_RESULT) (TPM_BASE + 44))
1417 #define TPM_BAD_PRESENCE ((TPM_RESULT) (TPM_BASE + 45))
1418 #define TPM_BAD_VERSION ((TPM_RESULT) (TPM_BASE + 46))
1419 #define TPM_NO_WRAP_TRANSPORT ((TPM_RESULT) (TPM_BASE + 47))
1420 #define TPM_AUDITFAIL_UNSUCCESSFUL ((TPM_RESULT) (TPM_BASE + 48))
1421 #define TPM_AUDITFAIL_SUCCESSFUL ((TPM_RESULT) (TPM_BASE + 49))
1422 #define TPM_NOTRESETABLE ((TPM_RESULT) (TPM_BASE + 50))
1423 #define TPM_NOTLOCAL ((TPM_RESULT) (TPM_BASE + 51))
1424 #define TPM_BAD_TYPE ((TPM_RESULT) (TPM_BASE + 52))
1425 #define TPM_INVALID_RESOURCE ((TPM_RESULT) (TPM_BASE + 53))
1426 #define TPM_NOTFIPS ((TPM_RESULT) (TPM_BASE + 54))
1427 #define TPM_INVALID_FAMILY ((TPM_RESULT) (TPM_BASE + 55))
1428 #define TPM_NO_NV_PERMISSION ((TPM_RESULT) (TPM_BASE + 56))
1429 #define TPM_REQUIRES_SIGN ((TPM_RESULT) (TPM_BASE + 57))
1430 #define TPM_KEY_NOTSUPPORTED ((TPM_RESULT) (TPM_BASE + 58))
1431 #define TPM_AUTH_CONFLICT ((TPM_RESULT) (TPM_BASE + 59))
1432 #define TPM_AREA_LOCKED ((TPM_RESULT) (TPM_BASE + 60))
1433 #define TPM_BAD_LOCALITY ((TPM_RESULT) (TPM_BASE + 61))
1434 #define TPM_READ_ONLY ((TPM_RESULT) (TPM_BASE + 62))
1435 #define TPM_PER_NOWRITE ((TPM_RESULT) (TPM_BASE + 63))
1436 #define TPM_FAMILYCOUNT ((TPM_RESULT) (TPM_BASE + 64))
1437 #define TPM_WRITE_LOCKED ((TPM_RESULT) (TPM_BASE + 65))
1438 #define TPM_BAD_ATTRIBUTES ((TPM_RESULT) (TPM_BASE + 66))
1439 #define TPM_INVALID_STRUCTURE ((TPM_RESULT) (TPM_BASE + 67))
1440 #define TPM_KEY_OWNER_CONTROL ((TPM_RESULT) (TPM_BASE + 68))
1441 #define TPM_BAD_COUNTER ((TPM_RESULT) (TPM_BASE + 69))
1442 #define TPM_NOT_FULLWRITE ((TPM_RESULT) (TPM_BASE + 70))
1443 #define TPM_CONTEXT_GAP ((TPM_RESULT) (TPM_BASE + 71))
1444 #define TPM_MAXNVWRITES ((TPM_RESULT) (TPM_BASE + 72))
1445 #define TPM_NOOPERATOR ((TPM_RESULT) (TPM_BASE + 73))
1446 #define TPM_RESOURCEMISSING ((TPM_RESULT) (TPM_BASE + 74))
1447 #define TPM_DELEGATE_LOCK ((TPM_RESULT) (TPM_BASE + 75))
1448 #define TPM_DELEGATE_FAMILY ((TPM_RESULT) (TPM_BASE + 76))
1449 #define TPM_DELEGATE_ADMIN ((TPM_RESULT) (TPM_BASE + 77))
1450 #define TPM_TRANSPORT_NOTEXCLUSIVE ((TPM_RESULT) (TPM_BASE + 78))
1451 #define TPM_OWNER_CONTROL ((TPM_RESULT) (TPM_BASE + 79))
1452 #define TPM_DAA_RESOURCES ((TPM_RESULT) (TPM_BASE + 80))
1453 #define TPM_DAA_INPUT_DATA0 ((TPM_RESULT) (TPM_BASE + 81))
1454 #define TPM_DAA_INPUT_DATA1 ((TPM_RESULT) (TPM_BASE + 82))
1455 #define TPM_DAA_ISSUER_SETTINGS ((TPM_RESULT) (TPM_BASE + 83))
1456 #define TPM_DAA_TPM_SETTINGS ((TPM_RESULT) (TPM_BASE + 84))
1457 #define TPM_DAA_STAGE ((TPM_RESULT) (TPM_BASE + 85))
1458 #define TPM_DAA_ISSUER_VALIDITY ((TPM_RESULT) (TPM_BASE + 86))
1459 #define TPM_DAA_WRONG_W ((TPM_RESULT) (TPM_BASE + 87))
1460 #define TPM_BAD_HANDLE ((TPM_RESULT) (TPM_BASE + 88))
1461 #define TPM_BAD_DELEGATE ((TPM_RESULT) (TPM_BASE + 89))
1462 #define TPM_BADCONTEXT ((TPM_RESULT) (TPM_BASE + 90))
1463 #define TPM_TOOMANYCONTEXTS ((TPM_RESULT) (TPM_BASE + 91))
1464 #define TPM_MA_TICKET_SIGNATURE ((TPM_RESULT) (TPM_BASE + 92))
1465 #define TPM_MA_DESTINATION ((TPM_RESULT) (TPM_BASE + 93))
1466 #define TPM_MA_SOURCE ((TPM_RESULT) (TPM_BASE + 94))
1467 #define TPM_MA_AUTHORITY ((TPM_RESULT) (TPM_BASE + 95))
1468 #define TPM_PERMANENTEK ((TPM_RESULT) (TPM_BASE + 97))
1469 #define TPM_BAD_SIGNATURE ((TPM_RESULT) (TPM_BASE + 98))
1470 #define TPM_NOCONTEXTSPACE ((TPM_RESULT) (TPM_BASE + 99))
1472 #define TPM_RETRY ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL))
1473 #define TPM_NEEDS_SELFTEST ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL + 1))
1474 #define TPM_DOING_SELFTEST ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL + 2))
1475 #define TPM_DEFEND_LOCK_RUNNING ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL + 3))
1478 // Part 2, section 17: Ordinals
1480 // Ordinals are 32 bit values. The upper byte contains values that serve as
1481 // flag indicators, the next byte contains values indicating what committee
1482 // designated the ordinal, and the final two bytes contain the Command
1485 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
1486 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1487 // |P|C|V| Reserved| Purview | Command Ordinal Index |
1488 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1492 // * P is Protected/Unprotected command. When 0 the command is a Protected
1493 // command, when 1 the command is an Unprotected command.
1495 // * C is Non-Connection/Connection related command. When 0 this command
1496 // passes through to either the protected (TPM) or unprotected (TSS)
1499 // * V is TPM/Vendor command. When 0 the command is TPM defined, when 1 the
1500 // command is vendor defined.
1502 // * All reserved area bits are set to 0.
1505 #define TPM_ORD_ActivateIdentity ((TPM_COMMAND_CODE) 0x0000007A)
1506 #define TPM_ORD_AuthorizeMigrationKey ((TPM_COMMAND_CODE) 0x0000002B)
1507 #define TPM_ORD_CertifyKey ((TPM_COMMAND_CODE) 0x00000032)
1508 #define TPM_ORD_CertifyKey2 ((TPM_COMMAND_CODE) 0x00000033)
1509 #define TPM_ORD_CertifySelfTest ((TPM_COMMAND_CODE) 0x00000052)
1510 #define TPM_ORD_ChangeAuth ((TPM_COMMAND_CODE) 0x0000000C)
1511 #define TPM_ORD_ChangeAuthAsymFinish ((TPM_COMMAND_CODE) 0x0000000F)
1512 #define TPM_ORD_ChangeAuthAsymStart ((TPM_COMMAND_CODE) 0x0000000E)
1513 #define TPM_ORD_ChangeAuthOwner ((TPM_COMMAND_CODE) 0x00000010)
1514 #define TPM_ORD_CMK_ApproveMA ((TPM_COMMAND_CODE) 0x0000001D)
1515 #define TPM_ORD_CMK_ConvertMigration ((TPM_COMMAND_CODE) 0x00000024)
1516 #define TPM_ORD_CMK_CreateBlob ((TPM_COMMAND_CODE) 0x0000001B)
1517 #define TPM_ORD_CMK_CreateKey ((TPM_COMMAND_CODE) 0x00000013)
1518 #define TPM_ORD_CMK_CreateTicket ((TPM_COMMAND_CODE) 0x00000012)
1519 #define TPM_ORD_CMK_SetRestrictions ((TPM_COMMAND_CODE) 0x0000001C)
1520 #define TPM_ORD_ContinueSelfTest ((TPM_COMMAND_CODE) 0x00000053)
1521 #define TPM_ORD_ConvertMigrationBlob ((TPM_COMMAND_CODE) 0x0000002A)
1522 #define TPM_ORD_CreateCounter ((TPM_COMMAND_CODE) 0x000000DC)
1523 #define TPM_ORD_CreateEndorsementKeyPair ((TPM_COMMAND_CODE) 0x00000078)
1524 #define TPM_ORD_CreateMaintenanceArchive ((TPM_COMMAND_CODE) 0x0000002C)
1525 #define TPM_ORD_CreateMigrationBlob ((TPM_COMMAND_CODE) 0x00000028)
1526 #define TPM_ORD_CreateRevocableEK ((TPM_COMMAND_CODE) 0x0000007F)
1527 #define TPM_ORD_CreateWrapKey ((TPM_COMMAND_CODE) 0x0000001F)
1528 #define TPM_ORD_DAA_JOIN ((TPM_COMMAND_CODE) 0x00000029)
1529 #define TPM_ORD_DAA_SIGN ((TPM_COMMAND_CODE) 0x00000031)
1530 #define TPM_ORD_Delegate_CreateKeyDelegation ((TPM_COMMAND_CODE) 0x000000D4)
1531 #define TPM_ORD_Delegate_CreateOwnerDelegation ((TPM_COMMAND_CODE) 0x000000D5)
1532 #define TPM_ORD_Delegate_LoadOwnerDelegation ((TPM_COMMAND_CODE) 0x000000D8)
1533 #define TPM_ORD_Delegate_Manage ((TPM_COMMAND_CODE) 0x000000D2)
1534 #define TPM_ORD_Delegate_ReadTable ((TPM_COMMAND_CODE) 0x000000DB)
1535 #define TPM_ORD_Delegate_UpdateVerification ((TPM_COMMAND_CODE) 0x000000D1)
1536 #define TPM_ORD_Delegate_VerifyDelegation ((TPM_COMMAND_CODE) 0x000000D6)
1537 #define TPM_ORD_DirRead ((TPM_COMMAND_CODE) 0x0000001A)
1538 #define TPM_ORD_DirWriteAuth ((TPM_COMMAND_CODE) 0x00000019)
1539 #define TPM_ORD_DisableForceClear ((TPM_COMMAND_CODE) 0x0000005E)
1540 #define TPM_ORD_DisableOwnerClear ((TPM_COMMAND_CODE) 0x0000005C)
1541 #define TPM_ORD_DisablePubekRead ((TPM_COMMAND_CODE) 0x0000007E)
1542 #define TPM_ORD_DSAP ((TPM_COMMAND_CODE) 0x00000011)
1543 #define TPM_ORD_EstablishTransport ((TPM_COMMAND_CODE) 0x000000E6)
1544 #define TPM_ORD_EvictKey ((TPM_COMMAND_CODE) 0x00000022)
1545 #define TPM_ORD_ExecuteTransport ((TPM_COMMAND_CODE) 0x000000E7)
1546 #define TPM_ORD_Extend ((TPM_COMMAND_CODE) 0x00000014)
1547 #define TPM_ORD_FieldUpgrade ((TPM_COMMAND_CODE) 0x000000AA)
1548 #define TPM_ORD_FlushSpecific ((TPM_COMMAND_CODE) 0x000000BA)
1549 #define TPM_ORD_ForceClear ((TPM_COMMAND_CODE) 0x0000005D)
1550 #define TPM_ORD_GetAuditDigest ((TPM_COMMAND_CODE) 0x00000085)
1551 #define TPM_ORD_GetAuditDigestSigned ((TPM_COMMAND_CODE) 0x00000086)
1552 #define TPM_ORD_GetAuditEvent ((TPM_COMMAND_CODE) 0x00000082)
1553 #define TPM_ORD_GetAuditEventSigned ((TPM_COMMAND_CODE) 0x00000083)
1554 #define TPM_ORD_GetCapability ((TPM_COMMAND_CODE) 0x00000065)
1555 #define TPM_ORD_GetCapabilityOwner ((TPM_COMMAND_CODE) 0x00000066)
1556 #define TPM_ORD_GetCapabilitySigned ((TPM_COMMAND_CODE) 0x00000064)
1557 #define TPM_ORD_GetOrdinalAuditStatus ((TPM_COMMAND_CODE) 0x0000008C)
1558 #define TPM_ORD_GetPubKey ((TPM_COMMAND_CODE) 0x00000021)
1559 #define TPM_ORD_GetRandom ((TPM_COMMAND_CODE) 0x00000046)
1560 #define TPM_ORD_GetTestResult ((TPM_COMMAND_CODE) 0x00000054)
1561 #define TPM_ORD_GetTicks ((TPM_COMMAND_CODE) 0x000000F1)
1562 #define TPM_ORD_IncrementCounter ((TPM_COMMAND_CODE) 0x000000DD)
1563 #define TPM_ORD_Init ((TPM_COMMAND_CODE) 0x00000097)
1564 #define TPM_ORD_KeyControlOwner ((TPM_COMMAND_CODE) 0x00000023)
1565 #define TPM_ORD_KillMaintenanceFeature ((TPM_COMMAND_CODE) 0x0000002E)
1566 #define TPM_ORD_LoadAuthContext ((TPM_COMMAND_CODE) 0x000000B7)
1567 #define TPM_ORD_LoadContext ((TPM_COMMAND_CODE) 0x000000B9)
1568 #define TPM_ORD_LoadKey ((TPM_COMMAND_CODE) 0x00000020)
1569 #define TPM_ORD_LoadKey2 ((TPM_COMMAND_CODE) 0x00000041)
1570 #define TPM_ORD_LoadKeyContext ((TPM_COMMAND_CODE) 0x000000B5)
1571 #define TPM_ORD_LoadMaintenanceArchive ((TPM_COMMAND_CODE) 0x0000002D)
1572 #define TPM_ORD_LoadManuMaintPub ((TPM_COMMAND_CODE) 0x0000002F)
1573 #define TPM_ORD_MakeIdentity ((TPM_COMMAND_CODE) 0x00000079)
1574 #define TPM_ORD_MigrateKey ((TPM_COMMAND_CODE) 0x00000025)
1575 #define TPM_ORD_NV_DefineSpace ((TPM_COMMAND_CODE) 0x000000CC)
1576 #define TPM_ORD_NV_ReadValue ((TPM_COMMAND_CODE) 0x000000CF)
1577 #define TPM_ORD_NV_ReadValueAuth ((TPM_COMMAND_CODE) 0x000000D0)
1578 #define TPM_ORD_NV_WriteValue ((TPM_COMMAND_CODE) 0x000000CD)
1579 #define TPM_ORD_NV_WriteValueAuth ((TPM_COMMAND_CODE) 0x000000CE)
1580 #define TPM_ORD_OIAP ((TPM_COMMAND_CODE) 0x0000000A)
1581 #define TPM_ORD_OSAP ((TPM_COMMAND_CODE) 0x0000000B)
1582 #define TPM_ORD_OwnerClear ((TPM_COMMAND_CODE) 0x0000005B)
1583 #define TPM_ORD_OwnerReadInternalPub ((TPM_COMMAND_CODE) 0x00000081)
1584 #define TPM_ORD_OwnerReadPubek ((TPM_COMMAND_CODE) 0x0000007D)
1585 #define TPM_ORD_OwnerSetDisable ((TPM_COMMAND_CODE) 0x0000006E)
1586 #define TPM_ORD_PCR_Reset ((TPM_COMMAND_CODE) 0x000000C8)
1587 #define TPM_ORD_PcrRead ((TPM_COMMAND_CODE) 0x00000015)
1588 #define TPM_ORD_PhysicalDisable ((TPM_COMMAND_CODE) 0x00000070)
1589 #define TPM_ORD_PhysicalEnable ((TPM_COMMAND_CODE) 0x0000006F)
1590 #define TPM_ORD_PhysicalSetDeactivated ((TPM_COMMAND_CODE) 0x00000072)
1591 #define TPM_ORD_Quote ((TPM_COMMAND_CODE) 0x00000016)
1592 #define TPM_ORD_Quote2 ((TPM_COMMAND_CODE) 0x0000003E)
1593 #define TPM_ORD_ReadCounter ((TPM_COMMAND_CODE) 0x000000DE)
1594 #define TPM_ORD_ReadManuMaintPub ((TPM_COMMAND_CODE) 0x00000030)
1595 #define TPM_ORD_ReadPubek ((TPM_COMMAND_CODE) 0x0000007C)
1596 #define TPM_ORD_ReleaseCounter ((TPM_COMMAND_CODE) 0x000000DF)
1597 #define TPM_ORD_ReleaseCounterOwner ((TPM_COMMAND_CODE) 0x000000E0)
1598 #define TPM_ORD_ReleaseTransportSigned ((TPM_COMMAND_CODE) 0x000000E8)
1599 #define TPM_ORD_Reset ((TPM_COMMAND_CODE) 0x0000005A)
1600 #define TPM_ORD_ResetLockValue ((TPM_COMMAND_CODE) 0x00000040)
1601 #define TPM_ORD_RevokeTrust ((TPM_COMMAND_CODE) 0x00000080)
1602 #define TPM_ORD_SaveAuthContext ((TPM_COMMAND_CODE) 0x000000B6)
1603 #define TPM_ORD_SaveContext ((TPM_COMMAND_CODE) 0x000000B8)
1604 #define TPM_ORD_SaveKeyContext ((TPM_COMMAND_CODE) 0x000000B4)
1605 #define TPM_ORD_SaveState ((TPM_COMMAND_CODE) 0x00000098)
1606 #define TPM_ORD_Seal ((TPM_COMMAND_CODE) 0x00000017)
1607 #define TPM_ORD_Sealx ((TPM_COMMAND_CODE) 0x0000003D)
1608 #define TPM_ORD_SelfTestFull ((TPM_COMMAND_CODE) 0x00000050)
1609 #define TPM_ORD_SetCapability ((TPM_COMMAND_CODE) 0x0000003F)
1610 #define TPM_ORD_SetOperatorAuth ((TPM_COMMAND_CODE) 0x00000074)
1611 #define TPM_ORD_SetOrdinalAuditStatus ((TPM_COMMAND_CODE) 0x0000008D)
1612 #define TPM_ORD_SetOwnerInstall ((TPM_COMMAND_CODE) 0x00000071)
1613 #define TPM_ORD_SetOwnerPointer ((TPM_COMMAND_CODE) 0x00000075)
1614 #define TPM_ORD_SetRedirection ((TPM_COMMAND_CODE) 0x0000009A)
1615 #define TPM_ORD_SetTempDeactivated ((TPM_COMMAND_CODE) 0x00000073)
1616 #define TPM_ORD_SHA1Complete ((TPM_COMMAND_CODE) 0x000000A2)
1617 #define TPM_ORD_SHA1CompleteExtend ((TPM_COMMAND_CODE) 0x000000A3)
1618 #define TPM_ORD_SHA1Start ((TPM_COMMAND_CODE) 0x000000A0)
1619 #define TPM_ORD_SHA1Update ((TPM_COMMAND_CODE) 0x000000A1)
1620 #define TPM_ORD_Sign ((TPM_COMMAND_CODE) 0x0000003C)
1621 #define TPM_ORD_Startup ((TPM_COMMAND_CODE) 0x00000099)
1622 #define TPM_ORD_StirRandom ((TPM_COMMAND_CODE) 0x00000047)
1623 #define TPM_ORD_TakeOwnership ((TPM_COMMAND_CODE) 0x0000000D)
1624 #define TPM_ORD_Terminate_Handle ((TPM_COMMAND_CODE) 0x00000096)
1625 #define TPM_ORD_TickStampBlob ((TPM_COMMAND_CODE) 0x000000F2)
1626 #define TPM_ORD_UnBind ((TPM_COMMAND_CODE) 0x0000001E)
1627 #define TPM_ORD_Unseal ((TPM_COMMAND_CODE) 0x00000018)
1628 #define TSC_ORD_PhysicalPresence ((TPM_COMMAND_CODE) 0x4000000A)
1629 #define TSC_ORD_ResetEstablishmentBit ((TPM_COMMAND_CODE) 0x4000000B)
1632 // Part 2, section 18: Context structures
1636 /// Part 2, section 18.1: TPM_CONTEXT_BLOB
1638 typedef struct tdTPM_CONTEXT_BLOB
{
1639 TPM_STRUCTURE_TAG tag
;
1640 TPM_RESOURCE_TYPE resourceType
;
1643 UINT32 contextCount
;
1644 TPM_DIGEST integrityDigest
;
1645 UINT32 additionalSize
;
1646 UINT8
*additionalData
;
1647 UINT32 sensitiveSize
;
1648 UINT8
*sensitiveData
;
1652 /// Part 2, section 18.2 TPM_CONTEXT_SENSITIVE
1654 typedef struct tdTPM_CONTEXT_SENSITIVE
{
1655 TPM_STRUCTURE_TAG tag
;
1656 TPM_NONCE contextNonce
;
1657 UINT32 internalSize
;
1658 UINT8
*internalData
;
1659 } TPM_CONTEXT_SENSITIVE
;
1662 // Part 2, section 19: NV Structures
1666 // Part 2, section 19.1.1: Required TPM_NV_INDEX values
1668 #define TPM_NV_INDEX_LOCK ((UINT32)0xffffffff)
1669 #define TPM_NV_INDEX0 ((UINT32)0x00000000)
1670 #define TPM_NV_INDEX_DIR ((UINT32)0x10000001)
1671 #define TPM_NV_INDEX_EKCert ((UINT32)0x0000f000)
1672 #define TPM_NV_INDEX_TPM_CC ((UINT32)0x0000f001)
1673 #define TPM_NV_INDEX_PlatformCert ((UINT32)0x0000f002)
1674 #define TPM_NV_INDEX_Platform_CC ((UINT32)0x0000f003)
1676 // Part 2, section 19.1.2: Reserved Index values
1678 #define TPM_NV_INDEX_TSS_BASE ((UINT32)0x00011100)
1679 #define TPM_NV_INDEX_PC_BASE ((UINT32)0x00011200)
1680 #define TPM_NV_INDEX_SERVER_BASE ((UINT32)0x00011300)
1681 #define TPM_NV_INDEX_MOBILE_BASE ((UINT32)0x00011400)
1682 #define TPM_NV_INDEX_PERIPHERAL_BASE ((UINT32)0x00011500)
1683 #define TPM_NV_INDEX_GROUP_RESV_BASE ((UINT32)0x00010000)
1686 /// Part 2, section 19.2: TPM_NV_ATTRIBUTES
1688 typedef struct tdTPM_NV_ATTRIBUTES
{
1689 TPM_STRUCTURE_TAG tag
;
1691 } TPM_NV_ATTRIBUTES
;
1693 #define TPM_NV_PER_READ_STCLEAR (BIT31)
1694 #define TPM_NV_PER_AUTHREAD (BIT18)
1695 #define TPM_NV_PER_OWNERREAD (BIT17)
1696 #define TPM_NV_PER_PPREAD (BIT16)
1697 #define TPM_NV_PER_GLOBALLOCK (BIT15)
1698 #define TPM_NV_PER_WRITE_STCLEAR (BIT14)
1699 #define TPM_NV_PER_WRITEDEFINE (BIT13)
1700 #define TPM_NV_PER_WRITEALL (BIT12)
1701 #define TPM_NV_PER_AUTHWRITE (BIT2)
1702 #define TPM_NV_PER_OWNERWRITE (BIT1)
1703 #define TPM_NV_PER_PPWRITE (BIT0)
1706 /// Part 2, section 19.3: TPM_NV_DATA_PUBLIC
1708 typedef struct tdTPM_NV_DATA_PUBLIC
{
1709 TPM_STRUCTURE_TAG tag
;
1710 TPM_NV_INDEX nvIndex
;
1711 TPM_PCR_INFO_SHORT pcrInfoRead
;
1712 TPM_PCR_INFO_SHORT pcrInfoWrite
;
1713 TPM_NV_ATTRIBUTES permission
;
1714 BOOLEAN bReadSTClear
;
1715 BOOLEAN bWriteSTClear
;
1716 BOOLEAN bWriteDefine
;
1718 } TPM_NV_DATA_PUBLIC
;
1721 // Part 2, section 20: Delegate Structures
1724 #define TPM_DEL_OWNER_BITS ((UINT32)0x00000001)
1725 #define TPM_DEL_KEY_BITS ((UINT32)0x00000002)
1727 /// Part 2, section 20.2: Delegate Definitions
1729 typedef struct tdTPM_DELEGATIONS
{
1730 TPM_STRUCTURE_TAG tag
;
1731 UINT32 delegateType
;
1737 // Part 2, section 20.2.1: Owner Permission Settings
1739 #define TPM_DELEGATE_SetOrdinalAuditStatus (BIT30)
1740 #define TPM_DELEGATE_DirWriteAuth (BIT29)
1741 #define TPM_DELEGATE_CMK_ApproveMA (BIT28)
1742 #define TPM_DELEGATE_NV_WriteValue (BIT27)
1743 #define TPM_DELEGATE_CMK_CreateTicket (BIT26)
1744 #define TPM_DELEGATE_NV_ReadValue (BIT25)
1745 #define TPM_DELEGATE_Delegate_LoadOwnerDelegation (BIT24)
1746 #define TPM_DELEGATE_DAA_Join (BIT23)
1747 #define TPM_DELEGATE_AuthorizeMigrationKey (BIT22)
1748 #define TPM_DELEGATE_CreateMaintenanceArchive (BIT21)
1749 #define TPM_DELEGATE_LoadMaintenanceArchive (BIT20)
1750 #define TPM_DELEGATE_KillMaintenanceFeature (BIT19)
1751 #define TPM_DELEGATE_OwnerReadInteralPub (BIT18)
1752 #define TPM_DELEGATE_ResetLockValue (BIT17)
1753 #define TPM_DELEGATE_OwnerClear (BIT16)
1754 #define TPM_DELEGATE_DisableOwnerClear (BIT15)
1755 #define TPM_DELEGATE_NV_DefineSpace (BIT14)
1756 #define TPM_DELEGATE_OwnerSetDisable (BIT13)
1757 #define TPM_DELEGATE_SetCapability (BIT12)
1758 #define TPM_DELEGATE_MakeIdentity (BIT11)
1759 #define TPM_DELEGATE_ActivateIdentity (BIT10)
1760 #define TPM_DELEGATE_OwnerReadPubek (BIT9)
1761 #define TPM_DELEGATE_DisablePubekRead (BIT8)
1762 #define TPM_DELEGATE_SetRedirection (BIT7)
1763 #define TPM_DELEGATE_FieldUpgrade (BIT6)
1764 #define TPM_DELEGATE_Delegate_UpdateVerification (BIT5)
1765 #define TPM_DELEGATE_CreateCounter (BIT4)
1766 #define TPM_DELEGATE_ReleaseCounterOwner (BIT3)
1767 #define TPM_DELEGATE_DelegateManage (BIT2)
1768 #define TPM_DELEGATE_Delegate_CreateOwnerDelegation (BIT1)
1769 #define TPM_DELEGATE_DAA_Sign (BIT0)
1772 // Part 2, section 20.2.3: Key Permission settings
1774 #define TPM_KEY_DELEGATE_CMK_ConvertMigration (BIT28)
1775 #define TPM_KEY_DELEGATE_TickStampBlob (BIT27)
1776 #define TPM_KEY_DELEGATE_ChangeAuthAsymStart (BIT26)
1777 #define TPM_KEY_DELEGATE_ChangeAuthAsymFinish (BIT25)
1778 #define TPM_KEY_DELEGATE_CMK_CreateKey (BIT24)
1779 #define TPM_KEY_DELEGATE_MigrateKey (BIT23)
1780 #define TPM_KEY_DELEGATE_LoadKey2 (BIT22)
1781 #define TPM_KEY_DELEGATE_EstablishTransport (BIT21)
1782 #define TPM_KEY_DELEGATE_ReleaseTransportSigned (BIT20)
1783 #define TPM_KEY_DELEGATE_Quote2 (BIT19)
1784 #define TPM_KEY_DELEGATE_Sealx (BIT18)
1785 #define TPM_KEY_DELEGATE_MakeIdentity (BIT17)
1786 #define TPM_KEY_DELEGATE_ActivateIdentity (BIT16)
1787 #define TPM_KEY_DELEGATE_GetAuditDigestSigned (BIT15)
1788 #define TPM_KEY_DELEGATE_Sign (BIT14)
1789 #define TPM_KEY_DELEGATE_CertifyKey2 (BIT13)
1790 #define TPM_KEY_DELEGATE_CertifyKey (BIT12)
1791 #define TPM_KEY_DELEGATE_CreateWrapKey (BIT11)
1792 #define TPM_KEY_DELEGATE_CMK_CreateBlob (BIT10)
1793 #define TPM_KEY_DELEGATE_CreateMigrationBlob (BIT9)
1794 #define TPM_KEY_DELEGATE_ConvertMigrationBlob (BIT8)
1795 #define TPM_KEY_DELEGATE_CreateKeyDelegation (BIT7)
1796 #define TPM_KEY_DELEGATE_ChangeAuth (BIT6)
1797 #define TPM_KEY_DELEGATE_GetPubKey (BIT5)
1798 #define TPM_KEY_DELEGATE_UnBind (BIT4)
1799 #define TPM_KEY_DELEGATE_Quote (BIT3)
1800 #define TPM_KEY_DELEGATE_Unseal (BIT2)
1801 #define TPM_KEY_DELEGATE_Seal (BIT1)
1802 #define TPM_KEY_DELEGATE_LoadKey (BIT0)
1805 // Part 2, section 20.3: TPM_FAMILY_FLAGS
1807 #define TPM_DELEGATE_ADMIN_LOCK (BIT1)
1808 #define TPM_FAMFLAG_ENABLE (BIT0)
1811 /// Part 2, section 20.4: TPM_FAMILY_LABEL
1813 typedef struct tdTPM_FAMILY_LABEL
{
1818 /// Part 2, section 20.5: TPM_FAMILY_TABLE_ENTRY
1820 typedef struct tdTPM_FAMILY_TABLE_ENTRY
{
1821 TPM_STRUCTURE_TAG tag
;
1822 TPM_FAMILY_LABEL label
;
1823 TPM_FAMILY_ID familyID
;
1824 TPM_FAMILY_VERIFICATION verificationCount
;
1825 TPM_FAMILY_FLAGS flags
;
1826 } TPM_FAMILY_TABLE_ENTRY
;
1829 // Part 2, section 20.6: TPM_FAMILY_TABLE
1831 #define TPM_NUM_FAMILY_TABLE_ENTRY_MIN 8
1833 typedef struct tdTPM_FAMILY_TABLE
{
1834 TPM_FAMILY_TABLE_ENTRY famTableRow
[TPM_NUM_FAMILY_TABLE_ENTRY_MIN
];
1838 /// Part 2, section 20.7: TPM_DELEGATE_LABEL
1840 typedef struct tdTPM_DELEGATE_LABEL
{
1842 } TPM_DELEGATE_LABEL
;
1845 /// Part 2, section 20.8: TPM_DELEGATE_PUBLIC
1847 typedef struct tdTPM_DELEGATE_PUBLIC
{
1848 TPM_STRUCTURE_TAG tag
;
1849 TPM_DELEGATE_LABEL label
;
1850 TPM_PCR_INFO_SHORT pcrInfo
;
1851 TPM_DELEGATIONS permissions
;
1852 TPM_FAMILY_ID familyID
;
1853 TPM_FAMILY_VERIFICATION verificationCount
;
1854 } TPM_DELEGATE_PUBLIC
;
1857 /// Part 2, section 20.9: TPM_DELEGATE_TABLE_ROW
1859 typedef struct tdTPM_DELEGATE_TABLE_ROW
{
1860 TPM_STRUCTURE_TAG tag
;
1861 TPM_DELEGATE_PUBLIC pub
;
1862 TPM_SECRET authValue
;
1863 } TPM_DELEGATE_TABLE_ROW
;
1866 // Part 2, section 20.10: TPM_DELEGATE_TABLE
1868 #define TPM_NUM_DELEGATE_TABLE_ENTRY_MIN 2
1870 typedef struct tdTPM_DELEGATE_TABLE
{
1871 TPM_DELEGATE_TABLE_ROW delRow
[TPM_NUM_DELEGATE_TABLE_ENTRY_MIN
];
1872 } TPM_DELEGATE_TABLE
;
1875 /// Part 2, section 20.11: TPM_DELEGATE_SENSITIVE
1877 typedef struct tdTPM_DELEGATE_SENSITIVE
{
1878 TPM_STRUCTURE_TAG tag
;
1879 TPM_SECRET authValue
;
1880 } TPM_DELEGATE_SENSITIVE
;
1883 /// Part 2, section 20.12: TPM_DELEGATE_OWNER_BLOB
1885 typedef struct tdTPM_DELEGATE_OWNER_BLOB
{
1886 TPM_STRUCTURE_TAG tag
;
1887 TPM_DELEGATE_PUBLIC pub
;
1888 TPM_DIGEST integrityDigest
;
1889 UINT32 additionalSize
;
1890 UINT8
*additionalArea
;
1891 UINT32 sensitiveSize
;
1892 UINT8
*sensitiveArea
;
1893 } TPM_DELEGATE_OWNER_BLOB
;
1896 /// Part 2, section 20.13: TTPM_DELEGATE_KEY_BLOB
1898 typedef struct tdTPM_DELEGATE_KEY_BLOB
{
1899 TPM_STRUCTURE_TAG tag
;
1900 TPM_DELEGATE_PUBLIC pub
;
1901 TPM_DIGEST integrityDigest
;
1902 TPM_DIGEST pubKeyDigest
;
1903 UINT32 additionalSize
;
1904 UINT8
*additionalArea
;
1905 UINT32 sensitiveSize
;
1906 UINT8
*sensitiveArea
;
1907 } TPM_DELEGATE_KEY_BLOB
;
1910 // Part 2, section 20.14: TPM_FAMILY_OPERATION Values
1912 #define TPM_FAMILY_CREATE ((UINT32)0x00000001)
1913 #define TPM_FAMILY_ENABLE ((UINT32)0x00000002)
1914 #define TPM_FAMILY_ADMIN ((UINT32)0x00000003)
1915 #define TPM_FAMILY_INVALIDATE ((UINT32)0x00000004)
1918 // Part 2, section 21.1: TPM_CAPABILITY_AREA for GetCapability
1920 #define TPM_CAP_ORD ((TPM_CAPABILITY_AREA) 0x00000001)
1921 #define TPM_CAP_ALG ((TPM_CAPABILITY_AREA) 0x00000002)
1922 #define TPM_CAP_PID ((TPM_CAPABILITY_AREA) 0x00000003)
1923 #define TPM_CAP_FLAG ((TPM_CAPABILITY_AREA) 0x00000004)
1924 #define TPM_CAP_PROPERTY ((TPM_CAPABILITY_AREA) 0x00000005)
1925 #define TPM_CAP_VERSION ((TPM_CAPABILITY_AREA) 0x00000006)
1926 #define TPM_CAP_KEY_HANDLE ((TPM_CAPABILITY_AREA) 0x00000007)
1927 #define TPM_CAP_CHECK_LOADED ((TPM_CAPABILITY_AREA) 0x00000008)
1928 #define TPM_CAP_SYM_MODE ((TPM_CAPABILITY_AREA) 0x00000009)
1929 #define TPM_CAP_KEY_STATUS ((TPM_CAPABILITY_AREA) 0x0000000C)
1930 #define TPM_CAP_NV_LIST ((TPM_CAPABILITY_AREA) 0x0000000D)
1931 #define TPM_CAP_MFR ((TPM_CAPABILITY_AREA) 0x00000010)
1932 #define TPM_CAP_NV_INDEX ((TPM_CAPABILITY_AREA) 0x00000011)
1933 #define TPM_CAP_TRANS_ALG ((TPM_CAPABILITY_AREA) 0x00000012)
1934 #define TPM_CAP_HANDLE ((TPM_CAPABILITY_AREA) 0x00000014)
1935 #define TPM_CAP_TRANS_ES ((TPM_CAPABILITY_AREA) 0x00000015)
1936 #define TPM_CAP_AUTH_ENCRYPT ((TPM_CAPABILITY_AREA) 0x00000017)
1937 #define TPM_CAP_SELECT_SIZE ((TPM_CAPABILITY_AREA) 0x00000018)
1938 #define TPM_CAP_VERSION_VAL ((TPM_CAPABILITY_AREA) 0x0000001A)
1940 #define TPM_CAP_FLAG_PERMANENT ((TPM_CAPABILITY_AREA) 0x00000108)
1941 #define TPM_CAP_FLAG_VOLATILE ((TPM_CAPABILITY_AREA) 0x00000109)
1944 // Part 2, section 21.2: CAP_PROPERTY Subcap values for GetCapability
1946 #define TPM_CAP_PROP_PCR ((TPM_CAPABILITY_AREA) 0x00000101)
1947 #define TPM_CAP_PROP_DIR ((TPM_CAPABILITY_AREA) 0x00000102)
1948 #define TPM_CAP_PROP_MANUFACTURER ((TPM_CAPABILITY_AREA) 0x00000103)
1949 #define TPM_CAP_PROP_KEYS ((TPM_CAPABILITY_AREA) 0x00000104)
1950 #define TPM_CAP_PROP_MIN_COUNTER ((TPM_CAPABILITY_AREA) 0x00000107)
1951 #define TPM_CAP_PROP_AUTHSESS ((TPM_CAPABILITY_AREA) 0x0000010A)
1952 #define TPM_CAP_PROP_TRANSESS ((TPM_CAPABILITY_AREA) 0x0000010B)
1953 #define TPM_CAP_PROP_COUNTERS ((TPM_CAPABILITY_AREA) 0x0000010C)
1954 #define TPM_CAP_PROP_MAX_AUTHSESS ((TPM_CAPABILITY_AREA) 0x0000010D)
1955 #define TPM_CAP_PROP_MAX_TRANSESS ((TPM_CAPABILITY_AREA) 0x0000010E)
1956 #define TPM_CAP_PROP_MAX_COUNTERS ((TPM_CAPABILITY_AREA) 0x0000010F)
1957 #define TPM_CAP_PROP_MAX_KEYS ((TPM_CAPABILITY_AREA) 0x00000110)
1958 #define TPM_CAP_PROP_OWNER ((TPM_CAPABILITY_AREA) 0x00000111)
1959 #define TPM_CAP_PROP_CONTEXT ((TPM_CAPABILITY_AREA) 0x00000112)
1960 #define TPM_CAP_PROP_MAX_CONTEXT ((TPM_CAPABILITY_AREA) 0x00000113)
1961 #define TPM_CAP_PROP_FAMILYROWS ((TPM_CAPABILITY_AREA) 0x00000114)
1962 #define TPM_CAP_PROP_TIS_TIMEOUT ((TPM_CAPABILITY_AREA) 0x00000115)
1963 #define TPM_CAP_PROP_STARTUP_EFFECT ((TPM_CAPABILITY_AREA) 0x00000116)
1964 #define TPM_CAP_PROP_DELEGATE_ROW ((TPM_CAPABILITY_AREA) 0x00000117)
1965 #define TPM_CAP_PROP_DAA_MAX ((TPM_CAPABILITY_AREA) 0x00000119)
1966 #define CAP_PROP_SESSION_DAA ((TPM_CAPABILITY_AREA) 0x0000011A)
1967 #define TPM_CAP_PROP_CONTEXT_DIST ((TPM_CAPABILITY_AREA) 0x0000011B)
1968 #define TPM_CAP_PROP_DAA_INTERRUPT ((TPM_CAPABILITY_AREA) 0x0000011C)
1969 #define TPM_CAP_PROP_SESSIONS ((TPM_CAPABILITY_AREA) 0x0000011D)
1970 #define TPM_CAP_PROP_MAX_SESSIONS ((TPM_CAPABILITY_AREA) 0x0000011E)
1971 #define TPM_CAP_PROP_CMK_RESTRICTION ((TPM_CAPABILITY_AREA) 0x0000011F)
1972 #define TPM_CAP_PROP_DURATION ((TPM_CAPABILITY_AREA) 0x00000120)
1973 #define TPM_CAP_PROP_ACTIVE_COUNTER ((TPM_CAPABILITY_AREA) 0x00000122)
1974 #define TPM_CAP_PROP_MAX_NV_AVAILABLE ((TPM_CAPABILITY_AREA) 0x00000123)
1975 #define TPM_CAP_PROP_INPUT_BUFFER ((TPM_CAPABILITY_AREA) 0x00000124)
1978 // Part 2, section 21.4: TPM_CAPABILITY_AREA for SetCapability
1980 #define TPM_SET_PERM_FLAGS ((TPM_CAPABILITY_AREA) 0x00000001)
1981 #define TPM_SET_PERM_DATA ((TPM_CAPABILITY_AREA) 0x00000002)
1982 #define TPM_SET_STCLEAR_FLAGS ((TPM_CAPABILITY_AREA) 0x00000003)
1983 #define TPM_SET_STCLEAR_DATA ((TPM_CAPABILITY_AREA) 0x00000004)
1984 #define TPM_SET_STANY_FLAGS ((TPM_CAPABILITY_AREA) 0x00000005)
1985 #define TPM_SET_STANY_DATA ((TPM_CAPABILITY_AREA) 0x00000006)
1988 /// Part 2, section 21.6: TPM_CAP_VERSION_INFO
1989 /// [size_is(vendorSpecificSize)] BYTE* vendorSpecific;
1991 typedef struct tdTPM_CAP_VERSION_INFO
{
1992 TPM_STRUCTURE_TAG tag
;
1993 TPM_VERSION version
;
1996 UINT8 tpmVendorID
[4];
1997 UINT16 vendorSpecificSize
;
1998 UINT8
*vendorSpecific
;
1999 } TPM_CAP_VERSION_INFO
;
2002 /// Part 2, section 21.10: TPM_DA_ACTION_TYPE
2004 typedef struct tdTPM_DA_ACTION_TYPE
{
2005 TPM_STRUCTURE_TAG tag
;
2007 } TPM_DA_ACTION_TYPE
;
2009 #define TPM_DA_ACTION_FAILURE_MODE (((UINT32)1)<<3)
2010 #define TPM_DA_ACTION_DEACTIVATE (((UINT32)1)<<2)
2011 #define TPM_DA_ACTION_DISABLE (((UINT32)1)<<1)
2012 #define TPM_DA_ACTION_TIMEOUT (((UINT32)1)<<0)
2015 /// Part 2, section 21.7: TPM_DA_INFO
2017 typedef struct tdTPM_DA_INFO
{
2018 TPM_STRUCTURE_TAG tag
;
2020 UINT16 currentCount
;
2021 UINT16 thresholdCount
;
2022 TPM_DA_ACTION_TYPE actionAtThreshold
;
2023 UINT32 actionDependValue
;
2024 UINT32 vendorDataSize
;
2029 /// Part 2, section 21.8: TPM_DA_INFO_LIMITED
2031 typedef struct tdTPM_DA_INFO_LIMITED
{
2032 TPM_STRUCTURE_TAG tag
;
2034 TPM_DA_ACTION_TYPE actionAtThreshold
;
2035 UINT32 vendorDataSize
;
2037 } TPM_DA_INFO_LIMITED
;
2040 // Part 2, section 21.9: CAP_PROPERTY Subcap values for GetCapability
2042 #define TPM_DA_STATE_INACTIVE ((UINT8)0x00)
2043 #define TPM_DA_STATE_ACTIVE ((UINT8)0x01)
2046 // Part 2, section 22: DAA Structures
2050 // Part 2, section 22.1: Size definitions
2052 #define TPM_DAA_SIZE_r0 (43)
2053 #define TPM_DAA_SIZE_r1 (43)
2054 #define TPM_DAA_SIZE_r2 (128)
2055 #define TPM_DAA_SIZE_r3 (168)
2056 #define TPM_DAA_SIZE_r4 (219)
2057 #define TPM_DAA_SIZE_NT (20)
2058 #define TPM_DAA_SIZE_v0 (128)
2059 #define TPM_DAA_SIZE_v1 (192)
2060 #define TPM_DAA_SIZE_NE (256)
2061 #define TPM_DAA_SIZE_w (256)
2062 #define TPM_DAA_SIZE_issuerModulus (256)
2064 // Part 2, section 22.2: Constant definitions
2066 #define TPM_DAA_power0 (104)
2067 #define TPM_DAA_power1 (1024)
2070 /// Part 2, section 22.3: TPM_DAA_ISSUER
2072 typedef struct tdTPM_DAA_ISSUER
{
2073 TPM_STRUCTURE_TAG tag
;
2074 TPM_DIGEST DAA_digest_R0
;
2075 TPM_DIGEST DAA_digest_R1
;
2076 TPM_DIGEST DAA_digest_S0
;
2077 TPM_DIGEST DAA_digest_S1
;
2078 TPM_DIGEST DAA_digest_n
;
2079 TPM_DIGEST DAA_digest_gamma
;
2080 UINT8 DAA_generic_q
[26];
2084 /// Part 2, section 22.4: TPM_DAA_TPM
2086 typedef struct tdTPM_DAA_TPM
{
2087 TPM_STRUCTURE_TAG tag
;
2088 TPM_DIGEST DAA_digestIssuer
;
2089 TPM_DIGEST DAA_digest_v0
;
2090 TPM_DIGEST DAA_digest_v1
;
2091 TPM_DIGEST DAA_rekey
;
2096 /// Part 2, section 22.5: TPM_DAA_CONTEXT
2098 typedef struct tdTPM_DAA_CONTEXT
{
2099 TPM_STRUCTURE_TAG tag
;
2100 TPM_DIGEST DAA_digestContext
;
2101 TPM_DIGEST DAA_digest
;
2102 TPM_DAA_CONTEXT_SEED DAA_contextSeed
;
2103 UINT8 DAA_scratch
[256];
2108 /// Part 2, section 22.6: TPM_DAA_JOINDATA
2110 typedef struct tdTPM_DAA_JOINDATA
{
2111 UINT8 DAA_join_u0
[128];
2112 UINT8 DAA_join_u1
[138];
2113 TPM_DIGEST DAA_digest_n0
;
2117 /// Part 2, section 22.8: TPM_DAA_BLOB
2119 typedef struct tdTPM_DAA_BLOB
{
2120 TPM_STRUCTURE_TAG tag
;
2121 TPM_RESOURCE_TYPE resourceType
;
2123 TPM_DIGEST blobIntegrity
;
2124 UINT32 additionalSize
;
2125 UINT8
*additionalData
;
2126 UINT32 sensitiveSize
;
2127 UINT8
*sensitiveData
;
2131 /// Part 2, section 22.9: TPM_DAA_SENSITIVE
2133 typedef struct tdTPM_DAA_SENSITIVE
{
2134 TPM_STRUCTURE_TAG tag
;
2135 UINT32 internalSize
;
2136 UINT8
*internalData
;
2137 } TPM_DAA_SENSITIVE
;
2141 // Part 2, section 23: Redirection
2145 /// Part 2 section 23.1: TPM_REDIR_COMMAND
2146 /// This section defines exactly one value but does not
2147 /// give it a name. The definition of TPM_SetRedirection in Part3
2148 /// refers to exactly one name but does not give its value. We join
2151 #define TPM_REDIR_GPIO (0x00000001)
2154 /// TPM Command Headers defined in Part 3
2156 typedef struct tdTPM_RQU_COMMAND_HDR
{
2157 TPM_STRUCTURE_TAG tag
;
2159 TPM_COMMAND_CODE ordinal
;
2160 } TPM_RQU_COMMAND_HDR
;
2163 /// TPM Response Headers defined in Part 3
2165 typedef struct tdTPM_RSP_COMMAND_HDR
{
2166 TPM_STRUCTURE_TAG tag
;
2168 TPM_RESULT returnCode
;
2169 } TPM_RSP_COMMAND_HDR
;