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