]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/IndustryStandard/Tpm12.h
update codes per MdePkg doxgen review comments.
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Tpm12.h
1 /** @file
2 TPM Specification data structures (TCG TPM Specification Version 1.2 Revision 94)
3 See http://trustedcomputinggroup.org for latest specification updates
4
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. 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
10
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.
13 **/
14
15
16 #ifndef _TPM12_H_
17 #define _TPM12_H_
18
19 ///
20 /// The start of TPM return codes
21 ///
22 #define TPM_BASE (MAX_BIT + (MAX_BIT >> 1))
23
24 //
25 // All structures MUST be packed on a byte boundary.
26 //
27
28 #pragma pack (1)
29
30 //
31 // Part 2, section 2.2.3: Helper redefinitions
32 //
33 ///
34 /// Indicates the conditions where it is required that authorization be presented
35 ///
36 typedef UINT8 TPM_AUTH_DATA_USAGE;
37 ///
38 /// The information as to what the payload is in an encrypted structure
39 ///
40 typedef UINT8 TPM_PAYLOAD_TYPE;
41 ///
42 /// The version info breakdown
43 ///
44 typedef UINT8 TPM_VERSION_BYTE;
45 ///
46 /// The request or response authorization type
47 ///
48 typedef UINT16 TPM_TAG;
49 ///
50 /// The protocol in use
51 ///
52 typedef UINT16 TPM_PROTOCOL_ID;
53 ///
54 /// Indicates the start state
55 ///
56 typedef UINT16 TPM_STARTUP_TYPE;
57 ///
58 /// The definition of the encryption scheme
59 ///
60 typedef UINT16 TPM_ENC_SCHEME;
61 ///
62 /// The definition of the signature scheme
63 ///
64 typedef UINT16 TPM_SIG_SCHEME;
65 ///
66 /// The definition of the migration scheme
67 ///
68 typedef UINT16 TPM_MIGRATE_SCHEME;
69 ///
70 /// Sets the state of the physical presence mechanism
71 ///
72 typedef UINT16 TPM_PHYSICAL_PRESENCE;
73 ///
74 /// Indicates the types of entity that are supported by the TPM
75 ///
76 typedef UINT16 TPM_ENTITY_TYPE;
77 ///
78 /// Indicates the permitted usage of the key
79 ///
80 typedef UINT16 TPM_KEY_USAGE;
81 ///
82 /// The type of asymmetric encrypted structure in use by the endorsement key
83 ///
84 typedef UINT16 TPM_EK_TYPE;
85 ///
86 /// The tag for the structure
87 ///
88 typedef UINT16 TPM_STRUCTURE_TAG;
89 ///
90 /// The platform specific spec to which the information relates to
91 ///
92 typedef UINT16 TPM_PLATFORM_SPECIFIC;
93 ///
94 /// The command ordinal
95 ///
96 typedef UINT32 TPM_COMMAND_CODE;
97 ///
98 /// Identifies a TPM capability area
99 ///
100 typedef UINT32 TPM_CAPABILITY_AREA;
101 ///
102 /// Indicates information regarding a key
103 ///
104 typedef UINT32 TPM_KEY_FLAGS;
105 ///
106 /// Indicates the type of algorithm
107 ///
108 typedef UINT32 TPM_ALGORITHM_ID;
109 ///
110 /// The locality modifier
111 ///
112 typedef UINT32 TPM_MODIFIER_INDICATOR;
113 ///
114 /// The actual number of a counter
115 ///
116 typedef UINT32 TPM_ACTUAL_COUNT;
117 ///
118 /// Attributes that define what options are in use for a transport session
119 ///
120 typedef UINT32 TPM_TRANSPORT_ATTRIBUTES;
121 ///
122 /// Handle to an authorization session
123 ///
124 typedef UINT32 TPM_AUTHHANDLE;
125 ///
126 /// Index to a DIR register
127 ///
128 typedef UINT32 TPM_DIRINDEX;
129 ///
130 /// The area where a key is held assigned by the TPM
131 ///
132 typedef UINT32 TPM_KEY_HANDLE;
133 ///
134 /// Index to a PCR register
135 ///
136 typedef UINT32 TPM_PCRINDEX;
137 ///
138 /// The return code from a function
139 ///
140 typedef UINT32 TPM_RESULT;
141 ///
142 /// The types of resources that a TPM may have using internal resources
143 ///
144 typedef UINT32 TPM_RESOURCE_TYPE;
145 ///
146 /// Allows for controlling of the key when loaded and how to handle TPM_Startup issues
147 ///
148 typedef UINT32 TPM_KEY_CONTROL;
149 ///
150 /// The index into the NV storage area
151 ///
152 typedef UINT32 TPM_NV_INDEX;
153 ///
154 /// The family ID. Family IDs are automatically assigned a sequence number by the TPM.
155 /// A trusted process can set the FamilyID value in an individual row to NULL, which
156 /// invalidates that row. The family ID resets to NULL on each change of TPM Owner.
157 ///
158 typedef UINT32 TPM_FAMILY_ID;
159 ///
160 /// IA value used as a label for the most recent verification of this family. Set to zero when not in use.
161 ///
162 typedef UINT32 TPM_FAMILY_VERIFICATION;
163 ///
164 /// How the TPM handles var
165 ///
166 typedef UINT32 TPM_STARTUP_EFFECTS;
167 ///
168 /// The mode of a symmetric encryption
169 ///
170 typedef UINT32 TPM_SYM_MODE;
171 ///
172 /// The family flags
173 ///
174 typedef UINT32 TPM_FAMILY_FLAGS;
175 ///
176 /// The index value for the delegate NV table
177 ///
178 typedef UINT32 TPM_DELEGATE_INDEX;
179 ///
180 /// The restrictions placed on delegation of CMK commands
181 ///
182 typedef UINT32 TPM_CMK_DELEGATE;
183 ///
184 /// The ID value of a monotonic counter
185 ///
186 typedef UINT32 TPM_COUNT_ID;
187 ///
188 /// A command to execute
189 ///
190 typedef UINT32 TPM_REDIT_COMMAND;
191 ///
192 /// A transport session handle
193 ///
194 typedef UINT32 TPM_TRANSHANDLE;
195 ///
196 /// A generic handle could be key, transport etc
197 ///
198 typedef UINT32 TPM_HANDLE;
199 ///
200 /// What operation is happening
201 ///
202 typedef UINT32 TPM_FAMILY_OPERATION;
203
204 //
205 // Part 2, section 2.2.4: Vendor specific
206 // The following defines allow for the quick specification of a
207 // vendor specific item.
208 //
209 #define TPM_Vendor_Specific32 ((UINT32) 0x00000400)
210 #define TPM_Vendor_Specific8 ((UINT8) 0x80)
211
212 //
213 // Part 2, section 3.1: TPM_STRUCTURE_TAG
214 //
215 #define TPM_TAG_CONTEXTBLOB ((TPM_STRUCTURE_TAG) 0x0001)
216 #define TPM_TAG_CONTEXT_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0002)
217 #define TPM_TAG_CONTEXTPOINTER ((TPM_STRUCTURE_TAG) 0x0003)
218 #define TPM_TAG_CONTEXTLIST ((TPM_STRUCTURE_TAG) 0x0004)
219 #define TPM_TAG_SIGNINFO ((TPM_STRUCTURE_TAG) 0x0005)
220 #define TPM_TAG_PCR_INFO_LONG ((TPM_STRUCTURE_TAG) 0x0006)
221 #define TPM_TAG_PERSISTENT_FLAGS ((TPM_STRUCTURE_TAG) 0x0007)
222 #define TPM_TAG_VOLATILE_FLAGS ((TPM_STRUCTURE_TAG) 0x0008)
223 #define TPM_TAG_PERSISTENT_DATA ((TPM_STRUCTURE_TAG) 0x0009)
224 #define TPM_TAG_VOLATILE_DATA ((TPM_STRUCTURE_TAG) 0x000A)
225 #define TPM_TAG_SV_DATA ((TPM_STRUCTURE_TAG) 0x000B)
226 #define TPM_TAG_EK_BLOB ((TPM_STRUCTURE_TAG) 0x000C)
227 #define TPM_TAG_EK_BLOB_AUTH ((TPM_STRUCTURE_TAG) 0x000D)
228 #define TPM_TAG_COUNTER_VALUE ((TPM_STRUCTURE_TAG) 0x000E)
229 #define TPM_TAG_TRANSPORT_INTERNAL ((TPM_STRUCTURE_TAG) 0x000F)
230 #define TPM_TAG_TRANSPORT_LOG_IN ((TPM_STRUCTURE_TAG) 0x0010)
231 #define TPM_TAG_TRANSPORT_LOG_OUT ((TPM_STRUCTURE_TAG) 0x0011)
232 #define TPM_TAG_AUDIT_EVENT_IN ((TPM_STRUCTURE_TAG) 0x0012)
233 #define TPM_TAG_AUDIT_EVENT_OUT ((TPM_STRUCTURE_TAG) 0x0013)
234 #define TPM_TAG_CURRENT_TICKS ((TPM_STRUCTURE_TAG) 0x0014)
235 #define TPM_TAG_KEY ((TPM_STRUCTURE_TAG) 0x0015)
236 #define TPM_TAG_STORED_DATA12 ((TPM_STRUCTURE_TAG) 0x0016)
237 #define TPM_TAG_NV_ATTRIBUTES ((TPM_STRUCTURE_TAG) 0x0017)
238 #define TPM_TAG_NV_DATA_PUBLIC ((TPM_STRUCTURE_TAG) 0x0018)
239 #define TPM_TAG_NV_DATA_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0019)
240 #define TPM_TAG_DELEGATIONS ((TPM_STRUCTURE_TAG) 0x001A)
241 #define TPM_TAG_DELEGATE_PUBLIC ((TPM_STRUCTURE_TAG) 0x001B)
242 #define TPM_TAG_DELEGATE_TABLE_ROW ((TPM_STRUCTURE_TAG) 0x001C)
243 #define TPM_TAG_TRANSPORT_AUTH ((TPM_STRUCTURE_TAG) 0x001D)
244 #define TPM_TAG_TRANSPORT_PUBLIC ((TPM_STRUCTURE_TAG) 0x001E)
245 #define TPM_TAG_PERMANENT_FLAGS ((TPM_STRUCTURE_TAG) 0x001F)
246 #define TPM_TAG_STCLEAR_FLAGS ((TPM_STRUCTURE_TAG) 0x0020)
247 #define TPM_TAG_STANY_FLAGS ((TPM_STRUCTURE_TAG) 0x0021)
248 #define TPM_TAG_PERMANENT_DATA ((TPM_STRUCTURE_TAG) 0x0022)
249 #define TPM_TAG_STCLEAR_DATA ((TPM_STRUCTURE_TAG) 0x0023)
250 #define TPM_TAG_STANY_DATA ((TPM_STRUCTURE_TAG) 0x0024)
251 #define TPM_TAG_FAMILY_TABLE_ENTRY ((TPM_STRUCTURE_TAG) 0x0025)
252 #define TPM_TAG_DELEGATE_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0026)
253 #define TPM_TAG_DELG_KEY_BLOB ((TPM_STRUCTURE_TAG) 0x0027)
254 #define TPM_TAG_KEY12 ((TPM_STRUCTURE_TAG) 0x0028)
255 #define TPM_TAG_CERTIFY_INFO2 ((TPM_STRUCTURE_TAG) 0x0029)
256 #define TPM_TAG_DELEGATE_OWNER_BLOB ((TPM_STRUCTURE_TAG) 0x002A)
257 #define TPM_TAG_EK_BLOB_ACTIVATE ((TPM_STRUCTURE_TAG) 0x002B)
258 #define TPM_TAG_DAA_BLOB ((TPM_STRUCTURE_TAG) 0x002C)
259 #define TPM_TAG_DAA_CONTEXT ((TPM_STRUCTURE_TAG) 0x002D)
260 #define TPM_TAG_DAA_ENFORCE ((TPM_STRUCTURE_TAG) 0x002E)
261 #define TPM_TAG_DAA_ISSUER ((TPM_STRUCTURE_TAG) 0x002F)
262 #define TPM_TAG_CAP_VERSION_INFO ((TPM_STRUCTURE_TAG) 0x0030)
263 #define TPM_TAG_DAA_SENSITIVE ((TPM_STRUCTURE_TAG) 0x0031)
264 #define TPM_TAG_DAA_TPM ((TPM_STRUCTURE_TAG) 0x0032)
265 #define TPM_TAG_CMK_MIGAUTH ((TPM_STRUCTURE_TAG) 0x0033)
266 #define TPM_TAG_CMK_SIGTICKET ((TPM_STRUCTURE_TAG) 0x0034)
267 #define TPM_TAG_CMK_MA_APPROVAL ((TPM_STRUCTURE_TAG) 0x0035)
268 #define TPM_TAG_QUOTE_INFO2 ((TPM_STRUCTURE_TAG) 0x0036)
269
270 //
271 // Part 2, section 4: TPM Types
272 //
273
274 //
275 // Part 2, section 4.1: TPM_RESOURCE_TYPE
276 //
277 #define TPM_RT_KEY ((TPM_RESOURCE_TYPE) 0x00000001) ///< The handle is a key handle and is the result of a LoadKey type operation
278 #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
279 #define TPM_RT_HASH ((TPM_RESOURCE_TYPE) 0x00000003) ///< Reserved for hashes
280 #define TPM_RT_TRANS ((TPM_RESOURCE_TYPE) 0x00000004) ///< The handle is for a transport session. Transport handles come from TPM_EstablishTransport
281 #define TPM_RT_CONTEXT ((TPM_RESOURCE_TYPE) 0x00000005) ///< Resource wrapped and held outside the TPM using the context save/restore commands
282 #define TPM_RT_COUNTER ((TPM_RESOURCE_TYPE) 0x00000006) ///< Reserved for counters
283 #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
284 #define TPM_RT_DAA_TPM ((TPM_RESOURCE_TYPE) 0x00000008) ///< The value is a DAA TPM specific blob
285 #define TPM_RT_DAA_V0 ((TPM_RESOURCE_TYPE) 0x00000009) ///< The value is a DAA V0 parameter
286 #define TPM_RT_DAA_V1 ((TPM_RESOURCE_TYPE) 0x0000000A) ///< The value is a DAA V1 parameter
287
288 //
289 // Part 2, section 4.2: TPM_PAYLOAD_TYPE
290 //
291 #define TPM_PT_ASYM ((TPM_PAYLOAD_TYPE) 0x01) ///< The entity is an asymmetric key
292 #define TPM_PT_BIND ((TPM_PAYLOAD_TYPE) 0x02) ///< The entity is bound data
293 #define TPM_PT_MIGRATE ((TPM_PAYLOAD_TYPE) 0x03) ///< The entity is a migration blob
294 #define TPM_PT_MAINT ((TPM_PAYLOAD_TYPE) 0x04) ///< The entity is a maintenance blob
295 #define TPM_PT_SEAL ((TPM_PAYLOAD_TYPE) 0x05) ///< The entity is sealed data
296 #define TPM_PT_MIGRATE_RESTRICTED ((TPM_PAYLOAD_TYPE) 0x06) ///< The entity is a restricted-migration asymmetric key
297 #define TPM_PT_MIGRATE_EXTERNAL ((TPM_PAYLOAD_TYPE) 0x07) ///< The entity is a external migratable key
298 #define TPM_PT_CMK_MIGRATE ((TPM_PAYLOAD_TYPE) 0x08) ///< The entity is a CMK migratable blob
299 #define TPM_PT_VENDOR_SPECIFIC ((TPM_PAYLOAD_TYPE) 0x80) ///< 0x80 - 0xFF Vendor specific payloads
300
301 //
302 // Part 2, section 4.3: TPM_ENTITY_TYPE
303 //
304 #define TPM_ET_KEYHANDLE ((UINT16) 0x0001) ///< The entity is a keyHandle or key
305 #define TPM_ET_OWNER ((UINT16) 0x0002) ///< The entity is the TPM Owner
306 #define TPM_ET_DATA ((UINT16) 0x0003) ///< The entity is some data
307 #define TPM_ET_SRK ((UINT16) 0x0004) ///< The entity is the SRK
308 #define TPM_ET_KEY ((UINT16) 0x0005) ///< The entity is a key or keyHandle
309 #define TPM_ET_REVOKE ((UINT16) 0x0006) ///< The entity is the RevokeTrust value
310 #define TPM_ET_DEL_OWNER_BLOB ((UINT16) 0x0007) ///< The entity is a delegate owner blob
311 #define TPM_ET_DEL_ROW ((UINT16) 0x0008) ///< The entity is a delegate row
312 #define TPM_ET_DEL_KEY_BLOB ((UINT16) 0x0009) ///< The entity is a delegate key blob
313 #define TPM_ET_COUNTER ((UINT16) 0x000A) ///< The entity is a counter
314 #define TPM_ET_NV ((UINT16) 0x000B) ///< The entity is a NV index
315 #define TPM_ET_RESERVED_HANDLE ((UINT16) 0x0040) ///< Reserved. This value avoids collisions with the handle MSB setting.
316 //
317 // TPM_ENTITY_TYPE MSB Values: The MSB is used to indicate the ADIP encryption sheme when applicable
318 //
319 #define TPM_ET_XOR ((UINT16) 0x0000) ///< ADIP encryption scheme: XOR
320 #define TPM_ET_AES128 ((UINT16) 0x0006) ///< ADIP encryption scheme: AES 128 bits
321
322 //
323 // Part 2, section 4.4.1: Reserved Key Handles
324 //
325 #define TPM_KH_SRK ((TPM_KEY_HANDLE) 0x40000000) ///< The handle points to the SRK
326 #define TPM_KH_OWNER ((TPM_KEY_HANDLE) 0x40000001) ///< The handle points to the TPM Owner
327 #define TPM_KH_REVOKE ((TPM_KEY_HANDLE) 0x40000002) ///< The handle points to the RevokeTrust value
328 #define TPM_KH_TRANSPORT ((TPM_KEY_HANDLE) 0x40000003) ///< The handle points to the EstablishTransport static authorization
329 #define TPM_KH_OPERATOR ((TPM_KEY_HANDLE) 0x40000004) ///< The handle points to the Operator auth
330 #define TPM_KH_ADMIN ((TPM_KEY_HANDLE) 0x40000005) ///< The handle points to the delegation administration auth
331 #define TPM_KH_EK ((TPM_KEY_HANDLE) 0x40000006) ///< The handle points to the PUBEK, only usable with TPM_OwnerReadInternalPub
332
333 //
334 // Part 2, section 4.5: TPM_STARTUP_TYPE
335 //
336 #define TPM_ST_CLEAR ((TPM_STARTUP_TYPE) 0x0001) ///< The TPM is starting up from a clean state
337 #define TPM_ST_STATE ((TPM_STARTUP_TYPE) 0x0002) ///< The TPM is starting up from a saved state
338 #define TPM_ST_DEACTIVATED ((TPM_STARTUP_TYPE) 0x0003) ///< The TPM is to startup and set the deactivated flag to TRUE
339
340 //
341 // Part 2, section 4.6: TPM_STATUP_EFFECTS
342 // The table makeup is still an open issue.
343 //
344
345 //
346 // Part 2, section 4.7: TPM_PROTOCOL_ID
347 //
348 #define TPM_PID_OIAP ((TPM_PROTOCOL_ID) 0x0001) ///< The OIAP protocol.
349 #define TPM_PID_OSAP ((TPM_PROTOCOL_ID) 0x0002) ///< The OSAP protocol.
350 #define TPM_PID_ADIP ((TPM_PROTOCOL_ID) 0x0003) ///< The ADIP protocol.
351 #define TPM_PID_ADCP ((TPM_PROTOCOL_ID) 0x0004) ///< The ADCP protocol.
352 #define TPM_PID_OWNER ((TPM_PROTOCOL_ID) 0x0005) ///< The protocol for taking ownership of a TPM.
353 #define TPM_PID_DSAP ((TPM_PROTOCOL_ID) 0x0006) ///< The DSAP protocol
354 #define TPM_PID_TRANSPORT ((TPM_PROTOCOL_ID) 0x0007) ///< The transport protocol
355
356 //
357 // Part 2, section 4.8: TPM_ALGORITHM_ID
358 // The TPM MUST support the algorithms TPM_ALG_RSA, TPM_ALG_SHA, TPM_ALG_HMAC,
359 // TPM_ALG_MGF1
360 //
361 #define TPM_ALG_RSA ((TPM_ALGORITHM_ID) 0x00000001) ///< The RSA algorithm.
362 #define TPM_ALG_DES ((TPM_ALGORITHM_ID) 0x00000002) ///< The DES algorithm
363 #define TPM_ALG_3DES ((TPM_ALGORITHM_ID) 0x00000003) ///< The 3DES algorithm in EDE mode
364 #define TPM_ALG_SHA ((TPM_ALGORITHM_ID) 0x00000004) ///< The SHA1 algorithm
365 #define TPM_ALG_HMAC ((TPM_ALGORITHM_ID) 0x00000005) ///< The RFC 2104 HMAC algorithm
366 #define TPM_ALG_AES128 ((TPM_ALGORITHM_ID) 0x00000006) ///< The AES algorithm, key size 128
367 #define TPM_ALG_MGF1 ((TPM_ALGORITHM_ID) 0x00000007) ///< The XOR algorithm using MGF1 to create a string the size of the encrypted block
368 #define TPM_ALG_AES192 ((TPM_ALGORITHM_ID) 0x00000008) ///< AES, key size 192
369 #define TPM_ALG_AES256 ((TPM_ALGORITHM_ID) 0x00000009) ///< AES, key size 256
370 #define TPM_ALG_XOR ((TPM_ALGORITHM_ID) 0x0000000A) ///< XOR using the rolling nonces
371
372 //
373 // Part 2, section 4.9: TPM_PHYSICAL_PRESENCE
374 //
375 #define TPM_PHYSICAL_PRESENCE_HW_DISABLE ((TPM_PHYSICAL_PRESENCE) 0x0200) ///< Sets the physicalPresenceHWEnable to FALSE
376 #define TPM_PHYSICAL_PRESENCE_CMD_DISABLE ((TPM_PHYSICAL_PRESENCE) 0x0100) ///< Sets the physicalPresenceCMDEnable to FALSE
377 #define TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK ((TPM_PHYSICAL_PRESENCE) 0x0080) ///< Sets the physicalPresenceLifetimeLock to TRUE
378 #define TPM_PHYSICAL_PRESENCE_HW_ENABLE ((TPM_PHYSICAL_PRESENCE) 0x0040) ///< Sets the physicalPresenceHWEnable to TRUE
379 #define TPM_PHYSICAL_PRESENCE_CMD_ENABLE ((TPM_PHYSICAL_PRESENCE) 0x0020) ///< Sets the physicalPresenceCMDEnable to TRUE
380 #define TPM_PHYSICAL_PRESENCE_NOTPRESENT ((TPM_PHYSICAL_PRESENCE) 0x0010) ///< Sets PhysicalPresence = FALSE
381 #define TPM_PHYSICAL_PRESENCE_PRESENT ((TPM_PHYSICAL_PRESENCE) 0x0008) ///< Sets PhysicalPresence = TRUE
382 #define TPM_PHYSICAL_PRESENCE_LOCK ((TPM_PHYSICAL_PRESENCE) 0x0004) ///< Sets PhysicalPresenceLock = TRUE
383
384 //
385 // Part 2, section 4.10: TPM_MIGRATE_SCHEME
386 //
387 #define TPM_MS_MIGRATE ((TPM_MIGRATE_SCHEME) 0x0001) ///< A public key that can be used with all TPM migration commands other than 'ReWrap' mode.
388 #define TPM_MS_REWRAP ((TPM_MIGRATE_SCHEME) 0x0002) ///< A public key that can be used for the ReWrap mode of TPM_CreateMigrationBlob.
389 #define TPM_MS_MAINT ((TPM_MIGRATE_SCHEME) 0x0003) ///< A public key that can be used for the Maintenance commands
390 #define TPM_MS_RESTRICT_MIGRATE ((TPM_MIGRATE_SCHEME) 0x0004) ///< The key is to be migrated to a Migration Authority.
391 #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
392
393 //
394 // Part 2, section 4.11: TPM_EK_TYPE
395 //
396 #define TPM_EK_TYPE_ACTIVATE ((TPM_EK_TYPE) 0x0001) ///< The blob MUST be TPM_EK_BLOB_ACTIVATE
397 #define TPM_EK_TYPE_AUTH ((TPM_EK_TYPE) 0x0002) ///< The blob MUST be TPM_EK_BLOB_AUTH
398
399 //
400 // Part 2, section 4.12: TPM_PLATFORM_SPECIFIC
401 //
402 #define TPM_PS_PC_11 ((TPM_PLATFORM_SPECIFIC) 0x0001) ///< PC Specific version 1.1
403 #define TPM_PS_PC_12 ((TPM_PLATFORM_SPECIFIC) 0x0002) ///< PC Specific version 1.2
404 #define TPM_PS_PDA_12 ((TPM_PLATFORM_SPECIFIC) 0x0003) ///< PDA Specific version 1.2
405 #define TPM_PS_Server_12 ((TPM_PLATFORM_SPECIFIC) 0x0004) ///< Server Specific version 1.2
406 #define TPM_PS_Mobile_12 ((TPM_PLATFORM_SPECIFIC) 0x0005) ///< Mobil Specific version 1.2
407
408 //
409 // Part 2, section 5: Basic Structures
410 //
411
412 ///
413 /// Part 2, section 5.1: TPM_STRUCT_VER
414 ///
415 typedef struct tdTPM_STRUCT_VER {
416 UINT8 major;
417 UINT8 minor;
418 UINT8 revMajor;
419 UINT8 revMinor;
420 } TPM_STRUCT_VER;
421
422 ///
423 /// Part 2, section 5.3: TPM_VERSION
424 ///
425 typedef struct tdTPM_VERSION {
426 TPM_VERSION_BYTE major;
427 TPM_VERSION_BYTE minor;
428 UINT8 revMajor;
429 UINT8 revMinor;
430 } TPM_VERSION;
431
432
433 #define TPM_SHA1_160_HASH_LEN 0x14
434 #define TPM_SHA1BASED_NONCE_LEN TPM_SHA1_160_HASH_LEN
435
436 ///
437 /// Part 2, section 5.4: TPM_DIGEST
438 ///
439 typedef struct tdTPM_DIGEST{
440 UINT8 digest[TPM_SHA1_160_HASH_LEN];
441 } TPM_DIGEST;
442
443 ///
444 /// This SHALL be the digest of the chosen identityLabel and privacyCA for a new TPM identity
445 ///
446 typedef TPM_DIGEST TPM_CHOSENID_HASH;
447 ///
448 /// This SHALL be the hash of a list of PCR indexes and PCR values that a key or data is bound to
449 ///
450 typedef TPM_DIGEST TPM_COMPOSITE_HASH;
451 ///
452 /// This SHALL be the value of a DIR register
453 ///
454 typedef TPM_DIGEST TPM_DIRVALUE;
455
456 typedef TPM_DIGEST TPM_HMAC;
457 ///
458 /// The value inside of the PCR
459 ///
460 typedef TPM_DIGEST TPM_PCRVALUE;
461 ///
462 /// This SHALL be the value of the current internal audit state
463 ///
464 typedef TPM_DIGEST TPM_AUDITDIGEST;
465 ///
466 /// This SHALL be a random value generated by a TPM immediately after the EK is installed
467 /// in that TPM, whenever an EK is installed in that TPM
468 ///
469 typedef TPM_DIGEST TPM_DAA_TPM_SEED;
470 ///
471 /// This SHALL be a random value
472 ///
473 typedef TPM_DIGEST TPM_DAA_CONTEXT_SEED;
474
475 ///
476 /// Part 2, section 5.5: TPM_NONCE
477 ///
478 typedef struct tdTPM_NONCE{
479 UINT8 nonce[20];
480 } TPM_NONCE;
481
482 //
483 // Part 2, section 5.6: TPM_AUTHDATA
484 //
485 ///
486 /// The AuthData data is the information that is saved or passed to provide proof of ownership
487 /// 296 of an entity
488 ///
489 typedef UINT8 tdTPM_AUTHDATA[20];
490
491 typedef tdTPM_AUTHDATA TPM_AUTHDATA;
492 ///
493 /// A secret plaintext value used in the authorization process
494 ///
495 typedef TPM_AUTHDATA TPM_SECRET;
496 ///
497 /// A ciphertext (encrypted) version of AuthData data. The encryption mechanism depends on the context
498 ///
499 typedef TPM_AUTHDATA TPM_ENCAUTH;
500
501 ///
502 /// Part 2, section 5.7: TPM_KEY_HANDLE_LIST
503 /// Size of handle is loaded * sizeof(TPM_KEY_HANDLE)
504 ///
505 typedef struct tdTPM_KEY_HANDLE_LIST {
506 UINT16 loaded;
507 TPM_KEY_HANDLE handle[1];
508 } TPM_KEY_HANDLE_LIST;
509
510 //
511 // Part 2, section 5.8: TPM_KEY_USAGE values
512 //
513 ///
514 /// TPM_KEY_SIGNING SHALL indicate a signing key. The [private] key SHALL be
515 /// used for signing operations, only. This means that it MUST be a leaf of the
516 /// Protected Storage key hierarchy.
517 ///
518 #define TPM_KEY_SIGNING ((UINT16) 0x0010)
519 ///
520 /// TPM_KEY_STORAGE SHALL indicate a storage key. The key SHALL be used to wrap
521 /// and unwrap other keys in the Protected Storage hierarchy
522 ///
523 #define TPM_KEY_STORAGE ((UINT16) 0x0011)
524 ///
525 /// TPM_KEY_IDENTITY SHALL indicate an identity key. The key SHALL be used for
526 /// operations that require a TPM identity, only.
527 ///
528 #define TPM_KEY_IDENTITY ((UINT16) 0x0012)
529 ///
530 /// TPM_KEY_AUTHCHANGE SHALL indicate an ephemeral key that is in use during
531 /// the ChangeAuthAsym process, only.
532 ///
533 #define TPM_KEY_AUTHCHANGE ((UINT16) 0x0013)
534 ///
535 /// TPM_KEY_BIND SHALL indicate a key that can be used for TPM_Bind and
536 /// TPM_Unbind operations only.
537 ///
538 #define TPM_KEY_BIND ((UINT16) 0x0014)
539 ///
540 /// TPM_KEY_LEGACY SHALL indicate a key that can perform signing and binding
541 /// operations. The key MAY be used for both signing and binding operations.
542 /// The TPM_KEY_LEGACY key type is to allow for use by applications where both
543 /// signing and encryption operations occur with the same key. The use of this
544 /// key type is not recommended TPM_KEY_MIGRATE 0x0016 This SHALL indicate a
545 /// key in use for TPM_MigrateKey
546 ///
547 #define TPM_KEY_LEGACY ((UINT16) 0x0015)
548 ///
549 /// TPM_KEY_MIGRAGE SHALL indicate a key in use for TPM_MigrateKey
550 ///
551 #define TPM_KEY_MIGRATE ((UINT16) 0x0016)
552
553 //
554 // Part 2, section 5.8.1: Mandatory Key Usage Schemes
555 //
556
557 #define TPM_ES_NONE ((TPM_ENC_SCHEME) 0x0001)
558 #define TPM_ES_RSAESPKCSv15 ((TPM_ENC_SCHEME) 0x0002)
559 #define TPM_ES_RSAESOAEP_SHA1_MGF1 ((TPM_ENC_SCHEME) 0x0003)
560 #define TPM_ES_SYM_CNT ((TPM_ENC_SCHEME) 0x0004)
561 #define TPM_ES_SYM_OFB ((TPM_ENC_SCHEME) 0x0005)
562
563 #define TPM_SS_NONE ((TPM_SIG_SCHEME) 0x0001)
564 #define TPM_SS_RSASSAPKCS1v15_SHA1 ((TPM_SIG_SCHEME) 0x0002)
565 #define TPM_SS_RSASSAPKCS1v15_DER ((TPM_SIG_SCHEME) 0x0003)
566 #define TPM_SS_RSASSAPKCS1v15_INFO ((TPM_SIG_SCHEME) 0x0004)
567
568 //
569 // Part 2, section 5.9: TPM_AUTH_DATA_USAGE values
570 //
571 #define TPM_AUTH_NEVER ((TPM_AUTH_DATA_USAGE) 0x00)
572 #define TPM_AUTH_ALWAYS ((TPM_AUTH_DATA_USAGE) 0x01)
573 #define TPM_AUTH_PRIV_USE_ONLY ((TPM_AUTH_DATA_USAGE) 0x03)
574
575 ///
576 /// Part 2, section 5.10: TPM_KEY_FLAGS
577 ///
578 typedef enum tdTPM_KEY_FLAGS {
579 redirection = 0x00000001,
580 migratable = 0x00000002,
581 isVolatile = 0x00000004,
582 pcrIgnoredOnRead = 0x00000008,
583 migrateAuthority = 0x00000010
584 } TPM_KEY_FLAGS_BITS;
585
586 ///
587 /// Part 2, section 5.11: TPM_CHANGEAUTH_VALIDATE
588 ///
589 typedef struct tdTPM_CHANGEAUTH_VALIDATE {
590 TPM_SECRET newAuthSecret;
591 TPM_NONCE n1;
592 } TPM_CHANGEAUTH_VALIDATE;
593
594 ///
595 /// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH
596 /// decalared after section 10 to catch declaration of TPM_PUBKEY
597 ///
598 /// Part 2 section 10.1: TPM_KEY_PARMS
599 /// [size_is(parmSize)] BYTE* parms;
600 ///
601 typedef struct tdTPM_KEY_PARMS {
602 TPM_ALGORITHM_ID algorithmID;
603 TPM_ENC_SCHEME encScheme;
604 TPM_SIG_SCHEME sigScheme;
605 UINT32 parmSize;
606 UINT8 *parms;
607 } TPM_KEY_PARMS;
608
609 ///
610 /// Part 2, section 10.4: TPM_STORE_PUBKEY
611 ///
612 typedef struct tdTPM_STORE_PUBKEY {
613 UINT32 keyLength;
614 UINT8 key[1];
615 } TPM_STORE_PUBKEY;
616
617 ///
618 /// Part 2, section 10.5: TPM_PUBKEY
619 ///
620 typedef struct tdTPM_PUBKEY{
621 TPM_KEY_PARMS algorithmParms;
622 TPM_STORE_PUBKEY pubKey;
623 } TPM_PUBKEY;
624
625 ///
626 /// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH
627 ///
628 typedef struct tdTPM_MIGRATIONKEYAUTH{
629 TPM_PUBKEY migrationKey;
630 TPM_MIGRATE_SCHEME migrationScheme;
631 TPM_DIGEST digest;
632 } TPM_MIGRATIONKEYAUTH;
633
634 ///
635 /// Part 2, section 5.13: TPM_COUNTER_VALUE
636 ///
637 typedef struct tdTPM_COUNTER_VALUE{
638 TPM_STRUCTURE_TAG tag;
639 UINT8 label[4];
640 TPM_ACTUAL_COUNT counter;
641 } TPM_COUNTER_VALUE;
642
643 ///
644 /// Part 2, section 5.14: TPM_SIGN_INFO
645 /// Size of data indicated by dataLen
646 ///
647 typedef struct tdTPM_SIGN_INFO {
648 TPM_STRUCTURE_TAG tag;
649 UINT8 fixed[4];
650 TPM_NONCE replay;
651 UINT32 dataLen;
652 UINT8 *data;
653 } TPM_SIGN_INFO;
654
655 ///
656 /// Part 2, section 5.15: TPM_MSA_COMPOSITE
657 /// Number of migAuthDigest indicated by MSAlist
658 ///
659 typedef struct tdTPM_MSA_COMPOSITE {
660 UINT32 MSAlist;
661 TPM_DIGEST migAuthDigest[1];
662 } TPM_MSA_COMPOSITE;
663
664 ///
665 /// Part 2, section 5.16: TPM_CMK_AUTH
666 ///
667 typedef struct tdTPM_CMK_AUTH{
668 TPM_DIGEST migrationAuthorityDigest;
669 TPM_DIGEST destinationKeyDigest;
670 TPM_DIGEST sourceKeyDigest;
671 } TPM_CMK_AUTH;
672
673 //
674 // Part 2, section 5.17: TPM_CMK_DELEGATE
675 //
676 #define TPM_CMK_DELEGATE_SIGNING ((TPM_CMK_DELEGATE) BIT31)
677 #define TPM_CMK_DELEGATE_STORAGE ((TPM_CMK_DELEGATE) BIT30)
678 #define TPM_CMK_DELEGATE_BIND ((TPM_CMK_DELEGATE) BIT29)
679 #define TPM_CMK_DELEGATE_LEGACY ((TPM_CMK_DELEGATE) BIT28)
680 #define TPM_CMK_DELEGATE_MIGRATE ((TPM_CMK_DELEGATE) BIT27)
681
682 ///
683 /// Part 2, section 5.18: TPM_SELECT_SIZE
684 ///
685 typedef struct tdTPM_SELECT_SIZE {
686 UINT8 major;
687 UINT8 minor;
688 UINT16 reqSize;
689 } TPM_SELECT_SIZE;
690
691 ///
692 /// Part 2, section 5,19: TPM_CMK_MIGAUTH
693 ///
694 typedef struct tdTPM_CMK_MIGAUTH{
695 TPM_STRUCTURE_TAG tag;
696 TPM_DIGEST msaDigest;
697 TPM_DIGEST pubKeyDigest;
698 } TPM_CMK_MIGAUTH;
699
700 ///
701 /// Part 2, section 5.20: TPM_CMK_SIGTICKET
702 ///
703 typedef struct tdTPM_CMK_SIGTICKET{
704 TPM_STRUCTURE_TAG tag;
705 TPM_DIGEST verKeyDigest;
706 TPM_DIGEST signedData;
707 } TPM_CMK_SIGTICKET;
708
709 ///
710 /// Part 2, section 5.21: TPM_CMK_MA_APPROVAL
711 ///
712 typedef struct tdTPM_CMK_MA_APPROVAL{
713 TPM_STRUCTURE_TAG tag;
714 TPM_DIGEST migrationAuthorityDigest;
715 } TPM_CMK_MA_APPROVAL;
716
717 //
718 // Part 2, section 6: Command Tags
719 //
720 #define TPM_TAG_RQU_COMMAND ((TPM_STRUCTURE_TAG) 0x00C1)
721 #define TPM_TAG_RQU_AUTH1_COMMAND ((TPM_STRUCTURE_TAG) 0x00C2)
722 #define TPM_TAG_RQU_AUTH2_COMMAND ((TPM_STRUCTURE_TAG) 0x00C3)
723 #define TPM_TAG_RSP_COMMAND ((TPM_STRUCTURE_TAG) 0x00C4)
724 #define TPM_TAG_RSP_AUTH1_COMMAND ((TPM_STRUCTURE_TAG) 0x00C5)
725 #define TPM_TAG_RSP_AUTH2_COMMAND ((TPM_STRUCTURE_TAG) 0x00C6)
726
727 ///
728 /// Part 2, section 7.1: TPM_PERMANENT_FLAGS
729 ///
730 typedef struct tdTPM_PERMANENT_FLAGS{
731 TPM_STRUCTURE_TAG tag;
732 BOOLEAN disable;
733 BOOLEAN ownership;
734 BOOLEAN deactivated;
735 BOOLEAN readPubek;
736 BOOLEAN disableOwnerClear;
737 BOOLEAN allowMaintenance;
738 BOOLEAN physicalPresenceLifetimeLock;
739 BOOLEAN physicalPresenceHWEnable;
740 BOOLEAN physicalPresenceCMDEnable;
741 BOOLEAN CEKPUsed;
742 BOOLEAN TPMpost;
743 BOOLEAN TPMpostLock;
744 BOOLEAN FIPS;
745 BOOLEAN operator;
746 BOOLEAN enableRevokeEK;
747 BOOLEAN nvLocked;
748 BOOLEAN readSRKPub;
749 BOOLEAN tpmEstablished;
750 BOOLEAN maintenanceDone;
751 } TPM_PERMANENT_FLAGS;
752
753 //
754 // Part 2, section 7.1.1: Flag Restrictions (of TPM_PERMANENT_FLAGS)
755 //
756 #define TPM_PF_DISABLE ((TPM_CAPABILITY_AREA) 1)
757 #define TPM_PF_OWNERSHIP ((TPM_CAPABILITY_AREA) 2)
758 #define TPM_PF_DEACTIVATED ((TPM_CAPABILITY_AREA) 3)
759 #define TPM_PF_READPUBEK ((TPM_CAPABILITY_AREA) 4)
760 #define TPM_PF_DISABLEOWNERCLEAR ((TPM_CAPABILITY_AREA) 5)
761 #define TPM_PF_ALLOWMAINTENANCE ((TPM_CAPABILITY_AREA) 6)
762 #define TPM_PF_PHYSICALPRESENCELIFETIMELOCK ((TPM_CAPABILITY_AREA) 7)
763 #define TPM_PF_PHYSICALPRESENCEHWENABLE ((TPM_CAPABILITY_AREA) 8)
764 #define TPM_PF_PHYSICALPRESENCECMDENABLE ((TPM_CAPABILITY_AREA) 9)
765 #define TPM_PF_CEKPUSED ((TPM_CAPABILITY_AREA) 10)
766 #define TPM_PF_TPMPOST ((TPM_CAPABILITY_AREA) 11)
767 #define TPM_PF_TPMPOSTLOCK ((TPM_CAPABILITY_AREA) 12)
768 #define TPM_PF_FIPS ((TPM_CAPABILITY_AREA) 13)
769 #define TPM_PF_OPERATOR ((TPM_CAPABILITY_AREA) 14)
770 #define TPM_PF_ENABLEREVOKEEK ((TPM_CAPABILITY_AREA) 15)
771 #define TPM_PF_NV_LOCKED ((TPM_CAPABILITY_AREA) 16)
772 #define TPM_PF_READSRKPUB ((TPM_CAPABILITY_AREA) 17)
773 #define TPM_PF_TPMESTABLISHED ((TPM_CAPABILITY_AREA) 18)
774 #define TPM_PF_MAINTENANCEDONE ((TPM_CAPABILITY_AREA) 19)
775
776 ///
777 /// Part 2, section 7.2: TPM_STCLEAR_FLAGS
778 ///
779 typedef struct tdTPM_STCLEAR_FLAGS{
780 TPM_STRUCTURE_TAG tag;
781 BOOLEAN deactivated;
782 BOOLEAN disableForceClear;
783 BOOLEAN physicalPresence;
784 BOOLEAN physicalPresenceLock;
785 BOOLEAN bGlobalLock;
786 } TPM_STCLEAR_FLAGS;
787
788 //
789 // Part 2, section 7.2.1: Flag Restrictions (of TPM_STCLEAR_FLAGS)
790 //
791 #define TPM_SF_DEACTIVATED ((TPM_CAPABILITY_AREA) 1)
792 #define TPM_SF_DISABLEFORCECLEAR ((TPM_CAPABILITY_AREA) 2)
793 #define TPM_SF_PHYSICALPRESENCE ((TPM_CAPABILITY_AREA) 3)
794 #define TPM_SF_PHYSICALPRESENCELOCK ((TPM_CAPABILITY_AREA) 4)
795 #define TPM_SF_BGLOBALLOCK ((TPM_CAPABILITY_AREA) 5)
796
797 ///
798 /// Part 2, section 7.3: TPM_STANY_FLAGS
799 ///
800 typedef struct tdTPM_STANY_FLAGS{
801 TPM_STRUCTURE_TAG tag;
802 BOOLEAN postInitialise;
803 TPM_MODIFIER_INDICATOR localityModifier;
804 BOOLEAN transportExclusive;
805 BOOLEAN TOSPresent;
806 } TPM_STANY_FLAGS;
807
808 //
809 // Part 2, section 7.3.1: Flag Restrictions (of TPM_STANY_FLAGS)
810 //
811 #define TPM_AF_POSTINITIALISE ((TPM_CAPABILITY_AREA) 1)
812 #define TPM_AF_LOCALITYMODIFIER ((TPM_CAPABILITY_AREA) 2)
813 #define TPM_AF_TRANSPORTEXCLUSIVE ((TPM_CAPABILITY_AREA) 3)
814 #define TPM_AF_TOSPRESENT ((TPM_CAPABILITY_AREA) 4)
815
816 //
817 // All those structures defined in section 7.4, 7.5, 7.6 are not normative and
818 // thus no definitions here
819 //
820
821 //
822 // Part 2, section 8: PCR Structures
823 //
824
825 ///
826 /// Part 2, section 8.1: TPM_PCR_SELECTION
827 /// Size of pcrSelect[] indicated by sizeOfSelect
828 ///
829 typedef struct tdTPM_PCR_SELECTION {
830 UINT16 sizeOfSelect;
831 UINT8 pcrSelect[1];
832 } TPM_PCR_SELECTION;
833
834 ///
835 /// Part 2, section 8.2: TPM_PCR_COMPOSITE
836 /// Size of pcrValue[] indicated by valueSize
837 ///
838 typedef struct tdTPM_PCR_COMPOSITE {
839 TPM_PCR_SELECTION select;
840 UINT32 valueSize;
841 TPM_PCRVALUE pcrValue[1];
842 } TPM_PCR_COMPOSITE;
843
844 ///
845 /// Part 2, section 8.3: TPM_PCR_INFO
846 ///
847 typedef struct tdTPM_PCR_INFO {
848 TPM_PCR_SELECTION pcrSelection;
849 TPM_COMPOSITE_HASH digestAtRelease;
850 TPM_COMPOSITE_HASH digestAtCreation;
851 } TPM_PCR_INFO;
852
853 ///
854 /// Part 2, section 8.6: TPM_LOCALITY_SELECTION
855 ///
856 typedef UINT8 TPM_LOCALITY_SELECTION;
857
858 #define TPM_LOC_FOUR ((UINT8) 0x10)
859 #define TPM_LOC_THREE ((UINT8) 0x08)
860 #define TPM_LOC_TWO ((UINT8) 0x04)
861 #define TPM_LOC_ONE ((UINT8) 0x02)
862 #define TPM_LOC_ZERO ((UINT8) 0x01)
863
864 ///
865 /// Part 2, section 8.4: TPM_PCR_INFO_LONG
866 ///
867 typedef struct tdTPM_PCR_INFO_LONG {
868 TPM_STRUCTURE_TAG tag;
869 TPM_LOCALITY_SELECTION localityAtCreation;
870 TPM_LOCALITY_SELECTION localityAtRelease;
871 TPM_PCR_SELECTION creationPCRSelection;
872 TPM_PCR_SELECTION releasePCRSelection;
873 TPM_COMPOSITE_HASH digestAtCreation;
874 TPM_COMPOSITE_HASH digestAtRelease;
875 } TPM_PCR_INFO_LONG;
876
877 ///
878 /// Part 2, section 8.5: TPM_PCR_INFO_SHORT
879 ///
880 typedef struct tdTPM_PCR_INFO_SHORT{
881 TPM_PCR_SELECTION pcrSelection;
882 TPM_LOCALITY_SELECTION localityAtRelease;
883 TPM_COMPOSITE_HASH digestAtRelease;
884 } TPM_PCR_INFO_SHORT;
885
886 ///
887 /// Part 2, section 8.8: TPM_PCR_ATTRIBUTES
888 ///
889 typedef struct tdTPM_PCR_ATTRIBUTES{
890 BOOLEAN pcrReset;
891 TPM_LOCALITY_SELECTION pcrExtendLocal;
892 TPM_LOCALITY_SELECTION pcrResetLocal;
893 } TPM_PCR_ATTRIBUTES;
894
895 //
896 // Part 2, section 9: Storage Structures
897 //
898
899 ///
900 /// Part 2, section 9.1: TPM_STORED_DATA
901 /// [size_is(sealInfoSize)] BYTE* sealInfo;
902 /// [size_is(encDataSize)] BYTE* encData;
903 ///
904 typedef struct tdTPM_STORED_DATA {
905 TPM_STRUCT_VER ver;
906 UINT32 sealInfoSize;
907 UINT8 *sealInfo;
908 UINT32 encDataSize;
909 UINT8 *encData;
910 } TPM_STORED_DATA;
911
912 ///
913 /// Part 2, section 9.2: TPM_STORED_DATA12
914 /// [size_is(sealInfoSize)] BYTE* sealInfo;
915 /// [size_is(encDataSize)] BYTE* encData;
916 ///
917 typedef struct tdTPM_STORED_DATA12 {
918 TPM_STRUCTURE_TAG tag;
919 TPM_ENTITY_TYPE et;
920 UINT32 sealInfoSize;
921 UINT8 *sealInfo;
922 UINT32 encDataSize;
923 UINT8 *encData;
924 } TPM_STORED_DATA12;
925
926 ///
927 /// Part 2, section 9.3: TPM_SEALED_DATA
928 /// [size_is(dataSize)] BYTE* data;
929 ///
930 typedef struct tdTPM_SEALED_DATA {
931 TPM_PAYLOAD_TYPE payload;
932 TPM_SECRET authData;
933 TPM_NONCE tpmProof;
934 TPM_DIGEST storedDigest;
935 UINT32 dataSize;
936 UINT8 *data;
937 } TPM_SEALED_DATA;
938
939 ///
940 /// Part 2, section 9.4: TPM_SYMMETRIC_KEY
941 /// [size_is(size)] BYTE* data;
942 ///
943 typedef struct tdTPM_SYMMETRIC_KEY {
944 TPM_ALGORITHM_ID algId;
945 TPM_ENC_SCHEME encScheme;
946 UINT16 dataSize;
947 UINT8 *data;
948 } TPM_SYMMETRIC_KEY;
949
950 ///
951 /// Part 2, section 9.5: TPM_BOUND_DATA
952 ///
953 typedef struct tdTPM_BOUND_DATA {
954 TPM_STRUCT_VER ver;
955 TPM_PAYLOAD_TYPE payload;
956 UINT8 payloadData[1];
957 } TPM_BOUND_DATA;
958
959 //
960 // Part 2 section 10: TPM_KEY complex
961 //
962
963 //
964 // Section 10.1, 10.4, and 10.5 have been defined previously
965 //
966
967 ///
968 /// Part 2, section 10.2: TPM_KEY
969 /// [size_is(encDataSize)] BYTE* encData;
970 ///
971 typedef struct tdTPM_KEY{
972 TPM_STRUCT_VER ver;
973 TPM_KEY_USAGE keyUsage;
974 TPM_KEY_FLAGS keyFlags;
975 TPM_AUTH_DATA_USAGE authDataUsage;
976 TPM_KEY_PARMS algorithmParms;
977 UINT32 PCRInfoSize;
978 UINT8 *PCRInfo;
979 TPM_STORE_PUBKEY pubKey;
980 UINT32 encDataSize;
981 UINT8 *encData;
982 } TPM_KEY;
983
984 ///
985 /// Part 2, section 10.3: TPM_KEY12
986 /// [size_is(encDataSize)] BYTE* encData;
987 ///
988 typedef struct tdTPM_KEY12{
989 TPM_STRUCTURE_TAG tag;
990 UINT16 fill;
991 TPM_KEY_USAGE keyUsage;
992 TPM_KEY_FLAGS keyFlags;
993 TPM_AUTH_DATA_USAGE authDataUsage;
994 TPM_KEY_PARMS algorithmParms;
995 UINT32 PCRInfoSize;
996 UINT8 *PCRInfo;
997 TPM_STORE_PUBKEY pubKey;
998 UINT32 encDataSize;
999 UINT8 *encData;
1000 } TPM_KEY12;
1001
1002 ///
1003 /// Part 2, section 10.7: TPM_STORE_PRIVKEY
1004 /// [size_is(keyLength)] BYTE* key;
1005 ///
1006 typedef struct tdTPM_STORE_PRIVKEY {
1007 UINT32 keyLength;
1008 UINT8 *key;
1009 } TPM_STORE_PRIVKEY;
1010
1011 ///
1012 /// Part 2, section 10.6: TPM_STORE_ASYMKEY
1013 ///
1014 typedef struct tdTPM_STORE_ASYMKEY { // pos len total
1015 TPM_PAYLOAD_TYPE payload; // 0 1 1
1016 TPM_SECRET usageAuth; // 1 20 21
1017 TPM_SECRET migrationAuth; // 21 20 41
1018 TPM_DIGEST pubDataDigest; // 41 20 61
1019 TPM_STORE_PRIVKEY privKey; // 61 132-151 193-214
1020 } TPM_STORE_ASYMKEY;
1021
1022 ///
1023 /// Part 2, section 10.8: TPM_MIGRATE_ASYMKEY
1024 /// [size_is(partPrivKeyLen)] BYTE* partPrivKey;
1025 ///
1026 typedef struct tdTPM_MIGRATE_ASYMKEY { // pos len total
1027 TPM_PAYLOAD_TYPE payload; // 0 1 1
1028 TPM_SECRET usageAuth; // 1 20 21
1029 TPM_DIGEST pubDataDigest; // 21 20 41
1030 UINT32 partPrivKeyLen; // 41 4 45
1031 UINT8 *partPrivKey; // 45 112-127 157-172
1032 } TPM_MIGRATE_ASYMKEY;
1033
1034 ///
1035 /// Part 2, section 10.9: TPM_KEY_CONTROL
1036 ///
1037 #define TPM_KEY_CONTROL_OWNER_EVICT ((UINT32) 0x00000001)
1038
1039 //
1040 // Part 2, section 11: Signed Structures
1041 //
1042
1043 ///
1044 /// Part 2, section 11.1: TPM_CERTIFY_INFO Structure
1045 ///
1046 typedef struct tdTPM_CERTIFY_INFO {
1047 TPM_STRUCT_VER version;
1048 TPM_KEY_USAGE keyUsage;
1049 TPM_KEY_FLAGS keyFlags;
1050 TPM_AUTH_DATA_USAGE authDataUsage;
1051 TPM_KEY_PARMS algorithmParms;
1052 TPM_DIGEST pubkeyDigest;
1053 TPM_NONCE data;
1054 BOOLEAN parentPCRStatus;
1055 UINT32 PCRInfoSize;
1056 UINT8 *PCRInfo;
1057 } TPM_CERTIFY_INFO;
1058
1059 ///
1060 /// Part 2, section 11.2: TPM_CERTIFY_INFO2 Structure
1061 ///
1062 typedef struct tdTPM_CERTIFY_INFO2 {
1063 TPM_STRUCTURE_TAG tag;
1064 UINT8 fill;
1065 TPM_PAYLOAD_TYPE payloadType;
1066 TPM_KEY_USAGE keyUsage;
1067 TPM_KEY_FLAGS keyFlags;
1068 TPM_AUTH_DATA_USAGE authDataUsage;
1069 TPM_KEY_PARMS algorithmParms;
1070 TPM_DIGEST pubkeyDigest;
1071 TPM_NONCE data;
1072 BOOLEAN parentPCRStatus;
1073 UINT32 PCRInfoSize;
1074 UINT8 *PCRInfo;
1075 UINT32 migrationAuthoritySize;
1076 UINT8 *migrationAuthority;
1077 } TPM_CERTIFY_INFO2;
1078
1079 ///
1080 /// Part 2, section 11.3 TPM_QUOTE_INFO Structure
1081 ///
1082 typedef struct tdTPM_QUOTE_INFO {
1083 TPM_STRUCT_VER version;
1084 UINT8 fixed[4];
1085 TPM_COMPOSITE_HASH digestValue;
1086 TPM_NONCE externalData;
1087 } TPM_QUOTE_INFO;
1088
1089 ///
1090 /// Part 2, section 11.4 TPM_QUOTE_INFO2 Structure
1091 ///
1092 typedef struct tdTPM_QUOTE_INFO2 {
1093 TPM_STRUCTURE_TAG tag;
1094 UINT8 fixed[4];
1095 TPM_NONCE externalData;
1096 TPM_PCR_INFO_SHORT infoShort;
1097 } TPM_QUOTE_INFO2;
1098
1099 //
1100 // Part 2, section 12: Identity Structures
1101 //
1102
1103 ///
1104 /// Part 2, section 12.1 TPM_EK_BLOB
1105 ///
1106 typedef struct tdTPM_EK_BLOB {
1107 TPM_STRUCTURE_TAG tag;
1108 TPM_EK_TYPE ekType;
1109 UINT32 blobSize;
1110 UINT8 *blob;
1111 } TPM_EK_BLOB;
1112
1113 ///
1114 /// Part 2, section 12.2 TPM_EK_BLOB_ACTIVATE
1115 ///
1116 typedef struct tdTPM_EK_BLOB_ACTIVATE {
1117 TPM_STRUCTURE_TAG tag;
1118 TPM_SYMMETRIC_KEY sessionKey;
1119 TPM_DIGEST idDigest;
1120 TPM_PCR_INFO_SHORT pcrInfo;
1121 } TPM_EK_BLOB_ACTIVATE;
1122
1123 ///
1124 /// Part 2, section 12.3 TPM_EK_BLOB_AUTH
1125 ///
1126 typedef struct tdTPM_EK_BLOB_AUTH {
1127 TPM_STRUCTURE_TAG tag;
1128 TPM_SECRET authValue;
1129 } TPM_EK_BLOB_AUTH;
1130
1131
1132 ///
1133 /// Part 2, section 12.5 TPM_IDENTITY_CONTENTS
1134 ///
1135 typedef struct tdTPM_IDENTITY_CONTENTS {
1136 TPM_STRUCT_VER ver;
1137 UINT32 ordinal;
1138 TPM_CHOSENID_HASH labelPrivCADigest;
1139 TPM_PUBKEY identityPubKey;
1140 } TPM_IDENTITY_CONTENTS;
1141
1142 ///
1143 /// Part 2, section 12.6 TPM_IDENTITY_REQ
1144 ///
1145 typedef struct tdTPM_IDENTITY_REQ {
1146 UINT32 asymSize;
1147 UINT32 symSize;
1148 TPM_KEY_PARMS asymAlgorithm;
1149 TPM_KEY_PARMS symAlgorithm;
1150 UINT8 *asymBlob;
1151 UINT8 *symBlob;
1152 } TPM_IDENTITY_REQ;
1153
1154 ///
1155 /// Part 2, section 12.7 TPM_IDENTITY_PROOF
1156 ///
1157 typedef struct tdTPM_IDENTITY_PROOF {
1158 TPM_STRUCT_VER ver;
1159 UINT32 labelSize;
1160 UINT32 identityBindingSize;
1161 UINT32 endorsementSize;
1162 UINT32 platformSize;
1163 UINT32 conformanceSize;
1164 TPM_PUBKEY identityKey;
1165 UINT8 *labelArea;
1166 UINT8 *identityBinding;
1167 UINT8 *endorsementCredential;
1168 UINT8 *platformCredential;
1169 UINT8 *conformanceCredential;
1170 } TPM_IDENTITY_PROOF;
1171
1172 ///
1173 /// Part 2, section 12.8 TPM_ASYM_CA_CONTENTS
1174 ///
1175 typedef struct tdTPM_ASYM_CA_CONTENTS {
1176 TPM_SYMMETRIC_KEY sessionKey;
1177 TPM_DIGEST idDigest;
1178 } TPM_ASYM_CA_CONTENTS;
1179
1180 ///
1181 /// Part 2, section 12.9 TPM_SYM_CA_ATTESTATION
1182 ///
1183 typedef struct tdTPM_SYM_CA_ATTESTATION {
1184 UINT32 credSize;
1185 TPM_KEY_PARMS algorithm;
1186 UINT8 *credential;
1187 } TPM_SYM_CA_ATTESTATION;
1188
1189 ///
1190 /// Part 2, section 15: Tick Structures
1191 /// Placed here out of order because definitions are used in section 13.
1192 ///
1193 typedef struct tdTPM_CURRENT_TICKS {
1194 TPM_STRUCTURE_TAG tag;
1195 UINT64 currentTicks;
1196 UINT16 tickRate;
1197 TPM_NONCE tickNonce;
1198 } TPM_CURRENT_TICKS;
1199
1200 ///
1201 /// Part 2, section 13: Transport structures
1202 ///
1203
1204 ///
1205 /// Part 2, section 13.1: TPM _TRANSPORT_PUBLIC
1206 ///
1207 typedef struct tdTPM_TRANSPORT_PUBLIC {
1208 TPM_STRUCTURE_TAG tag;
1209 TPM_TRANSPORT_ATTRIBUTES transAttributes;
1210 TPM_ALGORITHM_ID algId;
1211 TPM_ENC_SCHEME encScheme;
1212 } TPM_TRANSPORT_PUBLIC;
1213
1214 //
1215 // Part 2, section 13.1.1 TPM_TRANSPORT_ATTRIBUTES Definitions
1216 //
1217 #define TPM_TRANSPORT_ENCRYPT ((UINT32)BIT0)
1218 #define TPM_TRANSPORT_LOG ((UINT32)BIT1)
1219 #define TPM_TRANSPORT_EXCLUSIVE ((UINT32)BIT2)
1220
1221 ///
1222 /// Part 2, section 13.2 TPM_TRANSPORT_INTERNAL
1223 ///
1224 typedef struct tdTPM_TRANSPORT_INTERNAL {
1225 TPM_STRUCTURE_TAG tag;
1226 TPM_AUTHDATA authData;
1227 TPM_TRANSPORT_PUBLIC transPublic;
1228 TPM_TRANSHANDLE transHandle;
1229 TPM_NONCE transNonceEven;
1230 TPM_DIGEST transDigest;
1231 } TPM_TRANSPORT_INTERNAL;
1232
1233 ///
1234 /// Part 2, section 13.3 TPM_TRANSPORT_LOG_IN structure
1235 ///
1236 typedef struct tdTPM_TRANSPORT_LOG_IN {
1237 TPM_STRUCTURE_TAG tag;
1238 TPM_DIGEST parameters;
1239 TPM_DIGEST pubKeyHash;
1240 } TPM_TRANSPORT_LOG_IN;
1241
1242 ///
1243 /// Part 2, section 13.4 TPM_TRANSPORT_LOG_OUT structure
1244 ///
1245 typedef struct tdTPM_TRANSPORT_LOG_OUT {
1246 TPM_STRUCTURE_TAG tag;
1247 TPM_CURRENT_TICKS currentTicks;
1248 TPM_DIGEST parameters;
1249 TPM_MODIFIER_INDICATOR locality;
1250 } TPM_TRANSPORT_LOG_OUT;
1251
1252 ///
1253 /// Part 2, section 13.5 TPM_TRANSPORT_AUTH structure
1254 ///
1255 typedef struct tdTPM_TRANSPORT_AUTH {
1256 TPM_STRUCTURE_TAG tag;
1257 TPM_AUTHDATA authData;
1258 } TPM_TRANSPORT_AUTH;
1259
1260 //
1261 // Part 2, section 14: Audit Structures
1262 //
1263
1264 ///
1265 /// Part 2, section 14.1 TPM_AUDIT_EVENT_IN structure
1266 ///
1267 typedef struct tdTPM_AUDIT_EVENT_IN {
1268 TPM_STRUCTURE_TAG tag;
1269 TPM_DIGEST inputParms;
1270 TPM_COUNTER_VALUE auditCount;
1271 } TPM_AUDIT_EVENT_IN;
1272
1273 ///
1274 /// Part 2, section 14.2 TPM_AUDIT_EVENT_OUT structure
1275 ///
1276 typedef struct tdTPM_AUDIT_EVENT_OUT {
1277 TPM_STRUCTURE_TAG tag;
1278 TPM_COMMAND_CODE ordinal;
1279 TPM_DIGEST outputParms;
1280 TPM_COUNTER_VALUE auditCount;
1281 TPM_RESULT returnCode;
1282 } TPM_AUDIT_EVENT_OUT;
1283
1284 //
1285 // Part 2, section 16: Return Codes
1286 //
1287
1288 #define TPM_VENDOR_ERROR TPM_Vendor_Specific32
1289 #define TPM_NON_FATAL 0x00000800
1290
1291 #define TPM_SUCCESS ((TPM_RESULT) TPM_BASE)
1292 #define TPM_AUTHFAIL ((TPM_RESULT) (TPM_BASE + 1))
1293 #define TPM_BADINDEX ((TPM_RESULT) (TPM_BASE + 2))
1294 #define TPM_BAD_PARAMETER ((TPM_RESULT) (TPM_BASE + 3))
1295 #define TPM_AUDITFAILURE ((TPM_RESULT) (TPM_BASE + 4))
1296 #define TPM_CLEAR_DISABLED ((TPM_RESULT) (TPM_BASE + 5))
1297 #define TPM_DEACTIVATED ((TPM_RESULT) (TPM_BASE + 6))
1298 #define TPM_DISABLED ((TPM_RESULT) (TPM_BASE + 7))
1299 #define TPM_DISABLED_CMD ((TPM_RESULT) (TPM_BASE + 8))
1300 #define TPM_FAIL ((TPM_RESULT) (TPM_BASE + 9))
1301 #define TPM_BAD_ORDINAL ((TPM_RESULT) (TPM_BASE + 10))
1302 #define TPM_INSTALL_DISABLED ((TPM_RESULT) (TPM_BASE + 11))
1303 #define TPM_INVALID_KEYHANDLE ((TPM_RESULT) (TPM_BASE + 12))
1304 #define TPM_KEYNOTFOUND ((TPM_RESULT) (TPM_BASE + 13))
1305 #define TPM_INAPPROPRIATE_ENC ((TPM_RESULT) (TPM_BASE + 14))
1306 #define TPM_MIGRATEFAIL ((TPM_RESULT) (TPM_BASE + 15))
1307 #define TPM_INVALID_PCR_INFO ((TPM_RESULT) (TPM_BASE + 16))
1308 #define TPM_NOSPACE ((TPM_RESULT) (TPM_BASE + 17))
1309 #define TPM_NOSRK ((TPM_RESULT) (TPM_BASE + 18))
1310 #define TPM_NOTSEALED_BLOB ((TPM_RESULT) (TPM_BASE + 19))
1311 #define TPM_OWNER_SET ((TPM_RESULT) (TPM_BASE + 20))
1312 #define TPM_RESOURCES ((TPM_RESULT) (TPM_BASE + 21))
1313 #define TPM_SHORTRANDOM ((TPM_RESULT) (TPM_BASE + 22))
1314 #define TPM_SIZE ((TPM_RESULT) (TPM_BASE + 23))
1315 #define TPM_WRONGPCRVAL ((TPM_RESULT) (TPM_BASE + 24))
1316 #define TPM_BAD_PARAM_SIZE ((TPM_RESULT) (TPM_BASE + 25))
1317 #define TPM_SHA_THREAD ((TPM_RESULT) (TPM_BASE + 26))
1318 #define TPM_SHA_ERROR ((TPM_RESULT) (TPM_BASE + 27))
1319 #define TPM_FAILEDSELFTEST ((TPM_RESULT) (TPM_BASE + 28))
1320 #define TPM_AUTH2FAIL ((TPM_RESULT) (TPM_BASE + 29))
1321 #define TPM_BADTAG ((TPM_RESULT) (TPM_BASE + 30))
1322 #define TPM_IOERROR ((TPM_RESULT) (TPM_BASE + 31))
1323 #define TPM_ENCRYPT_ERROR ((TPM_RESULT) (TPM_BASE + 32))
1324 #define TPM_DECRYPT_ERROR ((TPM_RESULT) (TPM_BASE + 33))
1325 #define TPM_INVALID_AUTHHANDLE ((TPM_RESULT) (TPM_BASE + 34))
1326 #define TPM_NO_ENDORSEMENT ((TPM_RESULT) (TPM_BASE + 35))
1327 #define TPM_INVALID_KEYUSAGE ((TPM_RESULT) (TPM_BASE + 36))
1328 #define TPM_WRONG_ENTITYTYPE ((TPM_RESULT) (TPM_BASE + 37))
1329 #define TPM_INVALID_POSTINIT ((TPM_RESULT) (TPM_BASE + 38))
1330 #define TPM_INAPPROPRIATE_SIG ((TPM_RESULT) (TPM_BASE + 39))
1331 #define TPM_BAD_KEY_PROPERTY ((TPM_RESULT) (TPM_BASE + 40))
1332 #define TPM_BAD_MIGRATION ((TPM_RESULT) (TPM_BASE + 41))
1333 #define TPM_BAD_SCHEME ((TPM_RESULT) (TPM_BASE + 42))
1334 #define TPM_BAD_DATASIZE ((TPM_RESULT) (TPM_BASE + 43))
1335 #define TPM_BAD_MODE ((TPM_RESULT) (TPM_BASE + 44))
1336 #define TPM_BAD_PRESENCE ((TPM_RESULT) (TPM_BASE + 45))
1337 #define TPM_BAD_VERSION ((TPM_RESULT) (TPM_BASE + 46))
1338 #define TPM_NO_WRAP_TRANSPORT ((TPM_RESULT) (TPM_BASE + 47))
1339 #define TPM_AUDITFAIL_UNSUCCESSFUL ((TPM_RESULT) (TPM_BASE + 48))
1340 #define TPM_AUDITFAIL_SUCCESSFUL ((TPM_RESULT) (TPM_BASE + 49))
1341 #define TPM_NOTRESETABLE ((TPM_RESULT) (TPM_BASE + 50))
1342 #define TPM_NOTLOCAL ((TPM_RESULT) (TPM_BASE + 51))
1343 #define TPM_BAD_TYPE ((TPM_RESULT) (TPM_BASE + 52))
1344 #define TPM_INVALID_RESOURCE ((TPM_RESULT) (TPM_BASE + 53))
1345 #define TPM_NOTFIPS ((TPM_RESULT) (TPM_BASE + 54))
1346 #define TPM_INVALID_FAMILY ((TPM_RESULT) (TPM_BASE + 55))
1347 #define TPM_NO_NV_PERMISSION ((TPM_RESULT) (TPM_BASE + 56))
1348 #define TPM_REQUIRES_SIGN ((TPM_RESULT) (TPM_BASE + 57))
1349 #define TPM_KEY_NOTSUPPORTED ((TPM_RESULT) (TPM_BASE + 58))
1350 #define TPM_AUTH_CONFLICT ((TPM_RESULT) (TPM_BASE + 59))
1351 #define TPM_AREA_LOCKED ((TPM_RESULT) (TPM_BASE + 60))
1352 #define TPM_BAD_LOCALITY ((TPM_RESULT) (TPM_BASE + 61))
1353 #define TPM_READ_ONLY ((TPM_RESULT) (TPM_BASE + 62))
1354 #define TPM_PER_NOWRITE ((TPM_RESULT) (TPM_BASE + 63))
1355 #define TPM_FAMILYCOUNT ((TPM_RESULT) (TPM_BASE + 64))
1356 #define TPM_WRITE_LOCKED ((TPM_RESULT) (TPM_BASE + 65))
1357 #define TPM_BAD_ATTRIBUTES ((TPM_RESULT) (TPM_BASE + 66))
1358 #define TPM_INVALID_STRUCTURE ((TPM_RESULT) (TPM_BASE + 67))
1359 #define TPM_KEY_OWNER_CONTROL ((TPM_RESULT) (TPM_BASE + 68))
1360 #define TPM_BAD_COUNTER ((TPM_RESULT) (TPM_BASE + 69))
1361 #define TPM_NOT_FULLWRITE ((TPM_RESULT) (TPM_BASE + 70))
1362 #define TPM_CONTEXT_GAP ((TPM_RESULT) (TPM_BASE + 71))
1363 #define TPM_MAXNVWRITES ((TPM_RESULT) (TPM_BASE + 72))
1364 #define TPM_NOOPERATOR ((TPM_RESULT) (TPM_BASE + 73))
1365 #define TPM_RESOURCEMISSING ((TPM_RESULT) (TPM_BASE + 74))
1366 #define TPM_DELEGATE_LOCK ((TPM_RESULT) (TPM_BASE + 75))
1367 #define TPM_DELEGATE_FAMILY ((TPM_RESULT) (TPM_BASE + 76))
1368 #define TPM_DELEGATE_ADMIN ((TPM_RESULT) (TPM_BASE + 77))
1369 #define TPM_TRANSPORT_NOTEXCLUSIVE ((TPM_RESULT) (TPM_BASE + 78))
1370 #define TPM_OWNER_CONTROL ((TPM_RESULT) (TPM_BASE + 79))
1371 #define TPM_DAA_RESOURCES ((TPM_RESULT) (TPM_BASE + 80))
1372 #define TPM_DAA_INPUT_DATA0 ((TPM_RESULT) (TPM_BASE + 81))
1373 #define TPM_DAA_INPUT_DATA1 ((TPM_RESULT) (TPM_BASE + 82))
1374 #define TPM_DAA_ISSUER_SETTINGS ((TPM_RESULT) (TPM_BASE + 83))
1375 #define TPM_DAA_TPM_SETTINGS ((TPM_RESULT) (TPM_BASE + 84))
1376 #define TPM_DAA_STAGE ((TPM_RESULT) (TPM_BASE + 85))
1377 #define TPM_DAA_ISSUER_VALIDITY ((TPM_RESULT) (TPM_BASE + 86))
1378 #define TPM_DAA_WRONG_W ((TPM_RESULT) (TPM_BASE + 87))
1379 #define TPM_BAD_HANDLE ((TPM_RESULT) (TPM_BASE + 88))
1380 #define TPM_BAD_DELEGATE ((TPM_RESULT) (TPM_BASE + 89))
1381 #define TPM_BADCONTEXT ((TPM_RESULT) (TPM_BASE + 90))
1382 #define TPM_TOOMANYCONTEXTS ((TPM_RESULT) (TPM_BASE + 91))
1383 #define TPM_MA_TICKET_SIGNATURE ((TPM_RESULT) (TPM_BASE + 92))
1384 #define TPM_MA_DESTINATION ((TPM_RESULT) (TPM_BASE + 93))
1385 #define TPM_MA_SOURCE ((TPM_RESULT) (TPM_BASE + 94))
1386 #define TPM_MA_AUTHORITY ((TPM_RESULT) (TPM_BASE + 95))
1387 #define TPM_PERMANENTEK ((TPM_RESULT) (TPM_BASE + 97))
1388 #define TPM_BAD_SIGNATURE ((TPM_RESULT) (TPM_BASE + 98))
1389 #define TPM_NOCONTEXTSPACE ((TPM_RESULT) (TPM_BASE + 99))
1390
1391 #define TPM_RETRY ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL))
1392 #define TPM_NEEDS_SELFTEST ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL + 1))
1393 #define TPM_DOING_SELFTEST ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL + 2))
1394 #define TPM_DEFEND_LOCK_RUNNING ((TPM_RESULT) (TPM_BASE + TPM_NON_FATAL + 3))
1395
1396 //
1397 // Part 2, section 17: Ordinals
1398 //
1399 // Ordinals are 32 bit values. The upper byte contains values that serve as
1400 // flag indicators, the next byte contains values indicating what committee
1401 // designated the ordinal, and the final two bytes contain the Command
1402 // Ordinal Index.
1403 // 3 2 1
1404 // 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
1405 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1406 // |P|C|V| Reserved| Purview | Command Ordinal Index |
1407 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1408 //
1409 // Where:
1410 //
1411 // * P is Protected/Unprotected command. When 0 the command is a Protected
1412 // command, when 1 the command is an Unprotected command.
1413 //
1414 // * C is Non-Connection/Connection related command. When 0 this command
1415 // passes through to either the protected (TPM) or unprotected (TSS)
1416 // components.
1417 //
1418 // * V is TPM/Vendor command. When 0 the command is TPM defined, when 1 the
1419 // command is vendor defined.
1420 //
1421 // * All reserved area bits are set to 0.
1422 //
1423
1424 #define TPM_ORD_ActivateIdentity ((TPM_COMMAND_CODE) 0x0000007A)
1425 #define TPM_ORD_AuthorizeMigrationKey ((TPM_COMMAND_CODE) 0x0000002B)
1426 #define TPM_ORD_CertifyKey ((TPM_COMMAND_CODE) 0x00000032)
1427 #define TPM_ORD_CertifyKey2 ((TPM_COMMAND_CODE) 0x00000033)
1428 #define TPM_ORD_CertifySelfTest ((TPM_COMMAND_CODE) 0x00000052)
1429 #define TPM_ORD_ChangeAuth ((TPM_COMMAND_CODE) 0x0000000C)
1430 #define TPM_ORD_ChangeAuthAsymFinish ((TPM_COMMAND_CODE) 0x0000000F)
1431 #define TPM_ORD_ChangeAuthAsymStart ((TPM_COMMAND_CODE) 0x0000000E)
1432 #define TPM_ORD_ChangeAuthOwner ((TPM_COMMAND_CODE) 0x00000010)
1433 #define TPM_ORD_CMK_ApproveMA ((TPM_COMMAND_CODE) 0x0000001D)
1434 #define TPM_ORD_CMK_ConvertMigration ((TPM_COMMAND_CODE) 0x00000024)
1435 #define TPM_ORD_CMK_CreateBlob ((TPM_COMMAND_CODE) 0x0000001B)
1436 #define TPM_ORD_CMK_CreateKey ((TPM_COMMAND_CODE) 0x00000013)
1437 #define TPM_ORD_CMK_CreateTicket ((TPM_COMMAND_CODE) 0x00000012)
1438 #define TPM_ORD_CMK_SetRestrictions ((TPM_COMMAND_CODE) 0x0000001C)
1439 #define TPM_ORD_ContinueSelfTest ((TPM_COMMAND_CODE) 0x00000053)
1440 #define TPM_ORD_ConvertMigrationBlob ((TPM_COMMAND_CODE) 0x0000002A)
1441 #define TPM_ORD_CreateCounter ((TPM_COMMAND_CODE) 0x000000DC)
1442 #define TPM_ORD_CreateEndorsementKeyPair ((TPM_COMMAND_CODE) 0x00000078)
1443 #define TPM_ORD_CreateMaintenanceArchive ((TPM_COMMAND_CODE) 0x0000002C)
1444 #define TPM_ORD_CreateMigrationBlob ((TPM_COMMAND_CODE) 0x00000028)
1445 #define TPM_ORD_CreateRevocableEK ((TPM_COMMAND_CODE) 0x0000007F)
1446 #define TPM_ORD_CreateWrapKey ((TPM_COMMAND_CODE) 0x0000001F)
1447 #define TPM_ORD_DAA_JOIN ((TPM_COMMAND_CODE) 0x00000029)
1448 #define TPM_ORD_DAA_SIGN ((TPM_COMMAND_CODE) 0x00000031)
1449 #define TPM_ORD_Delegate_CreateKeyDelegation ((TPM_COMMAND_CODE) 0x000000D4)
1450 #define TPM_ORD_Delegate_CreateOwnerDelegation ((TPM_COMMAND_CODE) 0x000000D5)
1451 #define TPM_ORD_Delegate_LoadOwnerDelegation ((TPM_COMMAND_CODE) 0x000000D8)
1452 #define TPM_ORD_Delegate_Manage ((TPM_COMMAND_CODE) 0x000000D2)
1453 #define TPM_ORD_Delegate_ReadTable ((TPM_COMMAND_CODE) 0x000000DB)
1454 #define TPM_ORD_Delegate_UpdateVerification ((TPM_COMMAND_CODE) 0x000000D1)
1455 #define TPM_ORD_Delegate_VerifyDelegation ((TPM_COMMAND_CODE) 0x000000D6)
1456 #define TPM_ORD_DirRead ((TPM_COMMAND_CODE) 0x0000001A)
1457 #define TPM_ORD_DirWriteAuth ((TPM_COMMAND_CODE) 0x00000019)
1458 #define TPM_ORD_DisableForceClear ((TPM_COMMAND_CODE) 0x0000005E)
1459 #define TPM_ORD_DisableOwnerClear ((TPM_COMMAND_CODE) 0x0000005C)
1460 #define TPM_ORD_DisablePubekRead ((TPM_COMMAND_CODE) 0x0000007E)
1461 #define TPM_ORD_DSAP ((TPM_COMMAND_CODE) 0x00000011)
1462 #define TPM_ORD_EstablishTransport ((TPM_COMMAND_CODE) 0x000000E6)
1463 #define TPM_ORD_EvictKey ((TPM_COMMAND_CODE) 0x00000022)
1464 #define TPM_ORD_ExecuteTransport ((TPM_COMMAND_CODE) 0x000000E7)
1465 #define TPM_ORD_Extend ((TPM_COMMAND_CODE) 0x00000014)
1466 #define TPM_ORD_FieldUpgrade ((TPM_COMMAND_CODE) 0x000000AA)
1467 #define TPM_ORD_FlushSpecific ((TPM_COMMAND_CODE) 0x000000BA)
1468 #define TPM_ORD_ForceClear ((TPM_COMMAND_CODE) 0x0000005D)
1469 #define TPM_ORD_GetAuditDigest ((TPM_COMMAND_CODE) 0x00000085)
1470 #define TPM_ORD_GetAuditDigestSigned ((TPM_COMMAND_CODE) 0x00000086)
1471 #define TPM_ORD_GetAuditEvent ((TPM_COMMAND_CODE) 0x00000082)
1472 #define TPM_ORD_GetAuditEventSigned ((TPM_COMMAND_CODE) 0x00000083)
1473 #define TPM_ORD_GetCapability ((TPM_COMMAND_CODE) 0x00000065)
1474 #define TPM_ORD_GetCapabilityOwner ((TPM_COMMAND_CODE) 0x00000066)
1475 #define TPM_ORD_GetCapabilitySigned ((TPM_COMMAND_CODE) 0x00000064)
1476 #define TPM_ORD_GetOrdinalAuditStatus ((TPM_COMMAND_CODE) 0x0000008C)
1477 #define TPM_ORD_GetPubKey ((TPM_COMMAND_CODE) 0x00000021)
1478 #define TPM_ORD_GetRandom ((TPM_COMMAND_CODE) 0x00000046)
1479 #define TPM_ORD_GetTestResult ((TPM_COMMAND_CODE) 0x00000054)
1480 #define TPM_ORD_GetTicks ((TPM_COMMAND_CODE) 0x000000F1)
1481 #define TPM_ORD_IncrementCounter ((TPM_COMMAND_CODE) 0x000000DD)
1482 #define TPM_ORD_Init ((TPM_COMMAND_CODE) 0x00000097)
1483 #define TPM_ORD_KeyControlOwner ((TPM_COMMAND_CODE) 0x00000023)
1484 #define TPM_ORD_KillMaintenanceFeature ((TPM_COMMAND_CODE) 0x0000002E)
1485 #define TPM_ORD_LoadAuthContext ((TPM_COMMAND_CODE) 0x000000B7)
1486 #define TPM_ORD_LoadContext ((TPM_COMMAND_CODE) 0x000000B9)
1487 #define TPM_ORD_LoadKey ((TPM_COMMAND_CODE) 0x00000020)
1488 #define TPM_ORD_LoadKey2 ((TPM_COMMAND_CODE) 0x00000041)
1489 #define TPM_ORD_LoadKeyContext ((TPM_COMMAND_CODE) 0x000000B5)
1490 #define TPM_ORD_LoadMaintenanceArchive ((TPM_COMMAND_CODE) 0x0000002D)
1491 #define TPM_ORD_LoadManuMaintPub ((TPM_COMMAND_CODE) 0x0000002F)
1492 #define TPM_ORD_MakeIdentity ((TPM_COMMAND_CODE) 0x00000079)
1493 #define TPM_ORD_MigrateKey ((TPM_COMMAND_CODE) 0x00000025)
1494 #define TPM_ORD_NV_DefineSpace ((TPM_COMMAND_CODE) 0x000000CC)
1495 #define TPM_ORD_NV_ReadValue ((TPM_COMMAND_CODE) 0x000000CF)
1496 #define TPM_ORD_NV_ReadValueAuth ((TPM_COMMAND_CODE) 0x000000D0)
1497 #define TPM_ORD_NV_WriteValue ((TPM_COMMAND_CODE) 0x000000CD)
1498 #define TPM_ORD_NV_WriteValueAuth ((TPM_COMMAND_CODE) 0x000000CE)
1499 #define TPM_ORD_OIAP ((TPM_COMMAND_CODE) 0x0000000A)
1500 #define TPM_ORD_OSAP ((TPM_COMMAND_CODE) 0x0000000B)
1501 #define TPM_ORD_OwnerClear ((TPM_COMMAND_CODE) 0x0000005B)
1502 #define TPM_ORD_OwnerReadInternalPub ((TPM_COMMAND_CODE) 0x00000081)
1503 #define TPM_ORD_OwnerReadPubek ((TPM_COMMAND_CODE) 0x0000007D)
1504 #define TPM_ORD_OwnerSetDisable ((TPM_COMMAND_CODE) 0x0000006E)
1505 #define TPM_ORD_PCR_Reset ((TPM_COMMAND_CODE) 0x000000C8)
1506 #define TPM_ORD_PcrRead ((TPM_COMMAND_CODE) 0x00000015)
1507 #define TPM_ORD_PhysicalDisable ((TPM_COMMAND_CODE) 0x00000070)
1508 #define TPM_ORD_PhysicalEnable ((TPM_COMMAND_CODE) 0x0000006F)
1509 #define TPM_ORD_PhysicalSetDeactivated ((TPM_COMMAND_CODE) 0x00000072)
1510 #define TPM_ORD_Quote ((TPM_COMMAND_CODE) 0x00000016)
1511 #define TPM_ORD_Quote2 ((TPM_COMMAND_CODE) 0x0000003E)
1512 #define TPM_ORD_ReadCounter ((TPM_COMMAND_CODE) 0x000000DE)
1513 #define TPM_ORD_ReadManuMaintPub ((TPM_COMMAND_CODE) 0x00000030)
1514 #define TPM_ORD_ReadPubek ((TPM_COMMAND_CODE) 0x0000007C)
1515 #define TPM_ORD_ReleaseCounter ((TPM_COMMAND_CODE) 0x000000DF)
1516 #define TPM_ORD_ReleaseCounterOwner ((TPM_COMMAND_CODE) 0x000000E0)
1517 #define TPM_ORD_ReleaseTransportSigned ((TPM_COMMAND_CODE) 0x000000E8)
1518 #define TPM_ORD_Reset ((TPM_COMMAND_CODE) 0x0000005A)
1519 #define TPM_ORD_ResetLockValue ((TPM_COMMAND_CODE) 0x00000040)
1520 #define TPM_ORD_RevokeTrust ((TPM_COMMAND_CODE) 0x00000080)
1521 #define TPM_ORD_SaveAuthContext ((TPM_COMMAND_CODE) 0x000000B6)
1522 #define TPM_ORD_SaveContext ((TPM_COMMAND_CODE) 0x000000B8)
1523 #define TPM_ORD_SaveKeyContext ((TPM_COMMAND_CODE) 0x000000B4)
1524 #define TPM_ORD_SaveState ((TPM_COMMAND_CODE) 0x00000098)
1525 #define TPM_ORD_Seal ((TPM_COMMAND_CODE) 0x00000017)
1526 #define TPM_ORD_Sealx ((TPM_COMMAND_CODE) 0x0000003D)
1527 #define TPM_ORD_SelfTestFull ((TPM_COMMAND_CODE) 0x00000050)
1528 #define TPM_ORD_SetCapability ((TPM_COMMAND_CODE) 0x0000003F)
1529 #define TPM_ORD_SetOperatorAuth ((TPM_COMMAND_CODE) 0x00000074)
1530 #define TPM_ORD_SetOrdinalAuditStatus ((TPM_COMMAND_CODE) 0x0000008D)
1531 #define TPM_ORD_SetOwnerInstall ((TPM_COMMAND_CODE) 0x00000071)
1532 #define TPM_ORD_SetOwnerPointer ((TPM_COMMAND_CODE) 0x00000075)
1533 #define TPM_ORD_SetRedirection ((TPM_COMMAND_CODE) 0x0000009A)
1534 #define TPM_ORD_SetTempDeactivated ((TPM_COMMAND_CODE) 0x00000073)
1535 #define TPM_ORD_SHA1Complete ((TPM_COMMAND_CODE) 0x000000A2)
1536 #define TPM_ORD_SHA1CompleteExtend ((TPM_COMMAND_CODE) 0x000000A3)
1537 #define TPM_ORD_SHA1Start ((TPM_COMMAND_CODE) 0x000000A0)
1538 #define TPM_ORD_SHA1Update ((TPM_COMMAND_CODE) 0x000000A1)
1539 #define TPM_ORD_Sign ((TPM_COMMAND_CODE) 0x0000003C)
1540 #define TPM_ORD_Startup ((TPM_COMMAND_CODE) 0x00000099)
1541 #define TPM_ORD_StirRandom ((TPM_COMMAND_CODE) 0x00000047)
1542 #define TPM_ORD_TakeOwnership ((TPM_COMMAND_CODE) 0x0000000D)
1543 #define TPM_ORD_Terminate_Handle ((TPM_COMMAND_CODE) 0x00000096)
1544 #define TPM_ORD_TickStampBlob ((TPM_COMMAND_CODE) 0x000000F2)
1545 #define TPM_ORD_UnBind ((TPM_COMMAND_CODE) 0x0000001E)
1546 #define TPM_ORD_Unseal ((TPM_COMMAND_CODE) 0x00000018)
1547 #define TSC_ORD_PhysicalPresence ((TPM_COMMAND_CODE) 0x4000000A)
1548 #define TSC_ORD_ResetEstablishmentBit ((TPM_COMMAND_CODE) 0x4000000B)
1549
1550 //
1551 // Part 2, section 18: Context structures
1552 //
1553
1554 ///
1555 /// Part 2, section 18.1: TPM_CONTEXT_BLOB
1556 ///
1557 typedef struct tdTPM_CONTEXT_BLOB {
1558 TPM_STRUCTURE_TAG tag;
1559 TPM_RESOURCE_TYPE resourceType;
1560 TPM_HANDLE handle;
1561 UINT8 label[16];
1562 UINT32 contextCount;
1563 TPM_DIGEST integrityDigest;
1564 UINT32 additionalSize;
1565 UINT8 *additionalData;
1566 UINT32 sensitiveSize;
1567 UINT8 *sensitiveData;
1568 } TPM_CONTEXT_BLOB;
1569
1570 ///
1571 /// Part 2, section 18.2 TPM_CONTEXT_SENSITIVE
1572 ///
1573 typedef struct tdTPM_CONTEXT_SENSITIVE {
1574 TPM_STRUCTURE_TAG tag;
1575 TPM_NONCE contextNonce;
1576 UINT32 internalSize;
1577 UINT8 *internalData;
1578 } TPM_CONTEXT_SENSITIVE;
1579
1580 //
1581 // Part 2, section 19: NV Structures
1582 //
1583
1584 //
1585 // Part 2, section 19.1.1: Required TPM_NV_INDEX values
1586 //
1587 #define TPM_NV_INDEX_LOCK ((UINT32)0xffffffff)
1588 #define TPM_NV_INDEX0 ((UINT32)0x00000000)
1589 #define TPM_NV_INDEX_DIR ((UINT32)0x10000001)
1590 #define TPM_NV_INDEX_EKCert ((UINT32)0x0000f000)
1591 #define TPM_NV_INDEX_TPM_CC ((UINT32)0x0000f001)
1592 #define TPM_NV_INDEX_PlatformCert ((UINT32)0x0000f002)
1593 #define TPM_NV_INDEX_Platform_CC ((UINT32)0x0000f003)
1594 //
1595 // Part 2, section 19.1.2: Reserved Index values
1596 //
1597 #define TPM_NV_INDEX_TSS_BASE ((UINT32)0x00011100)
1598 #define TPM_NV_INDEX_PC_BASE ((UINT32)0x00011200)
1599 #define TPM_NV_INDEX_SERVER_BASE ((UINT32)0x00011300)
1600 #define TPM_NV_INDEX_MOBILE_BASE ((UINT32)0x00011400)
1601 #define TPM_NV_INDEX_PERIPHERAL_BASE ((UINT32)0x00011500)
1602 #define TPM_NV_INDEX_GROUP_RESV_BASE ((UINT32)0x00010000)
1603
1604 ///
1605 /// Part 2, section 19.2: TPM_NV_ATTRIBUTES
1606 ///
1607 typedef struct tdTPM_NV_ATTRIBUTES {
1608 TPM_STRUCTURE_TAG tag;
1609 UINT32 attributes;
1610 } TPM_NV_ATTRIBUTES;
1611
1612 #define TPM_NV_PER_READ_STCLEAR (BIT31)
1613 #define TPM_NV_PER_AUTHREAD (BIT18)
1614 #define TPM_NV_PER_OWNERREAD (BIT17)
1615 #define TPM_NV_PER_PPREAD (BIT16)
1616 #define TPM_NV_PER_GLOBALLOCK (BIT15)
1617 #define TPM_NV_PER_WRITE_STCLEAR (BIT14)
1618 #define TPM_NV_PER_WRITEDEFINE (BIT13)
1619 #define TPM_NV_PER_WRITEALL (BIT12)
1620 #define TPM_NV_PER_AUTHWRITE (BIT2)
1621 #define TPM_NV_PER_OWNERWRITE (BIT1)
1622 #define TPM_NV_PER_PPWRITE (BIT0)
1623
1624 ///
1625 /// Part 2, section 19.3: TPM_NV_DATA_PUBLIC
1626 ///
1627 typedef struct tdTPM_NV_DATA_PUBLIC {
1628 TPM_STRUCTURE_TAG tag;
1629 TPM_NV_INDEX nvIndex;
1630 TPM_PCR_INFO_SHORT pcrInfoRead;
1631 TPM_PCR_INFO_SHORT pcrInfoWrite;
1632 TPM_NV_ATTRIBUTES permission;
1633 BOOLEAN bReadSTClear;
1634 BOOLEAN bWriteSTClear;
1635 BOOLEAN bWriteDefine;
1636 UINT32 dataSize;
1637 } TPM_NV_DATA_PUBLIC;
1638
1639 //
1640 // Part 2, section 20: Delegate Structures
1641 //
1642
1643 #define TPM_DEL_OWNER_BITS ((UINT32)0x00000001)
1644 #define TPM_DEL_KEY_BITS ((UINT32)0x00000002)
1645 ///
1646 /// Part 2, section 20.2: Delegate Definitions
1647 ///
1648 typedef struct tdTPM_DELEGATIONS {
1649 TPM_STRUCTURE_TAG tag;
1650 UINT32 delegateType;
1651 UINT32 per1;
1652 UINT32 per2;
1653 } TPM_DELEGATIONS;
1654
1655 //
1656 // Part 2, section 20.2.1: Owner Permission Settings
1657 //
1658 #define TPM_DELEGATE_SetOrdinalAuditStatus (BIT30)
1659 #define TPM_DELEGATE_DirWriteAuth (BIT29)
1660 #define TPM_DELEGATE_CMK_ApproveMA (BIT28)
1661 #define TPM_DELEGATE_CMK_CreateTicket (BIT26)
1662 #define TPM_DELEGATE_Delegate_LoadOwnerDelegation (BIT24)
1663 #define TPM_DELEGATE_DAA_Join (BIT23)
1664 #define TPM_DELEGATE_AuthorizeMigrationKey (BIT22)
1665 #define TPM_DELEGATE_CreateMaintenanceArchive (BIT21)
1666 #define TPM_DELEGATE_LoadMaintenanceArchive (BIT20)
1667 #define TPM_DELEGATE_KillMaintenanceFeature (BIT19)
1668 #define TPM_DELEGATE_OwnerReadInteralPub (BIT18)
1669 #define TPM_DELEGATE_ResetLockValue (BIT17)
1670 #define TPM_DELEGATE_OwnerClear (BIT16)
1671 #define TPM_DELEGATE_DisableOwnerClear (BIT15)
1672 #define TPM_DELEGATE_OwnerSetDisable (BIT13)
1673 #define TPM_DELEGATE_SetCapability (BIT12)
1674 #define TPM_DELEGATE_MakeIdentity (BIT11)
1675 #define TPM_DELEGATE_ActivateIdentity (BIT10)
1676 #define TPM_DELEGATE_OwnerReadPubek (BIT9)
1677 #define TPM_DELEGATE_DisablePubekRead (BIT8)
1678 #define TPM_DELEGATE_SetRedirection (BIT7)
1679 #define TPM_DELEGATE_FieldUpgrade (BIT6)
1680 #define TPM_DELEGATE_Delegate_UpdateVerification (BIT5)
1681 #define TPM_DELEGATE_CreateCounter (BIT4)
1682 #define TPM_DELEGATE_ReleaseCounterOwner (BIT3)
1683 #define TPM_DELEGATE_DelegateManage (BIT2)
1684 #define TPM_DELEGATE_Delegate_CreateOwnerDelegation (BIT1)
1685 #define TPM_DELEGATE_DAA_Sign (BIT0)
1686
1687 //
1688 // Part 2, section 20.2.3: Key Permission settings
1689 //
1690 #define TPM_KEY_DELEGATE_CMK_ConvertMigration (BIT28)
1691 #define TPM_KEY_DELEGATE_TickStampBlob (BIT27)
1692 #define TPM_KEY_DELEGATE_ChangeAuthAsymStart (BIT26)
1693 #define TPM_KEY_DELEGATE_ChangeAuthAsymFinish (BIT25)
1694 #define TPM_KEY_DELEGATE_CMK_CreateKey (BIT24)
1695 #define TPM_KEY_DELEGATE_MigrateKey (BIT23)
1696 #define TPM_KEY_DELEGATE_LoadKey2 (BIT22)
1697 #define TPM_KEY_DELEGATE_EstablishTransport (BIT21)
1698 #define TPM_KEY_DELEGATE_ReleaseTransportSigned (BIT20)
1699 #define TPM_KEY_DELEGATE_Quote2 (BIT19)
1700 #define TPM_KEY_DELEGATE_Sealx (BIT18)
1701 #define TPM_KEY_DELEGATE_MakeIdentity (BIT17)
1702 #define TPM_KEY_DELEGATE_ActivateIdentity (BIT16)
1703 #define TPM_KEY_DELEGATE_GetAuditDigestSigned (BIT15)
1704 #define TPM_KEY_DELEGATE_Sign (BIT14)
1705 #define TPM_KEY_DELEGATE_CertifyKey2 (BIT13)
1706 #define TPM_KEY_DELEGATE_CertifyKey (BIT12)
1707 #define TPM_KEY_DELEGATE_CreateWrapKey (BIT11)
1708 #define TPM_KEY_DELEGATE_CMK_CreateBlob (BIT10)
1709 #define TPM_KEY_DELEGATE_CreateMigrationBlob (BIT9)
1710 #define TPM_KEY_DELEGATE_ConvertMigrationBlob (BIT8)
1711 #define TPM_KEY_DELEGATE_CreateKeyDelegation (BIT7)
1712 #define TPM_KEY_DELEGATE_ChangeAuth (BIT6)
1713 #define TPM_KEY_DELEGATE_GetPubKey (BIT5)
1714 #define TPM_KEY_DELEGATE_UnBind (BIT4)
1715 #define TPM_KEY_DELEGATE_Quote (BIT3)
1716 #define TPM_KEY_DELEGATE_Unseal (BIT2)
1717 #define TPM_KEY_DELEGATE_Seal (BIT1)
1718 #define TPM_KEY_DELEGATE_LoadKey (BIT0)
1719
1720 //
1721 // Part 2, section 20.3: TPM_FAMILY_FLAGS
1722 //
1723 #define TPM_DELEGATE_ADMIN_LOCK (BIT1)
1724 #define TPM_FAMFLAG_ENABLE (BIT0)
1725
1726 ///
1727 /// Part 2, section 20.4: TPM_FAMILY_LABEL
1728 ///
1729 typedef struct tdTPM_FAMILY_LABEL {
1730 UINT8 label;
1731 } TPM_FAMILY_LABEL;
1732
1733 ///
1734 /// Part 2, section 20.5: TPM_FAMILY_TABLE_ENTRY
1735 ///
1736 typedef struct tdTPM_FAMILY_TABLE_ENTRY {
1737 TPM_STRUCTURE_TAG tag;
1738 TPM_FAMILY_LABEL label;
1739 TPM_FAMILY_ID familyID;
1740 TPM_FAMILY_VERIFICATION verificationCount;
1741 TPM_FAMILY_FLAGS flags;
1742 } TPM_FAMILY_TABLE_ENTRY;
1743
1744 //
1745 // Part 2, section 20.6: TPM_FAMILY_TABLE
1746 //
1747 #define TPM_NUM_FAMILY_TABLE_ENTRY_MIN 8
1748
1749 typedef struct tdTPM_FAMILY_TABLE{
1750 TPM_FAMILY_TABLE_ENTRY famTableRow[TPM_NUM_FAMILY_TABLE_ENTRY_MIN];
1751 } TPM_FAMILY_TABLE;
1752
1753 ///
1754 /// Part 2, section 20.7: TPM_DELEGATE_LABEL
1755 ///
1756 typedef struct tdTPM_DELEGATE_LABEL {
1757 UINT8 label;
1758 } TPM_DELEGATE_LABEL;
1759
1760 ///
1761 /// Part 2, section 20.8: TPM_DELEGATE_PUBLIC
1762 ///
1763 typedef struct tdTPM_DELEGATE_PUBLIC {
1764 TPM_STRUCTURE_TAG tag;
1765 TPM_DELEGATE_LABEL label;
1766 TPM_PCR_INFO_SHORT pcrInfo;
1767 TPM_DELEGATIONS permissions;
1768 TPM_FAMILY_ID familyID;
1769 TPM_FAMILY_VERIFICATION verificationCount;
1770 } TPM_DELEGATE_PUBLIC;
1771
1772 ///
1773 /// Part 2, section 20.9: TPM_DELEGATE_TABLE_ROW
1774 ///
1775 typedef struct tdTPM_DELEGATE_TABLE_ROW {
1776 TPM_STRUCTURE_TAG tag;
1777 TPM_DELEGATE_PUBLIC pub;
1778 TPM_SECRET authValue;
1779 } TPM_DELEGATE_TABLE_ROW;
1780
1781 //
1782 // Part 2, section 20.10: TPM_DELEGATE_TABLE
1783 //
1784 #define TPM_NUM_DELEGATE_TABLE_ENTRY_MIN 2
1785
1786 typedef struct tdTPM_DELEGATE_TABLE{
1787 TPM_DELEGATE_TABLE_ROW delRow[TPM_NUM_DELEGATE_TABLE_ENTRY_MIN];
1788 } TPM_DELEGATE_TABLE;
1789
1790 ///
1791 /// Part 2, section 20.11: TPM_DELEGATE_SENSITIVE
1792 ///
1793 typedef struct tdTPM_DELEGATE_SENSITIVE {
1794 TPM_STRUCTURE_TAG tag;
1795 TPM_SECRET authValue;
1796 } TPM_DELEGATE_SENSITIVE;
1797
1798 ///
1799 /// Part 2, section 20.12: TPM_DELEGATE_OWNER_BLOB
1800 ///
1801 typedef struct tdTPM_DELEGATE_OWNER_BLOB {
1802 TPM_STRUCTURE_TAG tag;
1803 TPM_DELEGATE_PUBLIC pub;
1804 TPM_DIGEST integrityDigest;
1805 UINT32 additionalSize;
1806 UINT8 *additionalArea;
1807 UINT32 sensitiveSize;
1808 UINT8 *sensitiveArea;
1809 } TPM_DELEGATE_OWNER_BLOB;
1810
1811 ///
1812 /// Part 2, section 20.13: TTPM_DELEGATE_KEY_BLOB
1813 ///
1814 typedef struct tdTPM_DELEGATE_KEY_BLOB {
1815 TPM_STRUCTURE_TAG tag;
1816 TPM_DELEGATE_PUBLIC pub;
1817 TPM_DIGEST integrityDigest;
1818 TPM_DIGEST pubKeyDigest;
1819 UINT32 additionalSize;
1820 UINT8 *additionalArea;
1821 UINT32 sensitiveSize;
1822 UINT8 *sensitiveArea;
1823 } TPM_DELEGATE_KEY_BLOB;
1824
1825 //
1826 // Part 2, section 20.14: TPM_FAMILY_OPERATION Values
1827 //
1828 #define TPM_FAMILY_CREATE ((UINT32)0x00000001)
1829 #define TPM_FAMILY_ENABLE ((UINT32)0x00000002)
1830 #define TPM_FAMILY_ADMIN ((UINT32)0x00000003)
1831 #define TPM_FAMILY_INVALIDATE ((UINT32)0x00000004)
1832
1833 //
1834 // Part 2, section 21.1: TPM_CAPABILITY_AREA for GetCapability
1835 //
1836 #define TPM_CAP_ORD ((TPM_CAPABILITY_AREA) 0x00000001)
1837 #define TPM_CAP_ALG ((TPM_CAPABILITY_AREA) 0x00000002)
1838 #define TPM_CAP_PID ((TPM_CAPABILITY_AREA) 0x00000003)
1839 #define TPM_CAP_FLAG ((TPM_CAPABILITY_AREA) 0x00000004)
1840 #define TPM_CAP_PROPERTY ((TPM_CAPABILITY_AREA) 0x00000005)
1841 #define TPM_CAP_VERSION ((TPM_CAPABILITY_AREA) 0x00000006)
1842 #define TPM_CAP_KEY_HANDLE ((TPM_CAPABILITY_AREA) 0x00000007)
1843 #define TPM_CAP_CHECK_LOADED ((TPM_CAPABILITY_AREA) 0x00000008)
1844 #define TPM_CAP_SYM_MODE ((TPM_CAPABILITY_AREA) 0x00000009)
1845 #define TPM_CAP_KEY_STATUS ((TPM_CAPABILITY_AREA) 0x0000000C)
1846 #define TPM_CAP_NV_LIST ((TPM_CAPABILITY_AREA) 0x0000000D)
1847 #define TPM_CAP_MFR ((TPM_CAPABILITY_AREA) 0x00000010)
1848 #define TPM_CAP_NV_INDEX ((TPM_CAPABILITY_AREA) 0x00000011)
1849 #define TPM_CAP_TRANS_ALG ((TPM_CAPABILITY_AREA) 0x00000012)
1850 #define TPM_CAP_HANDLE ((TPM_CAPABILITY_AREA) 0x00000014)
1851 #define TPM_CAP_TRANS_ES ((TPM_CAPABILITY_AREA) 0x00000015)
1852 #define TPM_CAP_AUTH_ENCRYPT ((TPM_CAPABILITY_AREA) 0x00000017)
1853 #define TPM_CAP_SELECT_SIZE ((TPM_CAPABILITY_AREA) 0x00000018)
1854 #define TPM_CAP_VERSION_VAL ((TPM_CAPABILITY_AREA) 0x0000001A)
1855
1856 #define TPM_CAP_FLAG_PERMANENT ((TPM_CAPABILITY_AREA) 0x00000108)
1857 #define TPM_CAP_FLAG_VOLATILE ((TPM_CAPABILITY_AREA) 0x00000109)
1858
1859 //
1860 // Part 2, section 21.2: CAP_PROPERTY Subcap values for GetCapability
1861 //
1862 #define TPM_CAP_PROP_PCR ((TPM_CAPABILITY_AREA) 0x00000101)
1863 #define TPM_CAP_PROP_DIR ((TPM_CAPABILITY_AREA) 0x00000102)
1864 #define TPM_CAP_PROP_MANUFACTURER ((TPM_CAPABILITY_AREA) 0x00000103)
1865 #define TPM_CAP_PROP_KEYS ((TPM_CAPABILITY_AREA) 0x00000104)
1866 #define TPM_CAP_PROP_MIN_COUNTER ((TPM_CAPABILITY_AREA) 0x00000107)
1867 #define TPM_CAP_PROP_AUTHSESS ((TPM_CAPABILITY_AREA) 0x0000010A)
1868 #define TPM_CAP_PROP_TRANSESS ((TPM_CAPABILITY_AREA) 0x0000010B)
1869 #define TPM_CAP_PROP_COUNTERS ((TPM_CAPABILITY_AREA) 0x0000010C)
1870 #define TPM_CAP_PROP_MAX_AUTHSESS ((TPM_CAPABILITY_AREA) 0x0000010D)
1871 #define TPM_CAP_PROP_MAX_TRANSESS ((TPM_CAPABILITY_AREA) 0x0000010E)
1872 #define TPM_CAP_PROP_MAX_COUNTERS ((TPM_CAPABILITY_AREA) 0x0000010F)
1873 #define TPM_CAP_PROP_MAX_KEYS ((TPM_CAPABILITY_AREA) 0x00000110)
1874 #define TPM_CAP_PROP_OWNER ((TPM_CAPABILITY_AREA) 0x00000111)
1875 #define TPM_CAP_PROP_CONTEXT ((TPM_CAPABILITY_AREA) 0x00000112)
1876 #define TPM_CAP_PROP_MAX_CONTEXT ((TPM_CAPABILITY_AREA) 0x00000113)
1877 #define TPM_CAP_PROP_FAMILYROWS ((TPM_CAPABILITY_AREA) 0x00000114)
1878 #define TPM_CAP_PROP_TIS_TIMEOUT ((TPM_CAPABILITY_AREA) 0x00000115)
1879 #define TPM_CAP_PROP_STARTUP_EFFECT ((TPM_CAPABILITY_AREA) 0x00000116)
1880 #define TPM_CAP_PROP_DELEGATE_ROW ((TPM_CAPABILITY_AREA) 0x00000117)
1881 #define TPM_CAP_PROP_DAA_MAX ((TPM_CAPABILITY_AREA) 0x00000119)
1882 #define CAP_PROP_SESSION_DAA ((TPM_CAPABILITY_AREA) 0x0000011A)
1883 #define TPM_CAP_PROP_CONTEXT_DIST ((TPM_CAPABILITY_AREA) 0x0000011B)
1884 #define TPM_CAP_PROP_DAA_INTERRUPT ((TPM_CAPABILITY_AREA) 0x0000011C)
1885 #define TPM_CAP_PROP_SESSIONS ((TPM_CAPABILITY_AREA) 0x0000011D)
1886 #define TPM_CAP_PROP_MAX_SESSIONS ((TPM_CAPABILITY_AREA) 0x0000011E)
1887 #define TPM_CAP_PROP_CMK_RESTRICTION ((TPM_CAPABILITY_AREA) 0x0000011F)
1888 #define TPM_CAP_PROP_DURATION ((TPM_CAPABILITY_AREA) 0x00000120)
1889 #define TPM_CAP_PROP_ACTIVE_COUNTER ((TPM_CAPABILITY_AREA) 0x00000122)
1890 #define TPM_CAP_PROP_MAX_NV_AVAILABLE ((TPM_CAPABILITY_AREA) 0x00000123)
1891 #define TPM_CAP_PROP_INPUT_BUFFER ((TPM_CAPABILITY_AREA) 0x00000124)
1892
1893 ///
1894 /// Part 2, section 21.6: TPM_CAP_VERSION_INFO
1895 /// [size_is(vendorSpecificSize)] BYTE* vendorSpecific;
1896 ///
1897 typedef struct tdTPM_CAP_VERSION_INFO {
1898 TPM_STRUCTURE_TAG tag;
1899 TPM_VERSION version;
1900 UINT16 specLevel;
1901 UINT8 errataRev;
1902 UINT8 tpmVendorID[4];
1903 UINT16 vendorSpecificSize;
1904 UINT8 *vendorSpecific;
1905 } TPM_CAP_VERSION_INFO;
1906
1907 //
1908 // Part 2, section 22: DAA Structures
1909 //
1910
1911 //
1912 // Part 2, section 22.1: Size definitions
1913 //
1914 #define TPM_DAA_SIZE_r0 (43)
1915 #define TPM_DAA_SIZE_r1 (43)
1916 #define TPM_DAA_SIZE_r2 (128)
1917 #define TPM_DAA_SIZE_r3 (168)
1918 #define TPM_DAA_SIZE_r4 (219)
1919 #define TPM_DAA_SIZE_NT (20)
1920 #define TPM_DAA_SIZE_v0 (128)
1921 #define TPM_DAA_SIZE_v1 (192)
1922 #define TPM_DAA_SIZE_NE (256)
1923 #define TPM_DAA_SIZE_w (256)
1924 #define TPM_DAA_SIZE_issuerModulus (256)
1925 //
1926 // Part 2, section 22.2: Constant definitions
1927 //
1928 #define TPM_DAA_power0 (104)
1929 #define TPM_DAA_power1 (1024)
1930
1931 ///
1932 /// Part 2, section 22.3: TPM_DAA_ISSUER
1933 ///
1934 typedef struct tdTPM_DAA_ISSUER {
1935 TPM_STRUCTURE_TAG tag;
1936 TPM_DIGEST DAA_digest_R0;
1937 TPM_DIGEST DAA_digest_R1;
1938 TPM_DIGEST DAA_digest_S0;
1939 TPM_DIGEST DAA_digest_S1;
1940 TPM_DIGEST DAA_digest_n;
1941 TPM_DIGEST DAA_digest_gamma;
1942 UINT8 DAA_generic_q[26];
1943 } TPM_DAA_ISSUER;
1944
1945 ///
1946 /// Part 2, section 22.4: TPM_DAA_TPM
1947 ///
1948 typedef struct tdTPM_DAA_TPM {
1949 TPM_STRUCTURE_TAG tag;
1950 TPM_DIGEST DAA_digestIssuer;
1951 TPM_DIGEST DAA_digest_v0;
1952 TPM_DIGEST DAA_digest_v1;
1953 TPM_DIGEST DAA_rekey;
1954 UINT32 DAA_count;
1955 } TPM_DAA_TPM;
1956
1957 ///
1958 /// Part 2, section 22.5: TPM_DAA_CONTEXT
1959 ///
1960 typedef struct tdTPM_DAA_CONTEXT {
1961 TPM_STRUCTURE_TAG tag;
1962 TPM_DIGEST DAA_digestContext;
1963 TPM_DIGEST DAA_digest;
1964 TPM_DAA_CONTEXT_SEED DAA_contextSeed;
1965 UINT8 DAA_scratch[256];
1966 UINT8 DAA_stage;
1967 } TPM_DAA_CONTEXT;
1968
1969 ///
1970 /// Part 2, section 22.6: TPM_DAA_JOINDATA
1971 ///
1972 typedef struct tdTPM_DAA_JOINDATA {
1973 UINT8 DAA_join_u0[128];
1974 UINT8 DAA_join_u1[138];
1975 TPM_DIGEST DAA_digest_n0;
1976 } TPM_DAA_JOINDATA;
1977
1978 ///
1979 /// Part 2, section 22.8: TPM_DAA_BLOB
1980 ///
1981 typedef struct tdTPM_DAA_BLOB {
1982 TPM_STRUCTURE_TAG tag;
1983 TPM_RESOURCE_TYPE resourceType;
1984 UINT8 label[16];
1985 TPM_DIGEST blobIntegrity;
1986 UINT32 additionalSize;
1987 UINT8 *additionalData;
1988 UINT32 sensitiveSize;
1989 UINT8 *sensitiveData;
1990 } TPM_DAA_BLOB;
1991
1992 ///
1993 /// Part 2, section 22.9: TPM_DAA_SENSITIVE
1994 ///
1995 typedef struct tdTPM_DAA_SENSITIVE {
1996 TPM_STRUCTURE_TAG tag;
1997 UINT32 internalSize;
1998 UINT8 *internalData;
1999 } TPM_DAA_SENSITIVE;
2000
2001
2002 //
2003 // Part 2, section 23: Redirection
2004 //
2005
2006 ///
2007 /// Part 2 section 23.1: TPM_REDIR_COMMAND
2008 /// This section defines exactly one value but does not
2009 /// give it a name. The definition of TPM_SetRedirection in Part3
2010 /// refers to exactly one name but does not give its value. We join
2011 /// them here.
2012 ///
2013 #define TPM_REDIR_GPIO (0x00000001)
2014
2015 ///
2016 /// TPM Command Headers defined in Part 3
2017 ///
2018 typedef struct tdTPM_RQU_COMMAND_HDR {
2019 TPM_STRUCTURE_TAG tag;
2020 UINT32 paramSize;
2021 TPM_COMMAND_CODE ordinal;
2022 } TPM_RQU_COMMAND_HDR;
2023
2024 ///
2025 /// TPM Response Headers defined in Part 3
2026 ///
2027 typedef struct tdTPM_RSP_COMMAND_HDR {
2028 TPM_STRUCTURE_TAG tag;
2029 UINT32 paramSize;
2030 TPM_RESULT returnCode;
2031 } TPM_RSP_COMMAND_HDR;
2032
2033 #pragma pack ()
2034
2035 #endif