You are on page 1of 215

TPM Main

Part 3 Commands
Specification Version 1.2
Level 2 Revision 85
13 February 2005
Published

Contact: tpmwg@trustedcomputinggroup.org

TCG PUBLISHED
Copyright © TCG 2003

TCG
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

Copyright © 2003 Trusted Computing Group, Incorporated.

Disclaimer
THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO WARRANTIES WHATSOEVER,
INCLUDING ANY WARRANTY OF MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR
ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY
PROPOSAL, SPECIFICATION OR SAMPLE. Without limitation, TCG disclaims all liability,
including liability for infringement of any proprietary rights, relating to use of information in
this specification and to the implementation of this specification, and TCG disclaims all
liability for cost of procurement of substitute goods or services, lost profits, loss of use, loss
of data or any incidental, consequential, direct, indirect, or special damages, whether under
contract, tort, warranty or otherwise, arising in any way out of use or reliance upon this
specification or any information herein.
No license, express or implied, by estoppel or otherwise, to any TCG or TCG member
intellectual property rights is granted herein.

Except that a license is hereby granted by TCG to copy and reproduce this
specification for internal use only.
Contact the Trusted Computing Group at www.trustedcomputinggroup.org for information
on specification licensing through membership agreements.
Any marks and brands contained herein are the property of their respective owners.

ii Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

Acknowledgement

TCG wishes to thank all those who contributed to this specification. This version builds on
the work published in version 1.1 and those who helped on that version have helped on this
version.
A special thank you goes to the members of the TPM workgroup who had early access to
this version and made invaluable contributions, corrections and support.
David Grawrock
TPM Workgroup chair

Level 2 Revision 85 13 February 2005 Published iii


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

Change History
Version Date Description
Rev 50 Jul 2003 Started 01 Jul 2003 by David Grawrock
Breakup into parts and the merge of 1.1 commands
Rev 63 Oct 2003 Change history tied to part 1 and kept in part 1 (DP)
Rev 71 Mar 2004 Change in terms from authorization data to AuthData.

iv Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

Level 2 Revision 85 13 February 2005 Published v


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

vi Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

Table of Contents
1. Scope and Audience......................................................................................................................................... 3
1.1 Key words.............................................................................................................................................. 3
1.2 Statement Type ..................................................................................................................................... 3
2. Description and TODO ..................................................................................................................................... 3
3. Admin Startup and State................................................................................................................................... 3
3.1 TPM_Init ................................................................................................................................................ 3
3.2 TPM_Startup ......................................................................................................................................... 3
3.3 TPM_SaveState .................................................................................................................................... 3
4. Admin Testing ................................................................................................................................................... 3
4.1 TPM_SelfTestFull.................................................................................................................................. 3
4.2 TPM_ContinueSelfTest ......................................................................................................................... 3
4.3 TPM_GetTestResult.............................................................................................................................. 3
5. Admin Opt-in ..................................................................................................................................................... 3
5.1 TPM_SetOwnerInstall ........................................................................................................................... 3
5.2 TPM_OwnerSetDisable......................................................................................................................... 3
5.3 TPM_PhysicalEnable ............................................................................................................................ 3
5.4 TPM_PhysicalDisable ........................................................................................................................... 3
5.5 TPM_PhysicalSetDeactivated............................................................................................................... 3
5.6 TPM_SetTempDeactivated ................................................................................................................... 3
5.7 TPM_SetOperatorAuth.......................................................................................................................... 3
6. Admin Ownership.............................................................................................................................................. 3
6.1 TPM_TakeOwnership ........................................................................................................................... 3
6.2 TPM_OwnerClear.................................................................................................................................. 3
6.3 TPM_ForceClear ................................................................................................................................... 3
6.4 TPM_DisableOwnerClear ..................................................................................................................... 3
6.5 TPM_DisableForceClear ....................................................................................................................... 3
6.6 TSC_PhysicalPresence ........................................................................................................................ 3
6.7 TSC_ResetEstablishmentBit................................................................................................................. 3
7. The GetCapability Commands.......................................................................................................................... 3
7.1 TPM_GetCapability ............................................................................................................................... 3
7.2 TPM_SetCapability................................................................................................................................ 3
8. Auditing ............................................................................................................................................................. 3
8.1 Audit Generation ................................................................................................................................... 3
8.2 Effect of audit failing after completion of a command ........................................................................... 3
8.3 TPM_GetAuditDigest ............................................................................................................................ 3

Level 2 Revision 85 13 February 2005 Published vii


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

8.4 TPM_GetAuditDigestSigned ................................................................................................................. 3


8.5 TPM_SetOrdinalAuditStatus ................................................................................................................. 3
9. Administrative Functions - Management .......................................................................................................... 3
9.1 TPM_FieldUpgrade ............................................................................................................................... 3
9.2 TPM_SetRedirection ............................................................................................................................. 3
9.3 TPM_ResetLockValue .......................................................................................................................... 3
10. Storage functions .............................................................................................................................................. 3
10.1 TPM_Seal.............................................................................................................................................. 3
10.2 TPM_Unseal.......................................................................................................................................... 3
10.3 TPM_UnBind ......................................................................................................................................... 3
10.4 TPM_CreateWrapKey ........................................................................................................................... 3
10.5 TPM_LoadKey2..................................................................................................................................... 3
10.6 TPM_GetPubKey .................................................................................................................................. 3
10.7 TPM_Sealx............................................................................................................................................ 3
11. Migration ........................................................................................................................................................... 3
11.1 TPM_CreateMigrationBlob.................................................................................................................... 3
11.2 TPM_ConvertMigrationBlob .................................................................................................................. 3
11.3 TPM_AuthorizeMigrationKey ................................................................................................................ 3
11.4 TPM_MigrateKey................................................................................................................................... 3
11.5 TPM_CMK_SetRestrictions .................................................................................................................. 3
11.6 TPM_CMK_ApproveMA ........................................................................................................................ 3
11.7 TPM_CMK_CreateKey.......................................................................................................................... 3
11.8 TPM_CMK_CreateTicket ...................................................................................................................... 3
11.9 TPM_CMK_CreateBlob......................................................................................................................... 3
11.10 TPM_CMK_ConvertMigration ............................................................................................................... 3
12. Maintenance Functions (optional)..................................................................................................................... 3
12.1 TPM_CreateMaintenanceArchive ......................................................................................................... 3
12.2 TPM_LoadMaintenanceArchive ............................................................................................................ 3
12.3 TPM_KillMaintenanceFeature............................................................................................................... 3
12.4 TPM_LoadManuMaintPub .................................................................................................................... 3
12.5 TPM_ReadManuMaintPub.................................................................................................................... 3
13. Cryptographic Functions ................................................................................................................................... 3
13.1 TPM_SHA1Start.................................................................................................................................... 3
13.2 TPM_SHA1Update................................................................................................................................ 3
13.3 TPM_SHA1Complete ............................................................................................................................ 3
13.4 TPM_SHA1CompleteExtend................................................................................................................. 3
13.5 TPM_Sign.............................................................................................................................................. 3

viii Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

13.6 TPM_GetRandom ................................................................................................................................. 3


13.7 TPM_StirRandom.................................................................................................................................. 3
13.8 TPM_CertifyKey .................................................................................................................................... 3
13.9 TPM_CertifyKey2 .................................................................................................................................. 3
14. Endorsement Key Handling .............................................................................................................................. 3
14.1 TPM_CreateEndorsementKeyPair........................................................................................................ 3
14.2 TPM_CreateRevocableEK .................................................................................................................... 3
14.3 TPM_RevokeTrust ................................................................................................................................ 3
14.4 TPM_ReadPubek .................................................................................................................................. 3
14.5 TPM_OwnerReadInternalPub ............................................................................................................... 3
15. Identity Creation and Activation ........................................................................................................................ 3
15.1 TPM_MakeIdentity ................................................................................................................................ 3
15.2 TPM_ActivateIdentity ............................................................................................................................ 3
16. Integrity Collection and Reporting..................................................................................................................... 3
16.1 TPM_Extend.......................................................................................................................................... 3
16.2 TPM_PCRRead..................................................................................................................................... 3
16.3 TPM_Quote ........................................................................................................................................... 3
16.4 TPM_PCR_Reset.................................................................................................................................. 3
16.5 TPM_Quote2 ......................................................................................................................................... 3
17. Changing AuthData........................................................................................................................................... 3
17.1 TPM_ChangeAuth................................................................................................................................. 3
17.2 TPM_ChangeAuthOwner ...................................................................................................................... 3
18. Authorization Sessions ..................................................................................................................................... 3
18.1 TPM_OIAP ............................................................................................................................................ 3
18.1.1 Actions to validate an OIAP session .............................................................................................. 3
18.2 TPM_OSAP........................................................................................................................................... 3
18.2.1 Actions to validate an OSAP session............................................................................................. 3
18.3 TPM_DSAP ........................................................................................................................................... 3
18.4 TPM_SetOwnerPointer ......................................................................................................................... 3
19. Delegation Commands ..................................................................................................................................... 3
19.1 TPM_Delegate_Manage ....................................................................................................................... 3
19.2 TPM_Delegate_CreateKeyDelegation .................................................................................................. 3
19.3 TPM_Delegate_CreateOwnerDelegation ............................................................................................. 3
19.4 TPM_Delegate_LoadOwnerDelegation ................................................................................................ 3
19.5 TPM_Delegate_ReadTable................................................................................................................... 3
19.6 TPM_Delegate_UpdateVerification....................................................................................................... 3
19.7 TPM_Delegate_VerifyDelegation.......................................................................................................... 3

Level 2 Revision 85 13 February 2005 Published ix


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

20. Non-volatile Storage ......................................................................................................................................... 3


20.1 TPM_NV_DefineSpace ......................................................................................................................... 3
20.2 TPM_NV_WriteValue ............................................................................................................................ 3
20.3 TPM_NV_WriteValueAuth..................................................................................................................... 3
20.4 TPM_NV_ReadValue ............................................................................................................................ 3
20.5 TPM_NV_ReadValueAuth .................................................................................................................... 3
21. Session Management ....................................................................................................................................... 3
21.1 TPM_KeyControlOwner ........................................................................................................................ 3
21.2 TPM_SaveContext ................................................................................................................................ 3
21.3 TPM_LoadContext ................................................................................................................................ 3
22. Eviction ............................................................................................................................................................. 3
22.1 TPM_FlushSpecific ............................................................................................................................... 3
23. Timing Ticks...................................................................................................................................................... 3
23.1 TPM_GetTicks....................................................................................................................................... 3
23.2 TPM_TickStampBlob ............................................................................................................................ 3
24. Transport Sessions ........................................................................................................................................... 3
24.1 TPM_EstablishTransport....................................................................................................................... 3
24.2 TPM_ExecuteTransport ........................................................................................................................ 3
24.3 TPM_ReleaseTransportSigned............................................................................................................. 3
25. Monotonic Counter............................................................................................................................................ 3
25.1 TPM_CreateCounter ............................................................................................................................. 3
25.2 TPM_IncrementCounter ........................................................................................................................ 3
25.3 TPM_ReadCounter ............................................................................................................................... 3
25.4 TPM_ReleaseCounter........................................................................................................................... 3
25.5 TPM_ReleaseCounterOwner ................................................................................................................ 3
26. DAA commands ................................................................................................................................................ 3
26.1 TPM_DAA_Join..................................................................................................................................... 3
26.2 TPM_DAA_Sign .................................................................................................................................... 3
27. Deprecated commands..................................................................................................................................... 3
27.1 Key commands...................................................................................................................................... 3
27.1.1 TPM_EvictKey................................................................................................................................ 3
27.1.2 TPM_Terminate_Handle................................................................................................................ 3
27.2 Context management............................................................................................................................ 3
27.2.1 TPM_SaveKeyContext................................................................................................................... 3
27.2.2 TPM_LoadKeyContext................................................................................................................... 3
27.2.3 TPM_SaveAuthContext ................................................................................................................. 3
27.2.4 TPM_LoadAuthContext.................................................................................................................. 3

x Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

27.3 DIR commands...................................................................................................................................... 3


27.3.1 TPM_DirWriteAuth ......................................................................................................................... 3
27.3.2 TPM_DirRead ................................................................................................................................ 3
27.4 Change Auth ......................................................................................................................................... 3
27.4.1 TPM_ChangeAuthAsymStart......................................................................................................... 3
27.4.2 TPM_ChangeAuthAsymFinish....................................................................................................... 3
27.5 TPM_Reset ........................................................................................................................................... 3
27.6 TPM_CertifySelfTest ............................................................................................................................. 3
27.7 TPM_OwnerReadPubek ....................................................................................................................... 3
27.8 TPM_DisablePubekRead...................................................................................................................... 3
27.9 TPM_LoadKey....................................................................................................................................... 3
28. Deleted Commands .......................................................................................................................................... 3
28.1 TPM_GetCapabilityOwner .................................................................................................................... 3
28.2 TPM_GetCapabilitySigned.................................................................................................................... 3
28.3 TPM_GetOrdinalAuditStatus................................................................................................................. 3
End of Introduction do not delete

Level 2 Revision 85 13 February 2005 Published xi


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1 1. Scope and Audience


2 The TPCA main specification is an industry specification that enables trust in computing
3 platforms in general. The main specification is broken into parts to make the role of each
4 document clear. A version of the specification (like 1.2) requires all parts to be a complete
5 specification.
6 This is Part 3 the structures that the TPM will use.
7 This document is an industry specification that enables trust in computing platforms in
8 general.

Level 2 Revision 85 13 February 2005 Published 1


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

9 1.1 Key words


10 The key words “MUST,” “MUST NOT,” “REQUIRED,” “SHALL,” “SHALL NOT,” “SHOULD,”
11 “SHOULD NOT,” “RECOMMENDED,” “MAY,” and “OPTIONAL” in the chapters 2-10
12 normative statements are to be interpreted as described in [RFC-2119].

2 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

13 1.2 Statement Type


14 Please note a very important distinction between different sections of text throughout this
15 document. You will encounter two distinctive kinds of text: informative comment and
16 normative statements. Because most of the text in this specification will be of the kind
17 normative statements, the authors have informally defined it as the default and, as such,
18 have specifically called out text of the kind informative comment. They have done this by
19 flagging the beginning and end of each informative comment and highlighting its text in
20 gray. This means that unless text is specifically marked as of the kind informative
21 comment, you can consider it of the kind normative statements.
22 For example:
23 Start of informative comment:
24 This is the first paragraph of 1–n paragraphs containing text of the kind informative
25 comment ...
26 This is the second paragraph of text of the kind informative comment ...
27 This is the nth paragraph of text of the kind informative comment ...
28 To understand the TPM specification the user must read the specification. (This use of
29 MUST does not require any action).
30 End of informative comment.
31 This is the first paragraph of one or more paragraphs (and/or sections) containing the text
32 of the kind normative statements ...
33 To understand the TPM specification the user MUST read the specification. (This use of
34 MUST indicates a keyword usage and requires an action).

Level 2 Revision 85 13 February 2005 Published 3


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

35 2. Description and TODO


36 This document is to show the changes necessary to create the 1.2 version of the TCG
37 specification. Some of the sections are brand new text; some are rewritten sections of the
38 1.1 version. Upon approval of the 1.2 changes, there will be a merging of the 1.1 and 1.2
39 versions to create a single 1.2 document.

4 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

40 3. Admin Startup and State


41 Start of informative comment:
42 This section is the commands that start a TPM.
43 End of informative comment.

44 3.1 TPM_Init
45 Start of informative comment:
46 TPM_Init is a physical method of initializing a TPM. There is no TPM_Init ordinal as this is a
47 platform message sent on the platform internals to the TPM. On a PC this command arrives
48 at the TPM via the LPC bus and informs the TPM that the platform is performing a boot
49 process.
50 TPM_Init puts the TPM into a state where it waits for the command TPM_Startup (which
51 specifies the type of initialization that is required.
52 End of informative comment.

53 Definition
54 TPM_Init();
55
56 Operation of the TPM. This is not a command that any software can execute. It is inherent
57 in the design of the TPM and the platform that the TPM resides on.

58 Parameters
59 None

60 Description
61 1. The TPM_Init signal indicates to the TPM that platform initialization is taking place. The
62 TPM SHALL set the TPM into a state such that the only legal command to receive after
63 the TPM_Init is the TPM_Startup command. The TPM_Startup will further indicate to the
64 TPM how to handle and initialize the TPM resources.
65 2. The platform design MUST be that the TPM is not the only component undergoing
66 initialization. If the TPM_Init signal forces the TPM to perform initialization then the
67 platform MUST ensure that ALL components of the platform receive an initialization
68 signal. This is to prevent an attacker from causing the TPM to initialize to a state where
69 various masquerades are allowable. For instance, on a PC causing the TPM to initialize
70 and expect measurements in PCR0 but the remainder of the platform does not initialize.
71 3. The design of the TPM MUST be such that the ONLY mechanism that signals TPM_Init
72 also signals initialization to the other platform components.

73 Actions
74 1. The TPM sets TPM_STANY_FLAGS -> postInitialise to TRUE.

Level 2 Revision 85 13 February 2005 Published 5


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

75 3.2 TPM_Startup
76 Start of informative comment:
77 TPM_Startup is always preceded by TPM_Init, which is the physical indication (a system-
78 wide reset) that TPM initialization is necessary.
79 There are many events on a platform that can cause a reset and the response to these
80 events can require different operations to occur on the TPM. The mere reset indication does
81 not contain sufficient information to inform the TPM as to what type of reset is occurring.
82 Additional information known by the platform initialization code needs transmitting to the
83 TPM. The TPM_Startup command provides the mechanism to transmit the information.
84 The TPM can startup in three different modes:
85 A “clear” start where all variables go back to their default or non-volatile set state
86 A “save” start where the TPM recovers appropriate information and restores various values
87 based on a prior TPM_SaveState. This recovery requires an invocation of TPM_Init to be
88 successful.
89 A “deactivated” start where the TPM turns itself off and requires another TPM_Init before
90 the TPM will execute in a fully operational state.
91 End of informative comment.

92 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Startup
4 2 TPM_STARTUP_TYPE startupType Type of startup that is occurring

93 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

94 Description
95 TPM_Startup MUST be generated by a trusted entity (the RTM or the TPM, for example).

96 Actions
97 1. If TPM_STANY_FLAGS -> postInitialise is FALSE,
98 a. Then the TPM MUST return TPM_INVALID_POSTINIT, and exit this capability
99 2. If stType = TPM_ST_CLEAR

6 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

100 a. Ensure that sessions associated with resources TPM_RT_CONTEXT, TPM_RT_AUTH


101 and TPM_RT_TRANS are invalidated
102 b. Reset PCR values to each correct default value
103 i. pcrReset is FALSE, set to 0x00..00
104 ii. pcrReset is TRUE, set to 0xFF..FF
105 c. Set the following TPM_STCLEAR_FLAGS to their default state
106 i. PhysicalPresence
107 ii. PhysicalPresenceLock
108 iii. disableForceClear
109 d. The TPM MAY initialize auditDigest to NULL
110 i. If not initialized to NULL the TPM SHALL ensure that auditDigest contains a valid
111 value
112 ii. If initialization fails the TPM SHALL set auditDigest to NULL and SHALL set the
113 internal TPM state so that the TPM returns TPM_FAILEDSELFTEST to all
114 subsequent commands.
115 e. The TPM SHALL set TPM_STCLEAR_FLAGS -> deactivated to the same state as
116 TPM_PERMANENT_FLAGS -> deactivated
117 f. The TPM MUST set the TPM_STANY_DATA fields to:
118 i. TPM_STANY_DATA->contextNonceSession is set to NULLS
119 ii. TPM_STANY_DATA->contextCount is set to 0
120 iii. TPM_STANY_DATA->contextList is set to 0
121 g. The TPM MUST set TPM_STCLEAR_DATA fields to:
122 i. Invalidate contextNonceKey
123 ii. countID to NULL
124 iii. OwnerReference to TPM_KH_OWNER
125 h. The TPM MUST set the following TPM_STCLEAR_FLAGS to
126 i. bGlobalLock to FALSE
127 i. Determine which keys should remain in the TPM
128 i. For each key that has a valid preserved value in the TPM
129 ii. if parentPCRStatus is TRUE then call TPM_FlushSpecific(keyHandle)
130 iii. if IsVolatile is TRUE then call TPM_FlushSpecific(keyHandle)
131 iv. Keys under control of the OwnerEvict flag MUST stay resident in the TPM
132 j. The TPM MUST ensure that state associated with TPM_SaveState is invalidated
133 3. If stType = TPM_ST_STATE
134 a. If the TPM has no state to restore the TPM MUST set the internal state such that it
135 returns TPM_FAILEDSELFTEST to all subsequent commands

Level 2 Revision 85 13 February 2005 Published 7


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

136 b. The TPM MAY determine for each session type (authorization, transport…) to release
137 or maintain the session information. The TPM reports how it manages sessions in the
138 GetCapability command.
139 c. The TPM SHALL take all necessary actions to ensure that all PCRs contain valid
140 preserved values. If the TPM is unable to successfully complete these actions, it
141 SHALL enter the TPM failure mode.
142 i. For resettable PCR the TPM MUST set the value of the PCR to the resettable PCR
143 default value. The TPM MUST NOT restore a resettable PCR to a preserved value
144 d. The TPM MAY initialize auditDigest to NULL
145 i. Otherwise, the TPM SHALL take all actions necessary to ensure that auditDigest
146 contains a valid value. If the TPM is unable to successfully complete these
147 actions, the TPM SHALL initialize auditDigest to NULL and SHALL set the internal
148 set such that the TPM returns TPM_FAILEDSELFTEST to all subsequent
149 commands.
150 e. The TPM MUST restore the following flags to their preserved states:
151 i. All values in TPM_STCLEAR_FLAGS
152 ii. All values in TPM_STCLEAR_DATA
153 f. The TPM MUST restore all keys that have a valid preserved value
154 g. The TPM resumes normal operation. If the TPM is unable to resume normal
155 operation, it SHALL enter the TPM failure mode.
156 4. If stType = TPM_ST_DEACTIVATED
157 a. Invalidate sessions
158 i. Ensure that all resources associated with saved and active sessions are
159 invalidated
160 b. The TPM MUST set TPM_STCLEAR_FLAGS -> deactivated to TRUE
161 c. The TPM MUST invalidate any explicitly preserved state
162 i. The TPM MUST ensure that state associated with TPM_SaveState is invalidated
163 5. The TPM MUST set TPM_STANY_FLAGS -> postInitialise to FALSE

8 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

164 3.3 TPM_SaveState


165 Start of informative comment:
166 This warns a TPM to save some state information.
167 If the relevant shielded storage is non-volatile, this command need have no effect.
168 If the relevant shielded storage is volatile and the TPM alone is unable to detect the loss of
169 external power in time to move data to non-volatile memory, this command should be
170 presented before the TPM enters a low or no power state.
171 End of informative comment.

172 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SaveState.

173 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

174 Description
175 1. Preserved values MUST be non-volatile.
176 2. If data is never stored in a volatile medium, that data MAY be used as preserved data. In
177 such cases, no explicit action may be required to preserve that data.
178 3. If an explicit action is required to preserve data, it MUST be possible for the TPM to
179 determine whether preserved data is valid.
180 4. If the parameter mirrored by a preserved value is altered, the preserved value MUST be
181 declared invalid. If the parameter mirrored by any preserved value is altered, all
182 preserved values MAY be declared invalid.

183 Actions
184 1. Store PCR contents except for
185 a. If the PCR attribute pcrReset is TRUE
186 b. Any platform identified debug PCR
187 2. The auditDigest MUST be handled according to the audit requirements as reported by
188 TPM_GetCapability

Level 2 Revision 85 13 February 2005 Published 9


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

189 3. All values in TPM_STCLEAR_DATA MUST be preserved


190 4. All values in TPM_STCLEAR_FLAGS MUST be preserved
191 5. The contents of any key that is currently loaded SHOULD be preserved if the key's
192 parentPCRStatus indicator is FALSE and its IsVolatile indicator is FALSE.
193 6. The contents of any key that has TPM_KEY_CONTROL_OWNER_EVICT set MUST be
194 preserved
195 7. The contents of any key that is currently loaded MAY be preserved as reported by
196 TPM_GetCapability
197 8. The contents of sessions (authorization, transport etc.) MAY be preserved as reported by
198 TPM_GetCapability

10 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

199 4. Admin Testing


200 4.1 TPM_SelfTestFull
201 Start of informative comment:
202 SelfTestFull tests all of the TPM capabilities.
203 End of informative comment.

204 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SelfTestFull

205 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

206 Actions
207 1. TPM_SelfTestFull SHALL cause a TPM to perform self-test of each TPM internal function.
208 2. Failure of any test results in overall failure, and the TPM goes into failure mode.

Level 2 Revision 85 13 February 2005 Published 11


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

209 4.2 TPM_ContinueSelfTest


210 Start of informative comment:
211 ContinueSelfTest informs the TPM that it may complete the self test of all TPM functions.
212 End of informative comment.

213 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_ContinueSelfTest

214 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

215 Actions
216 1. If TPM_PERMANENT_FLAGS -> FIPS is TRUE
217 a. The TPM MUST run ALL self-tests
218 2. Else
219 a. The TPM MUST complete all self-tests that are outstanding
220 i. Instead of completing all outstanding self-tests the TPM MAY run all self-tests
221 3. The TPM SHALL immediately respond to the caller with a return code.
222 a. When TPM_ContinueSelfTest finishes execution, it SHALL NOT respond to the caller
223 with a return code.
224 4. The TPM SHALL unilaterally execute the functions of TPM_ContinueSelfTest upon
225 receipt of a command that calls a capability-X that uses untested TPM functions. If the
226 self-test fails, the TPM SHALL return the error code TPM_FAILEDSELFTEST. If the self-
227 test passes, the TPM SHALL execute capability-X.

12 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

228 4.3 TPM_GetTestResult


229 Start of informative comment:
230 TPM_GetTestResult provides manufacturer specific information regarding the results of the
231 self test. This command will work when the TPM is in self test failure mode. The reason for
232 allowing this command to operate in the failure mode is to allow TPM manufacturers to
233 obtain diagnostic information.
234 End of informative comment.

235 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_GetTestResult

236 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 4 UINT32 outDataSize The size of the outData area
5 <> BYTE[] outData The outData this is manufacturer specific

237 Actions
238 1. The TPM SHALL respond to this command with a manufacturer specific block of
239 information that describes the result of the latest self-test
240 a. The TPM MAY respond to this command prior to the successful invocation of
241 TPM_Startup
242 b. The TPM MAY respond to this command irrespective of the value of
243 TPM_STANY_FLAGS -> postInitialize
244 2. The information MUST NOT contain any data that uniquely identifies an individual TPM.

Level 2 Revision 85 13 February 2005 Published 13


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

245 5. Admin Opt-in


246 5.1 TPM_SetOwnerInstall
247 Start of informative comment:
248 When enabled but without an owner this command sets the PERMANENT flag that allows or
249 disallows the ability to insert an owner.
250 End of informative comment.

251 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_SetOwnerInstall
4 1 BOOL state State to which ownership flag is to be set.

252 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

253 Action
254 1. If the TPM has a current owner, this command immediately returns with
255 TPM_SUCCESS.
256 2. The TPM validates the assertion of physical access. The TPM then sets the value of
257 TPM_PERMANENT_FLAGS -> ownership to the value in state.

14 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

258 5.2 TPM_OwnerSetDisable


259 Start of informative comment:
260 The TPM owner sets the PERMANENT disable flag
261 End of informative comment.

262 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_OwnerSetDisable
4 1 2S 1 BOOL disableState Value for disable state – enable if TRUE

5 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
6 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and owner authentication.
8 20 TPM_AUTHDATA ownerAuth
HMAC key: ownerAuth.

263 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_OwnerSetDisable

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
6 20 TPM_AUTHDATA resAuth
ownerAuth.

264 Action
265 1. The TPM SHALL authenticate the command as coming from the TPM Owner. If
266 unsuccessful, the TPM SHALL return TPM_BAD_AUTH.
267 2. The TPM SHALL set the TPM_PERMANENT_FLAGS -> disable flag to the value in the
268 disableState parameter.

Level 2 Revision 85 13 February 2005 Published 15


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

269 5.3 TPM_PhysicalEnable


270 Start of informative comment:
271 Sets the PERMANENT disable flag to FALSE using physical presence as authorization.
272 End of informative comment.

273 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_PhysicalEnable

274 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

275 Action
276 1. Validate that physical presence is being asserted, if not return TPM_BAD_PRESENCE
277 2. The TPM SHALL set the TPM_PERMANENT_FLAGS.disable value to FALSE.

16 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

278 5.4 TPM_PhysicalDisable


279 Start of informative comment:
280 Sets the PERMANENT disable flag to TRUE using physical presence as authorization
281 End of informative comment.

282 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_PhysicalDisable

283 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

284 Action
285 1. Validate that physical presence is being asserted, if not return TPM_BAD_PRESENCE
286 2. The TPM SHALL set the TPM_PERMANENT_FLAGS.disable value to TRUE.

Level 2 Revision 85 13 February 2005 Published 17


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

287 5.5 TPM_PhysicalSetDeactivated


288 Start of informative comment:
289 Enables the TPM using physical presence as authorization.
290 End of informative comment.

291 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_PhysicalSetDeactivated
4 1 BOOL state State to which deactivated flag is to be set.

292 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

293 Action
294 1. Validate that physical presence is being asserted, if not return TPM_BAD_PRESENCE
295 2. The TPM SHALL set the TPM_PERMANENT_FLAGS.deactivated flag to the value in the
296 state parameter.

18 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

297 5.6 TPM_SetTempDeactivated


298 Start of informative comment:
299 This command allows the operator of the platform to deactivate the TPM until the next boot
300 of the platform.
301 This command requires operator authentication. The operator can provide the
302 authentication by either the assertion of physical presence or presenting the operator
303 AuthData value.
304 End of informative comment.

305 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_SetTempDeactivated

4 4 4 TPM_AUTHHANDLE authHandle Auth handle for operation validation. Session type MUST be OIAP
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
5 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
7 20 TPM_AUTHDATA operatorAuth HMAC key: operatorAuth

306 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_SetTempDeactivated

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
6 20 TPM_AUTHDATA resAuth
operatorAuth.

307 Action
308 1. If tag = TPM_TAG_REQ_AUTH1_COMMAND
309 a. If TPM_PERMANENT_FLAGS -> operator is FALSE return TPM_NOOPERATOR
310 b. Validate command and parameters using operatorAuth, on error return
311 TPM_AUTHFAIL
312 2. Else

Level 2 Revision 85 13 February 2005 Published 19


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

313 a. If physical presence is not asserted the TPM MUST return TPM_BAD_PRESENCE
314 3. The TPM SHALL set the TPM_STCLEAR_FLAGS.deactivated flag to the value TRUE.

20 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

315 5.7 TPM_SetOperatorAuth


316 Start of informative comment:
317 This command allows the setting of the operator AuthData value.
318 There is no confidentiality applied to the operator authentication as the value is sent under
319 the assumption of being local to the platform. If there is a concern regarding the path
320 between the TPM and the keyboard then unless the keyboard is using encryption and a
321 secure channel an attacker can read the values.
322 End of informative comment.

323 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_SetOperatorAuth
4 20 TPM_SECRET operatorAuth The operator AuthData

324 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

325 Action
326 1. If physical presence is not asserted the TPM MUST return TPM_BAD_PRESENCE
327 2. The TPM SHALL set the TPM_PERMANENT_DATA -> operatorAuth
328 3. The TPM SHALL set TPM_PERMANENT_FLAGS -> operator to TRUE

Level 2 Revision 85 13 February 2005 Published 21


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

329 6. Admin Ownership


330 6.1 TPM_TakeOwnership
331 Start of informative comment:
332 This command inserts the TPM Ownership value into the TPM.
333 End of informative comment.

334 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_TakeOwnership
4 2 2S 2 TPM_PROTOCOL_ID protocolID The ownership protocol in use.
5 4 3S 4 UINT32 encOwnerAuthSize The size of the encOwnerAuth field
6 <> 4S <> BYTE[ ] encOwnerAuth The owner AuthData encrypted with PUBEK
7 4 5S 4 UINT32 encSrkAuthSize The size of the encSrkAuth field
8 <> 6S <> BYTE[ ] encSrkAuth The SRK AuthData encrypted with PUBEK
Structure containing all parameters of new SRK. pubKey.keyLength &
9 <> 7S <> TPM_KEY srkParams
encSize are both 0. This structure MAY be TPM_KEY2

10 4 TPM_AUTHHANDLE authHandle The authorization session handle used for this command
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
11 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
12 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
Authorization session digest for input params. HMAC key: the new
13 20 TPM_AUTHDATA ownerAuth
ownerAuth value. See actions for validation operations

335

22 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

336 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_TakeOwnership
Structure containing all parameters of new SRK. srkPub.encData is set to
4 <> 3S <> TPM_KEY srkPub
0.

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
7 20 TPM_AUTHDATA resAuth
the new ownerAuth value

337 Actions
338 1. If TPM_PERMANENT_DATA -> ownerAuth is valid return TPM_OWNER_SET
339 2. If TPM_PERMANENT_FLAGS -> ownership is FALSE return TPM_INSTALL_DISABLED
340 3. If TPM_PERMANENT_DATA -> endorsementKey is invalid return
341 TPM_NO_ENDORSEMENT
342 4. Verify that authHandle is of type OIAP on error return TPM_AUTHFAIL
343 5. Create A1 a TPM_SECRET by decrypting EncOwnerAuth using PRIVEK as the key
344 a. This requires that A1 was encrypted using the PUBEK
345 b. Validate that A1 is a length of 20 bytes, on error return TPM_BAD_KEY_PROPERTY
346 6. Validate the command and parameters using A1 and ownerAuth, on error return
347 TPM_AUTHFAIL
348 7. Validate srkParams
349 a. If srkParams -> keyUsage is not TPM_KEY_STORAGE return
350 TPM_INVALID_KEYUSAGE
351 b. If srkParams -> migratable is TRUE return TPM_INVALID_KEYUSAGE
352 c. If srkParams -> algorithmParms -> algorithmID is NOT TPM_ALG_RSA return
353 TPM_BAD_KEY_PROPERTY
354 d. If srkParams -> algorithmParms -> encScheme is NOT
355 TPM_ES_RSAESOAEP_SHA1_MGF1 return TPM_BAD_KEY_PROPERTY
356 e. If srkParams -> algorithmParms -> sigScheme is NOT TPM_SS_NONE return
357 TPM_BAD_KEY_PROPERTY
358 f. If srkParams -> algorithmParms -> parms -> keyLength MUST be greater than or
359 equal to 2048, on error return TPM_BAD_KEY_PROPERTY
360 8. Generate K1 according to the srkParams on error return TPM_BAD_KEY_PROPERTY

Level 2 Revision 85 13 February 2005 Published 23


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

361 9. Create A2 a TPM_SECRET by decrypting EncSrkAuth using the PRIVEK


362 a. This requires A2 to be encrypted using the PUBEK
363 b. Validate that A2 is a length of 20 bytes, on error return TPM_BAD_KEY_PROPERTY
364 c. Store A2 in K1 -> usageAuth
365 10. Store K1 in TPM_PERMANENT_DATA -> srk
366 11. Store A1 in TPM_PERMANENT_DATA -> ownerAuth
367 12. Create TPM_PERMANENT_DATA -> contextKey according to the rules for the algorithm
368 in use by the TPM to save context blobs
369 13. Create TPM_PERMANENT_DATA -> delegateKey according to the rules for the algorithm
370 in use by the TPM to save delegate blobs
371 14. Create TPM_PERMANENT_DATA -> tpmProof by using the TPM RNG
372 15. Export TPM_PERMANENT_DATA -> srk as srkPub
373 16. Set TPM_PERMANENT_FLAGS -> readPubek to FALSE
374 17. Calculate resAuth using the newly established TPM_PERMANENT_DATA -> ownerAuth

24 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

375 6.2 TPM_OwnerClear


376 Start of informative comment:
377 The OwnerClear command performs the clear operation under Owner authentication. This
378 command is available until the Owner executes the DisableOwnerClear, at which time any
379 further invocation of this command returns TPM_CLEAR_DISABLED.
380 End of informative comment.

381 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_OwnerClear

4 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
5 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Ignored
The authorization session digest for inputs and owner authentication.
7 20 TPM_AUTHDATA ownerAuth
HMAC key: ownerAuth.

382 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_OwnerClear

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Fixed value FALSE
The authorization session digest for the returned parameters. HMAC key:
6 20 TPM_AUTHDATA resAuth
old ownerAuth.

383 Actions
384 1. Verify that the TPM Owner authorizes the command and all of the input, on error return
385 TPM_AUTHFAIL.
386 2. If TPM_PERMANENT_FLAGS -> DisableOwnerClear is TRUE then return
387 TPM_CLEAR_DISABLED.
388 3. Unload all loaded keys.
389 4. The TPM MUST NOT modify the following TPM_PERMANENT_DATA items

Level 2 Revision 85 13 February 2005 Published 25


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

390 a. endorsementKey
391 b. revMajor
392 c. revMinor
393 d. manuMaintPub
394 e. auditMonotonicCounter
395 f. monotonicCounter
396 g. pcrAttrib
397 h. rngState
398 i. EKReset
399 j. maxNVBufSize
400 k. lastFamilyID
401 l. tpmDAASeed
402 m. DIR[1]
403 5. The TPM MUST invalidate the following TPM_PERMANENT_DATA items and any internal
404 resources associated with these items
405 a. ownerAuth
406 b. srk
407 c. delegateKey
408 d. delegateTable
409 e. contextKey
410 f. tpmProof
411 g. operatorAuth
412 6. The TPM MUST reset to manufacturing defaults the following TPM_PERMANENT_DATA
413 items
414 a. noOwnerNVWrite MUST be set to 0
415 b. ordinalAuditStatus
416 c. restrictDelegate
417 7. The TPM MUST invalidate or reset all fields of TPM_STANY_DATA
418 a. Nonces SHALL be reset
419 b. Lists (e.g. contextList) SHALL be invalidated
420 8. The TPM MUST invalidate or reset all fields of TPM_STCLEAR_DATA
421 a. Nonces SHALL be reset
422 b. Lists (e.g. contextList) SHALL be invalidated
423 9. The TPM MUST set the following TPM_PERMANENT_FLAGS to their default values
424 a. disable

26 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

425 b. deactivated
426 c. readPubek
427 d. disableOwnerClear
428 10. The TPM MUST set the following TPM_PERMANENT_FLAGS
429 a. ownership to TRUE
430 b. operator to FALSE
431 c. maintenanceDone to FALSE
432 11. The TPM releases all TPM_PERMANENT_DATA -> monotonicCounter settings
433 a. This includes invalidating all currently allocated counters. The result will be no
434 currently allocated counters and the new owner will need to allocate counters. The
435 actual count value will continue to increase.
436 12. The TPM MUST deallocate all owner authorized defined NV storage areas and MUST NOT
437 deallocate any other currently defined NV storage areas.
438 a. The pubInfo -> nvIndex includes a “D” bit, if the D bit is set the TPM MUST NOT
439 deallocate the NV storage area
440 13. The TPM MUST invalidate all familyTable entries

Level 2 Revision 85 13 February 2005 Published 27


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

441 6.3 TPM_ForceClear


442 Start of informative comment:
443 The ForceClear command performs the Clear operation under physical access. This
444 command is available until the execution of the DisableForceClear, at which time any
445 further invocation of this command returns TPM_CLEAR_DISABLED.
446 End of informative comment.

447 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_ForceClear

448 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

449 Actions
450 1. The TPM SHALL check for the assertion of physical presence, if not present return
451 TPM_BAD_PRESENCE
452 2. If TPM_STCLEAR_FLAGS -> disableForceClear is TRUE return TPM_CLEAR_DISABLED
453 3. The TPM SHALL execute the actions of TPM_OwnerClear (except for the TPM Owner
454 authentication check)

28 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

455 6.4 TPM_DisableOwnerClear


456 Start of informative comment:
457 The DisableOwnerClear command disables the ability to execute the TPM_OwnerClear
458 command permanently. Once invoked the only method of clearing the TPM will require
459 physical access to the TPM.
460 After the execution of TPM_ForceClear, ownerClear is re-enabled and must be explicitly
461 disabled again by the new TPM Owner.
462 End of informative comment.

463 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_DisableOwnerClear

4 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
5 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and owner authentication.
7 20 TPM_AUTHDATA ownerAuth
HMAC key: ownerAuth.

464 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_DisableOwnerClear

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
6 20 TPM_AUTHDATA resAuth
ownerAuth.

465 Actions
466 1. The TPM verifies that the authHandle properly authorizes the owner.
467 2. The TPM sets the TPM_PERMANENT_FLAGS -> disableownerclear flag to TRUE.

Level 2 Revision 85 13 February 2005 Published 29


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

468 3. When this flag is TRUE the only mechanism that can clear the TPM is the
469 TPM_ForceClear command. The TPM_ForceClear command requires physical access to
470 the TPM to execute.

30 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

471 6.5 TPM_DisableForceClear


472 Start of informative comment:
473 The DisableForceClear command disables the execution of the ForceClear command until
474 the next startup cycle. Once this command is executed, the TPM_ForceClear is disabled
475 until another startup cycle is run.
476 End of informative comment.

477 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_DisableForceClear

478 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

479 Actions
480 1. The TPM sets the TPM_STCLEAR_FLAGS.disableforceclear flag in the TPM that disables
481 the execution of the TPM_ForceClear command.

Level 2 Revision 85 13 February 2005 Published 31


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

482 6.6 TSC_PhysicalPresence


483 Start of informative comment:
484 Some TPM operations require the indication of a human’s physical presence at the platform.
485 The presence of the human either provides another indication of platform ownership or a
486 mechanism to ensure that the execution of the command is not the result of a remote
487 software process.
488 This command allows a process on the platform to indicate the assertion of physical
489 presence. As this command is executable by software there must be protections against the
490 improper invocation of this command.
491 The physicalPresenceHWEnable and physicalPresenceCMDEnable indicate the ability for
492 either SW or HW to indicate physical presence. These flags can be reset until the
493 physicalPresenceLifetimeLock is set. The platform manufacturer should set these flags to
494 indicate the capabilities of the platform the TPM is bound to.
495 The command provides two sets of functionality. The first is to enable, permanently, either
496 the HW or the SW ability to assert physical presence. The second is to allow SW, if enabled,
497 to assert physical presence.
498 End of informative comment.

499 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TSC_ORD_PhysicalPresence.
4 2 TPM_PHYSICAL_PRESENCE physicalPresence The state to set the TPM’s Physical Presence flags.

500 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation. See section 4.3 of Main Specification.

501 Actions
502 1. For documentation ease, the bits break into two categories. The first is the lifetime
503 settings and the second is the assertion settings.
504 a. Define A1 to be the lifetime settings: TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK,
505 TPM_PHYSICAL_PRESENCE_HW_ENABLE,
506 TPM_PHYSICAL_PRESENCE_CMD_ENABLE,
507 TPM_PHYSICAL_PRESENCE_HW_DISABLE, and
508 TPM_PHYSICAL_PRESENCE_CMD_DISABLE

32 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

509 b. Define A2 to be the assertion settings: TPM_PHYSICAL_PRESENCE_LOCK,


510 TPM_PHYSICAL_PRESENCE_PRESENT, and
511 TPM_PHYSICAL_PRESENCE_NOTPRESENT

512 Lifetime lock settings


513 2. If any A1 setting is present
514 a. If TPM_PERMANENT_FLAGS -> physicalPresenceLifetimeLock is TRUE, return
515 TPM_BAD_PARAMETER
516 b. If any A2 setting is present return TPM_BAD_PARAMETER
517 c. If both physicalPresence -> TPM_PHYSICAL_PRESENCE_HW_ENABLE and
518 physicalPresence -> TPM_PHYSICAL_PRESENCE_HW_DISABLE are TRUE, return
519 TPM_BAD_PARAMETER.
520 d. If both physicalPresence -> TPM_PHYSICAL_PRESENCE_CMD_ENABLE and
521 physicalPresence ->
522 TPM_PHYSICAL_PRESENCE_CMD_DISABLE are TRUE, return
523 TPM_BAD_PARAMETER.
524 e. If physicalPresence -> TPM_PHYSICAL_PRESENCE_HW_ENABLE is TRUE Set
525 TPM_PERMANENT_FLAGS -> physicalPresenceHWEnable to TRUE
526 f. If physicalPresence -> TPM_PHYSICAL_PRESENCE_HW_DISABLE is TRUE Set
527 TPM_PERMANENT_FLAGS -> physicalPresenceHWEnable to FALSE
528 g. If physicalPresence -> TPM_PHYSICAL_PRESENCE_CMD_ENABLE is TRUE, Set
529 TPM_PERMANENT_FLAGS -> physicalPresenceCMDEnable to TRUE.
530 h. If physicalPresence -> TPM_PHYSICAL_PRESENCE_CMD_DISABLE is TRUE, Set
531 TPM_PERMANENT_FLAGS -> physicalPresenceCMDEnable to FALSE.
532 i. If physicalPresence -> TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK is TRUE
533 i. Set TPM_PERMANENT_FLAGS -> physicalPresenceLifetimeLock to TRUE
534 j. Return TPM_SUCCESS

535 SW physical presence assertion


536 3. If any A2 setting is present
537 a. If any A1 setting is present return TPM_BAD_PARAMETER
538 i. This check here just for consistency, the prior checks would have already ensured
539 that this was ok
540 b. If TPM_PERMANENT_FLAGS -> physicalPresenceCMDEnable is FALSE, return
541 TPM_BAD_PARAMETER
542 c. If both physicalPresence -> TPM_PHYSICAL_PRESENCE_LOCK and physicalPresence
543 -> TPM_PHYSICAL_PRESENCE_PRESENT are TRUE, return TPM_BAD_PARAMETER
544 d. If both physicalPresence -> TPM_PHYSICAL_PRESENCE_PRESENT and
545 physicalPresence -> TPM_PHYSICAL_PRESENCE_NOTPRESENT are TRUE, return
546 TPM_BAD_PARAMETER

Level 2 Revision 85 13 February 2005 Published 33


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

547 e. If TPM_STCLEAR_FLAGS -> physicalPresenceLock is TRUE, return


548 TPM_BAD_PARAMETER
549 f. If physicalPresence -> TPM_PHYSICAL_PRESENCE_LOCK is TRUE
550 i. Set TPM_STCLEAR_FLAGS -> physicalPresence to FALSE
551 ii. Set TPM_STCLEAR_FLAGS -> physicalPresenceLock to TRUE
552 iii. Return TPM_SUCCESS
553 g. If physicalPresence -> TPM_PHYSICAL_PRESENCE_PRESENT is TRUE
554 i. Set TPM_STCLEAR_FLAGS -> physicalPresence to TRUE
555 h. If physicalPresence -> TPM_PHYSICAL_PRESENCE_NOTPRESENT is TRUE
556 i. Set TPM_STCLEAR_FLAGS -> physicalPresence to FALSE
557 i. Return TPM_SUCCESS
558 4. Else // There were no A1 or A2 parameters set
559 a. Return TPM_BAD_PARAMETER

34 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

560 6.7 TSC_ResetEstablishmentBit


561 Start of informative comment:
562 The PC TPM Interface Specification (TIS) specifies setting tpmEstablished to a 0 upon
563 execution of the HASH_START sequence. The setting implies the creation of a Trusted
564 Operating System on the platform. Platforms will use the value of tpmEstablished to
565 determine if operations necessary to maintain the security perimeter are necessary.
566 The tpmEstablished bit provides a non-volatile, secure reporting that a HASH_START was
567 previously run on the platform. When a platform makes use of the tpmEstablished bit, the
568 platform can reset tpmEstablished as the operation is no longer necessary.
569 For example a platform could use tpmEstablished to ensure that if HASH_START had ever
570 been executed the platform could use the value to invoke special processing. Once the
571 processing is complete the platform will wish to reset tpmEstablished to avoid invoking the
572 special process again.
573 End of informative comment.

574 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TSC_ORD_ResetEstablishmentBit

575 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

576 Actions
577 1. Validate the assertion of locality 3 or locality 4
578 2. Set the TPM_PERMANENT_FLAGS -> tpmEstablished bit contained in the TPM_ACCESS
579 register to 1
580 3. Return TPM_SUCCESS

Level 2 Revision 85 13 February 2005 Published 35


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

581 7. The GetCapability Commands


582 Start of informative comment:
583 The TPM has numerous capabilities that a remote entity may wish to know about. These
584 items include support of algorithms, key sizes, protocols and vendor-specific additions. The
585 GetCapability command allows the TPM to report back to the requestor what type of TPM it
586 is dealing with.
587 The request for information requires the requestor to specify which piece of information that
588 is required. The request does not allow the “merging” of multiple requests and returns only
589 a single piece of information.
590 In failure mode, the TPM returns a limited set of information that includes the TPM
591 manufacture and model and the SelfTestResult
592 In version 1.2 with the deletion of GetCapabilitySigned the way to obtain a signed listing of
593 the capabilities is to create a transport session, perform GetCapability commands to list the
594 information and then close the transport session using ReleaseTransportSigned.
595 End of informative comment.
596 1. The standard information provided in TPM_GetCapability MUST NOT provide unique
597 information
598 a. The TPM has no control of information placed into areas on the TPM like the NV store
599 that is reported by the TPM. Configuration information for these areas could
600 conceivably be unique

36 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

601 7.1 TPM_GetCapability


602 Start of informative comment:
603 This command returns current information regarding the TPM.
604 End of informative comment.

605 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_GetCapability
4 4 TPM_CAPABILITY_AREA capArea Partition of capabilities to be interrogated
5 4 UINT32 subCapSize Size of subCap parameter
6 <> BYTE[] subCap Further definition of information

606 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 4 UINT32 respSize The length of the returned capability response
5 <> BYTE[ ] resp The capability response

607 Actions
608 1. The TPM validates the capArea and subCap indicators. If the information is available,
609 the TPM creates the response field and fills in the actual information.
610 2. The structure document contains the list of caparea and subCap values
611 3. If the TPM is in failure mode
612 a. The TPM MUST only return TPM manufacturer, TPM version and SelfTestResult
613 b. The TPM MAY execute this command without a successful invocation of TPM_Startup

Level 2 Revision 85 13 February 2005 Published 37


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

614 7.2 TPM_SetCapability


615 Start of informative comment:
616 This command sets values in the TPM
617 End of informative comment.

618 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal ordinal: TPM_ORD_SetCapability
4 4 2S 4 TPM_CAPABILITY_AREA capArea Partition of capabilities to be interrogated
5 4 3S 4 UINT32 subCapSize Size of subCap parameter
6 <> 4S <> BYTE[] subCap Further definition of information
7 4 5S 4 UINT32 setValueSize The size of the value to set
8 <> 6S <> BYTE[] setValue The value to set

9 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
10 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
11 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
12 20 TPM_AUTHDATA ownerAuth Authorization. HMAC key: owner.usageAuth.

38 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

619 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal ordinal: TPM_ORD_SetCapability

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
6 20 TPM_AUTHDATA resAuth Authorization HMAC key:owner.usageAuth.

620 Actions
621 1. If tag = TPM_TAG_RQU_AUTH1_COMMAND, vValidate the command and parameters
622 using ownerAuth, return TPM_AUTHFAIL on error
623 2. The TPM validates the capArea and subCap indicators, including the ability to set value
624 based on any set restrictions
625 3. If the capArea and subCap indicators conform with one of the entries in the structure
626 TPM_CAPABILITY_AREA Values for TPM_SetCapabilityTPM_SET_VALUE
627 a. The TPM sets the relevant flag/data to the value of setValue parameter.
628 4. Else
629 a. Return the error code TPM_BAD_PARAMETER.

Level 2 Revision 85 13 February 2005 Published 39


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

630 8. Auditing
631 8.1 Audit Generation
632 Start of informative comment:
633 The TPM generates an audit event in response to the TPM executing a function that has the
634 audit flag set to TRUE for that function.
635 The TPM maintains an extended value for all audited operations.
636 Input audit generation occurs before the listed actions and output audit generation occurs
637 after the listed actions.
638 End of informative comment.

639 Description
640 The TPM extends the audit digest whenever the ordinalAuditStatus is TRUE for the ordinal
641 about to be executed. The only exception is if the ordinal about to be executed is
642 TPM_SetOrdinalAuditStatus. In that case, output parameter auditing is performed if the
643 ordinalAuditStatus resulting from command execution is TRUE.

644 Actions
645 The TPM will execute the ordinal and perform auditing in the following manner
646 1. Map V1 to TPM_STANY_DATA
647 2. Map P1 to TPM_PERMANENT_DATA
648 3. If V1 -> auditDigest is NULL
649 a. Increment P1 -> auditMonotonicCounter by 1
650 4. Create A1 a TPM_AUDIT_EVENT_IN structure
651 a. Set A1 -> inputParms to the input parameters from the command
652 b. Set A1 -> auditCount to P1 -> auditMonotonicCounter
653 c. Set V1 -> auditDigest to SHA-1 (V1 -> auditDigest || A1)
654 5. Execute command
655 a. Execution implies the performance of the listed actions for the ordinal.
656 6. Create A2 a TPM_AUDIT_EVENT_OUT structure
657 a. Set A2 -> outputParms to the output parameters from the command
658 b. Set A2 -> auditCount to P1 -> auditMonotonicCounter
659 c. Set V1 -> auditDigest to SHA-1 (V1 -> auditDigest || A2)

40 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

660 8.2 Effect of audit failing after completion of a command


661 Start of informative comment:
662 An operation could complete and then when the TPM attempts to audit the command the
663 audit process could have an internal error.
664 With one return parameter, The TPM is unable to return both the audit failure and the
665 command success or failure results. To indicate the audit failure, the TPM will return one of
666 two error codes: TPM_AUDITFAIL_SUCCESSFUL (if the command completed successfully)
667 or TPM_AUDITFAIL_UNSUCCESSFUL (if the command completed unsuccessfully).
668 This new functionality changes the 1.1 TPM functionality when this condition occurs.
669 End of informative comment.
670 1. When after completion of an operation, and in performing the audit process, the TPM
671 has an internal failure (unable to write, SHA-1 failure etc.) the TPM MUST set the
672 internal TPM state such that the TPM returns the TPM_FAILEDSELFTEST error on
673 subsequent attempts to execute a command
674 2. The return code for the command uses the following rules
675 a. Command result success, Audit success -> return TPM_SUCCESS
676 b. Command result failure, Audit success -> return command result failure
677 c. Command result success, Audit failure -> return TPM_AUDITFAIL_SUCCESSFUL
678 d. Command result failure, Audit failure -> return TPM_AUDITFAIL_UNSUCCESSFUL
679 3. If the TPM is permanently nonrecoverable after an audit failure, then the TPM MUST
680 always return TPM_FAILEDSELFTEST for every command other than
681 TPM_GetTestResult. This state must persist regardless of power cycling, the execution of
682 TPM_Init or any other actions.

Level 2 Revision 85 13 February 2005 Published 41


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

683 8.3 TPM_GetAuditDigest


684 Start of informative comment:
685 This returns the current audit digest. The external audit log has the responsibility to track
686 the parameters that constitute the audit digest.
687 This value may be unique to an individual TPM. The value however will be changing at a
688 rate set by the TPM Owner. Those attempting to use this value may find it changing without
689 their knowledge. This value represents a very poor source of tracking uniqueness.
690 End of informative comment.

691 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE Ordinal Command ordinal: TPM_ORD_GetAuditDigest
4 4 UINT32 startOrdinal The starting ordinal for the list of audited ordinals

692 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
5 10 TPM_COUNTER_VALUE counterValue The current value of the audit monotonic counter
4 20 TPM_DIGEST auditDigest Log of all audited events
5 1 BOOL more TRUE if the output does not contain a full list of audited ordinals
5 4 UINT32 ordSize Size of the ordinal list in bytes
6 <> UINT32[] ordList List of ordinals that are audited.

693 Actions
694 1. The TPM sets auditDigest to TPM_STANY_DATA -> auditDigest
695 2. The TPM sets counterValue to TPM_PERMANENT_DATA -> auditMonotonicCounter
696 3. The TPM creates an ordered list of audited ordinals. The list starts at startOrdinal listing
697 each ordinal that is audited.
698 a. If startOrdinal is 0 then the first ordinal that could be audited would be TPM_OIAP
699 (ordinal 0x0000000A)
700 b. The next ordinal would be TPM_OSAP (ordinal 0x0000000B)
701 4. If the ordered list does not fit in the output buffer the TPM sets more to TRUE
702 5. Return TPM_STANY_DATA -> auditDigest as auditDigest

42 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

703 8.4 TPM_GetAuditDigestSigned


704 Start of informative comment:
705 The signing of the audit log returns the entire digest value and the list of currently audited
706 commands.
707 The inclusion of the list of audited commands as an atomic operation is to tie the current
708 digest value with the list of commands that are being audited.
709 Note to future architects
710 When auditing functionality is active in a TPM, it may seem logical to remove this ordinal
711 from the active set of ordinals as the signing functionality of this command could be
712 handled in a signed transport session. While true this command has a secondary affect
713 also, resetting the audit log digest. As the reset requires TPM Owner authentication there
714 must be some way in this command to reflect the TPM Owner wishes. By requiring that a
715 TPM Identity key be the only key that can sign and reset the TPM Owners authentication is
716 implicit in the execution of the command (TPM Identity Keys are created and controlled by
717 the TPM Owner only). Hence, while one might want to remove an ordinal this is not one that
718 can be removed if auditing is functional.
719 End of informative comment.

720 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal ordinal: TPM_ORD_GetAuditDigestSigned
4 4 TPM_KEY_HANDLE keyHandle The handle of a loaded key that can perform digital signatures.
5 1 2S 1 BOOL closeAudit Indication if audit session should be closed
6 20 3S 20 TPM_NONCE antiReplay A nonce to prevent replay attacks

7 4 TPM_AUTHHANDLE authHandle The authorization session handle used for key authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
10 20 TPM_AUTHDATA keyAuth Authorization. HMAC key: key.usageAuth.

Level 2 Revision 85 13 February 2005 Published 43


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

721 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal ordinal: TPM_ORD_GetAuditDigestSigned
4 10 3S 10 TPM_COUNTER_VALUE counterValue The value of the audit monotonic counter
5 20 4S 20 TPM_DIGEST auditDigest Log of all audited events
6 20 5S 20 TPM_DIGEST ordinalDigest Digest of all audited ordinals
7 4 6S 4 UINT32 sigSize The size of the sig parameter
8 <> 7S <> BYTE[] sig The signature of the area

9 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
10 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
11 20 TPM_AUTHDATA resAuth Authorization HMAC key: key.usageAuth.

722 Actions
723 1. Validate the AuthData and parameters using keyAuth, return TPM_AUTHFAIL on error
724 2. The TPM validates that the key pointed to by keyHandle has a signature scheme of
725 TPM_SS_RSASSAPKCS1V15_SHA1 return TPM_INVALID_KEYUSAGE
726 3. Create D1 a TPM_SIGN_INFO structure and set the structure defaults
727 a. Set D1 -> fixed to “ADIG”
728 b. Set D1 -> replay to antiReplay
729 c. Create D3 a list of all audited ordinals as defined in the TPM_GetAuditDigest
730 UINT32[] ordList outgoing parameter
731 d. Create D4 the SHA-1 of D3
732 e. Set auditDigest to TPM_STANY_DATA -> auditDigest
733 f. Set counterValue to TPM_PERMANENT_DATA -> auditMonotonicCounter
734 g. Create D2 the concatenation of auditDigest || counterValue || D4
735 h. Set D1 -> data to D2
736 i. Create a digital signature of the SHA-1 of D1 by using the signature scheme for
737 keyHandle
738 j. Set ordinalDigest to D4
739 4. If closeAudit == TRUE
740 a. If keyHandle->keyUsage is TPM_KEY_IDENTITY
741 i. TPM_STANY_DATA -> auditDigest MUST be set to NULLS.

44 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

742 b. Else
743 i. Return TPM_INVALID_KEYUSAGE

Level 2 Revision 85 13 February 2005 Published 45


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

744 8.5 TPM_SetOrdinalAuditStatus


745 Start of informative comment:
746 Set the audit flag for a given ordinal. Requires the authentication of the TPM Owner.
747 End of informative comment.

748 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_SetOrdinalAuditStatus
4 4 2S 4 TPM_COMMAND_CODE ordinalToAudit The ordinal whose audit flag is to be set
5 1 3S 1 BOOL auditState Value for audit flag

6 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
7 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
8 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
9 20 TPM_AUTHDATA ownerAuth HMAC key: ownerAuth.

749 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_SetOrdinalAuditStatus

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
6 20 TPM_AUTHDATA resAuth
ownerAuth.

750 Actions
751 1. Validate the AuthData to execute the command and the parameters
752 2. Validate that the ordinal points to a valid TPM ordinal, return TPM_BADINDEX on error
753 a. Valid TPM ordinal means an ordinal that the TPM implementation supports
754 3. Set the non-volatile flag associated with ordinalToAudit to the value in auditState

46 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

755 9. Administrative Functions - Management


756 9.1 TPM_FieldUpgrade
757 Start of informative comment:
758 The TPM needs a mechanism to allow for updating the protected capabilities once a TPM is
759 in the field. Given the varied nature of TPM implementations there will be numerous
760 methods of performing an upgrade of the protected capabilities. This command, when
761 implemented, provides a manufacturer specific method of performing the upgrade.
762 The manufacturer can determine, within the listed requirements, how to implement this
763 command. The command may be more than one command and actually a series of
764 commands.
765 The IDL definition is to create an ordinal for the command, however the remaining
766 parameters are manufacturer specific.
767 The policy to determine when it is necessary to perform the actions of TPM_RevokeTrust is
768 outside the TPM spec and determined by other TCG workgroups.
769 End of informative comment.

770 IDL Definition


771 TPM_RESULT TPM_FieldUpgrade(
772 [in, out] TPM_AUTH* ownerAuth,
773 …);

774 Type
775 This is an optional command and a TPM is not required to implement this command in any
776 form.

777 Parameters
Type Name Description
TPM_AUTH ownerAuth Authentication from TPM owner to execute command
… Remaining parameters are manufacturer specific

778 Descriptions
779 The upgrade mechanisms in the TPM MUST not require the TPM to hold a global secret. The
780 definition of global secret is a secret value shared by more than one TPM.
781 The TPME is not allowed to pre-store or use unique identifiers in the TPM for the purpose of
782 field upgrade. The TPM MUST NOT use the endorsement key for identification or encryption
783 in the upgrade process. The upgrade process MAY use a TPM Identity to deliver upgrade
784 information to specific TPM’s.
785 The upgrade process can only change protected capabilities.
786 The upgrade process can only access data in shielded locations where this data is necessary
787 to validate the TPM Owner, validate the TPME and manipulate the blob

Level 2 Revision 85 13 February 2005 Published 47


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

788 The TPM MUST be conformant to the TPM specification, protection profiles and security
789 targets after the upgrade. The upgrade MAY NOT decrease the security values from the
790 original security target.
791 The security target used to evaluate this TPM MUST include this command in the TOE.
792 When a field upgrade occurs, it is always sufficient to put the TPM into the same state as a
793 successfully executed TPM_RevokeTrust.

794 Actions
795 The TPM SHALL perform the following when executing the command:
796 1. Validate the TPM Owners AuthData to execute the command
797 2. Validate that the upgrade information was sent by the TPME. The validation mechanism
798 MUST use a strength of function that is at least the same strength of function as a
799 digital signature performed using a 2048 bit RSA key.
800 3. Validate that the upgrade target is the appropriate TPM model and version.
801 4. Process the upgrade information and update the protected capabilities
802 5. Set the TPM_PERMANENT_DATA.revMajor and TPM_PERMANENT_DATA.revMinor to the
803 values indicated in the upgrade. The selection of the value is a manufacturer option. The
804 values MUST be monotonically increasing. Installing an upgrade with a major and minor
805 revision that is less than currently installed in the TPM is a valid operation.
806 6. Set the TPM_STCLEAR_FLAGS.deactivated to TRUE

48 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

807 9.2 TPM_SetRedirection


808 Informative comment
809 The redirection command attaches a key to a redirection receiver.
810 When making the connection to a GPIO channel the authorization restrictions are set at
811 connection time and not for each invocation that uses the channel.
812 End of informative comments

813 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SetRedirection
4 4 TPM_KEY_HANDLE keyHandle The keyHandle identifier of a loaded key that can implement redirection.
5 4 2S 4 TPM_REDIR_COMMAND redirCmd The command to execute
6 4 3S 4 UINT32 inputDataSize The size of the input data
7 <> 4S <> BYTE inputData Manufacturer parameter

8 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle authorization
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
10 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
11 20 TPM_AUTHDATA ownerAuth HMAC key ownerAuth

814 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND

2 4 UINT32 paramSize Total number of output bytes including paramSize and tag

3 4 1S 4 TPM_RESULT returnCode The return code of the operation.

2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_SetRedirection

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs

3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle

5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
6 20 TPM_AUTHDATA resAuth
key.usageAuth
815

816 Action
817 1. If tag == TPM_TAG_REQ_AUTH1_COMMAND

Level 2 Revision 85 13 February 2005 Published 49


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

818 a. Validate the command and parameters using TPM Owner authentication, on error
819 return TPM_AUTHFAIL
820 2. if redirCmd == TPM_REDIR_GPIO
821 a. Validate that keyHandle points to a loaded key, return TPM_INVALID_KEYHANDLE
822 on error
823 b. Validate the key attributes specify redirection, return TPM_BAD_TYPE on error
824 c. Validate that inputDataSize is 4, return TPM_BAD_PARAM_SIZE on error
825 d. Validate that inputData points to a valid GPIO channel, return
826 TPM_BAD_PARAMETER on error
827 e. Map C1 to the TPM_GPIO_CONFIG_CHANNEL structure indicated by inputData
828 f. If C1 -> attr specifies TPM_GPIO_ATTR_OWNER
829 i. If tag != TPM_TAG_REQ_AUTH1_COMMAND return TPM_AUTHFAIL
830 g. If C1 -> attr specifies TPM_GPIO_ATTR_PP
831 i. If TPM_STCLEAR_FLAGS -> physicalPresence == FALSE, then return
832 TPM_BAD_PRESENCE
833 h. Return TPM_SUCCESS
834 3. The TPM MAY support other redirection types. These types may be specified by TCG or
835 provided by the manufacturer.

50 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

836 9.3 TPM_ResetLockValue


837 Informative comment
838 Command that resets the TPM dictionary attack mitigation values
839 End of informative comments

840 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_ResetLockValue

4 4 TPM_AUTHHANDLE authHandle The authorization session handle used for TPM Owner authorization
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
5 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
7 20 TPM_AUTHDATA ownerAuth HMAC key TPM Owner auth

841 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ResetLockValue

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
6 20 TPM_AUTHDATA resAuth HMAC key: TPM Owner auth

Level 2 Revision 85 13 February 2005 Published 51


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

842 Action
843 1. If TPM_STCLEAR_DATA -> disableResetLock is TRUE return TPM_AUTHFAIL
844 a. The internal dictionary attack mechanism will set TPM_STCLEAR_DATA ->
845 disableResetLock to FALSE when the timeout period expires
846 2. If the the command and parameters validation using ownerAuth fails
847 a. Set TPM_STCLEAR_DATA -> disableResetLock to TRUE
848 b. Reset the TPM dictionary attack lock out period
849 c. Return TPM_AUTHFAIL
850 3. Reset the internal TPM dictionary attack mitigation mechanism
851 a. The mechanism is vendor specific and can include time outs, reboots, and other
852 mitigation strategies

52 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

853 10. Storage functions


854 10.1 TPM_Seal
855 Start of informative comment:
856 The SEAL operation allows software to explicitly state the future “trusted” configuration that
857 the platform must be in for the secret to be revealed. The SEAL operation also implicitly
858 includes the relevant platform configuration (PCR-values) when the SEAL operation was
859 performed. The SEAL operation uses the tpmProof value to BIND the blob to an individual
860 TPM.
861 If the UNSEAL operation succeeds, proof of the platform configuration that was in effect
862 when the SEAL operation was performed is returned to the caller, as well as the secret data.
863 This proof may, or may not, be of interest. If the SEALed secret is used to authenticate the
864 platform to a third party, a caller is normally unconcerned about the state of the platform
865 when the secret was SEALed, and the proof may be of no interest. On the other hand, if the
866 SEALed secret is used to authenticate a third party to the platform, a caller is normally
867 concerned about the state of the platform when the secret was SEALed. Then the proof is of
868 interest.
869 For example, if SEAL is used to store a secret key for a future configuration (probably to
870 prove that the platform is a particular platform that is in a particular configuration), the
871 only requirement is that that key can be used only when the platform is in that future
872 configuration. Then there is no interest in the platform configuration when the secret key
873 was SEALed. An example of this case is when SEAL is used to store a network
874 authentication key.
875 On the other hand, suppose an OS contains an encrypted database of users allowed to log
876 on to the platform. The OS uses a SEALED blob to store the encryption key for the user-
877 database. However, the nature of SEAL is that any SW stack can SEAL a blob for any other
878 software stack. Hence the OS can be attacked by a second OS replacing both the SEALED-
879 blob encryption key, and the user database itself, allowing untrusted parties access to the
880 services of the OS. To thwart such attacks, SEALED blobs include the past SW
881 configuration. Hence, if the OS is concerned about such attacks, it may check to see
882 whether the past configuration is one that is known to be trusted.
883 TPM_Seal requires the encryption of one parameter (“Secret”). For the sake of uniformity
884 with other commands that require the encryption of more than one parameter, the string
885 used for XOR encryption is generated by concatenating a nonce (created during the OSAP
886 session) with the session shared secret and then hashing the result.
887 End of informative comment.

Level 2 Revision 85 13 February 2005 Published 53


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

888 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Seal.
4 4 TPM_KEY_HANDLE keyHandle Handle of a loaded key that can perform seal operations.
The encrypted AuthData for the sealed data. The encryption key is the
5 20 2S 20 TPM_ENCAUTH encAuth
shared secret from the OSAP protocol.
6 4 3S 4 UINT32 pcrInfoSize The size of the pcrInfo parameter. If 0 there are no PCR registers in use
The PCR selection information. The caller MAY use
7 <> 4S <> TPM_PCR_INFO pcrInfo
TPM_PCR_INFO_LONG.
8 4 5S 4 UINT32 inDataSize The size of the inData parameter
9 <> 6S <> BYTE[ ] inData The data to be sealed to the platform and any specified PCRs

The authorization session handle used for keyHandle authorization.


10 4 TPM_AUTHHANDLE authHandle
Must be an OSAP session for this command.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
11 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
12 1 4H1 1 BOOL continueAuthSession Ignored
The authorization session digest for inputs and keyHandle. HMAC key:
13 20 TPM_AUTHDATA pubAuth
key.usageAuth.

889 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Seal.
Encrypted, integrity-protected data object that is the result of the
4 <> 3S <> TPM_STORED_DATA sealedData
TPM_Seal operation.

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, fixed value of FALSE
The authorization session digest for the returned parameters. HMAC key:
7 20 TPM_AUTHDATA resAuth
key.usageAuth.

890 Descriptions
891 The string used for XOR encryption of the command variable named encAuth SHALL be the
892 digest created by concatenating the shared session secret with the even numbered hash
893 (generated by the TPM) and hashing the concatenated value.
894 TPM_Seal is used to encrypt private objects that can only be decrypted using TPM_Unseal.

54 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

895 Actions
896 1. Validate the authorization to use the key pointed to by keyHandle
897 2. If the inDataSize is 0 the TPM returns TPM_BAD_PARAMETER
898 3. If the keyUsage field of the key indicated by keyHandle does not have the value
899 TPM_KEY_STORAGE, the TPM must return the error code TPM_INVALID_KEYUSAGE.
900 4. If the keyHandle points to a migratable key then the TPM MUST return the error code
901 TPM_INVALID_KEY_USAGE.
902 5. Determine the version of pcrInfo
903 a. If pcrInfoSize is 0
904 i. set V1 to 1
905 b. Else
906 i. Point X1 as TPM_PCR_INFO_LONG structure to pcrInfo
907 ii. If X1 -> tag is TPM_TAG_PCR_INFO_LONG
908 iii. Set V1 to 2
909 iv. Else
910 v. Set V1 to 1
911 6. If V1 is 1 then
912 a. Create S1 a TPM_STORED_DATA structure
913 7. else
914 a. Create S1 a TPM_STORED_DATA12 structure
915 b. Set S1 -> et to NULL
916 8. Set s1 -> encDataSize to 0
917 9. Set s1 -> encData to NULL
918 10. Set s1 -> sealInfoSize to pcrInfoSize
919 11. If pcrInfoSize is not 0 then
920 a. if V1 is 1 then
921 i. Validate pcrInfo as a valid TPM_PCR_INFO structure, return TPM_BADINDEX on
922 error
923 ii. Set s1 -> sealInfo -> pcrSelection to pcrInfo -> pcrSelection
924 iii. Create h1 the composite hash of the PCR selected by pcrInfo -> pcrSelection
925 iv. Set s1 -> sealInfo -> digestAtCreation to h1
926 v. Set s1 -> sealInfo -> digestAtRelease to pcrInfo -> digestAtRelease
927 b. else
928 i. Validate pcrInfo as a valid TPM_PCR_INFO_LONG structure, return
929 TPM_BADINDEX on error

Level 2 Revision 85 13 February 2005 Published 55


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

930 ii. Set s1 -> sealInfo -> creationPCRSelection to pcrInfo -> creationPCRSelection
931 iii. Set s1 -> sealInfo -> releasePCRSelection to pcrInfo -> releasePCRSelection
932 iv. Set s1 -> sealInfo -> digestAtRelease to pcrInfo -> digestAtRelease
933 v. Set s1 -> sealInfo -> localityAtRelease to pcrInfo -> localityAtRelease
934 vi. Create h2 the composite hash of the PCR selected by pcrInfo ->
935 creationPCRSelection
936 vii. Set s1 -> sealInfo -> digestAtCreation to h2
937 viii. Set s1 -> sealInfo -> localityAtCreation to TPM_STANY_FLAGS ->
938 localityModifier
939 12. If keyHandle indicates XOR encryption for the AuthData secrets
940 a. Create X1 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
941 authLastNonceEven)
942 b. Create a1 by XOR X1 and encAuth
943 13. Else
944 a. Create a1 by decrypting encAuth using the algorithm indicated in the OSAP session
945 b. Key is from authHandle -> sharedSecret
946 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
947 14. The TPM provides NO validation of a1. Well-known values (like NULLS) are valid and
948 possible.
949 15. Create s2 a TPM_SEALED_DATA structure
950 a. Set s2 -> payload to TPM_PT_SEAL
951 b. Set s2 -> tpmProof to TPM_PERMANENT_DATA -> tpmProof
952 c. Create h3 the SHA-1 of s1
953 d. Set s2 -> storedDigest to h3
954 e. Set s2 -> authData to a1
955 f. Set s2 -> dataSize to inDataSize
956 g. Set s2 -> data to inData
957 16. Validate that the size of s2 can be encrypted by the key pointed to by keyHandle, return
958 TPM_BAD_DATASIZE on error
959 17. Create s3 the encryption of s2 using the key pointed to by keyHandle
960 18. Set continueAuthSession to FALSE
961 19. Set s1 -> encDataSize to the size of s3
962 20. Set s1 -> encData to s3
963 21. Return s1 as sealedData

56 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

964 10.2 TPM_Unseal


965 Start of informative comment:
966 The TPM_Unseal operation will reveal TPM_Sealed data only if it was encrypted on this
967 platform and the current configuration (as defined by the named PCR contents) is the one
968 named as qualified to decrypt it. Internally, TPM_Unseal accepts a data blob generated by a
969 TPM_Seal operation. TPM_Unseal decrypts the structure internally, checks the integrity of
970 the resulting data, and checks that the PCR named has the value named during TPM_Seal.
971 Additionally, the caller must supply appropriate AuthData for blob and for the key that was
972 used to seal that data.
973 If the integrity, platform configuration and authorization checks succeed, the sealed data is
974 returned to the caller; otherwise, an error is generated.
975 End of informative comment.

976 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Unseal.
4 4 TPM_KEY_HANDLE parentHandle Handle of a loaded key that can unseal the data.
5 <> 2S <> TPM_STORED_DATA inData The encrypted data generated by TPM_Seal.

6 4 TPM_AUTHHANDLE authHandle The authorization session handle used for parentHandle.


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
7 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
8 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and parentHandle. HMAC
9 20 TPM_AUTHDATA parentAuth
key: parentKey.usageAuth.

10 4 TPM_AUTHHANDLE dataAuthHandle The authorization session handle used to authorize inData.


2H2 20 TPM_NONCE dataLastNonceEven Even nonce previously generated by TPM
11 20 3H2 20 TPM_NONCE datanonceOdd Nonce generated by system associated with entityAuthHandle
12 1 4H2 1 BOOL continueDataSession Continue usage flag for dataAuthHandle.
The authorization session digest for the encrypted entity. HMAC key:
13 20 TPM_AUTHDATA dataAuth
entity.usageAuth.

Level 2 Revision 85 13 February 2005 Published 57


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

977 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Unseal.
4 4 3S 4 UINT32 secretSize The used size of the output area for secret
5 <> 4S <> BYTE[ ] secret Decrypted data that had been sealed

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC
8 20 TPM_AUTHDATA resAuth
key: parentKey.usageAuth.

9 20 2H2 20 TPM_NONCE dataNonceEven Even nonce newly generated by TPM.


3H2 20 TPM_NONCE datanonceOdd Nonce generated by system associated with dataAuthHandle
10 1 4H2 1 BOOL continueDataSession Continue use flag, TRUE if handle is still active
The authorization session digest used for the dataAuth session. HMAC
11 20 TPM_AUTHDATA dataAuth
key: entity.usageAuth.

978 Actions
979 1. The TPM MUST validate that parentAuth authorizes the use of the key in parentHandle,
980 on error return TPM_AUTHFAIL
981 2. If the keyUsage field of the key indicated by parentHandle does not have the value
982 TPM_KEY_STORAGE, the TPM MUST return the error code TPM_INVALID_KEYUSAGE.
983 3. The TPM MUST check that the TPM_KEY_FLAGS -> Migratable flag has the value FALSE
984 in the key indicated by parentHandle. If not, the TPM MUST return the error code
985 TPM_INVALID_KEYUSAGE
986 4. Determine the version of inData
987 a. If inData -> tag = TPM_TAG_STORED_DATA12
988 i. Set V1 to 2
989 ii. Map S2 a TPM_STORED_DATA12 structure to inData
990 b. Else If inData -> ver = 1.1
991 i. Set V1 to 1
992 ii. Map S2 a TPM_STORED_DATA structure to inData
993 c. Else
994 i. Return TPM_BAD_VERSION
995 5. Create d1 by decrypting S2 -> encData using the key pointed to by parentHandle

58 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

996 6. Validate d1
997 a. d1 MUST be a TPM_SEALED_DATA structure
998 b. d1 -> tpmProof MUST match TPM_PERMANENT_DATA -> tpmProof
999 c. Set S2 -> encDataSize to 0
1000 d. Set S2 -> encData to NULL
1001 e. Create h1 the SHA-1 of inData
1002 f. d1 -> storedDigest MUST match h1
1003 g. d1 -> payload MUST be TPM_PT_SEAL
1004 h. Any failure MUST return TPM_NOTSEALED_BLOB
1005 7. The TPM MUST validate authorization to use d1 by checking that the HMAC calculation
1006 using d1 -> authData as the shared secret matches the dataAuth. Return
1007 TPM_AUTHFAIL on mismatch.
1008 8. If S2 -> sealInfoSize is not 0 then
1009 a. If V1 is 1 then
1010 i. Validate that S2 -> pcrInfo is a valid TPM_PCR_INFO structure
1011 ii. Create h2 the composite hash of the PCR selected by S2 -> pcrInfo -> pcrSelection
1012 b. If V1 is 2 then
1013 i. Validate that S2 -> pcrInfo is a valid TPM_PCR_INFO_LONG structure
1014 ii. Create h2 the composite hash of the PCR selected by S2 -> pcrInfo ->
1015 releasePCRSelection
1016 iii. Check that S2 -> pcrInfo -> localityAtRelease for TPM_STANY_DATA ->
1017 localityModifier is TRUE
1018 iv. For example if TPM_STANY_DATA -> localityModifier was 2 then S2 -> pcrInfo
1019 -> localityAtRelease -> TPM_LOC_TWO would have to be TRUE
1020 c. Compare h2 with S2 -> pcrInfo -> digestAtRelease, on mismatch return
1021 TPM_WRONGPCRVAL
1022 9. If V1 is 2 and inData -> et specifies encryption then
1023 a. If inData -> et is TPM_ET_KEYXOR
1024 i. Use MGF1 to create string X1 of length sealedDataSize. The inputs to MGF1 are;
1025 nonceEven, nonceOdd, “XOR”, and parentAuth -> sharedSecret. The four
1026 concatenated values form the Z value that is the seed for MFG1.
1027 ii. Create o1 by XOR of d1 -> data and X1
1028 b. Else
1029 i. Create o1 by encrypting encAuth using the algorithm indicated by inData -> et
1030 ii. Key is from parentAuth -> sharedSecret
1031 iii. IV is SHA-1 of (authLastNonceEven || nonceOdd)
1032 10. else

Level 2 Revision 85 13 February 2005 Published 59


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1033 a. Set o1 to d1 -> data


1034 11. Set the return secret as o1
1035 12. Return TPM_SUCCESS

60 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1036 10.3 TPM_UnBind


1037 Start of informative comment:
1038 TPM_UnBind takes the data blob that is the result of a Tspi_Data_Bind command and
1039 decrypts it for export to the User. The caller must authorize the use of the key that will
1040 decrypt the incoming blob.
1041 TPM_UnBInd operates on a block-by-block basis, and has no notion of any relation between
1042 one block and another.
1043 End of informative comment.

1044 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_UnBind.
The keyHandle identifier of a loaded key that can perform UnBind
4 4 TPM_KEY_HANDLE keyHandle
operations.
5 4 2S 4 UINT32 inDataSize The size of the input blob
6 <> 3S <> BYTE[ ] inData Encrypted blob to be decrypted

7 4 TPM_AUTHHANDLE authHandle The handle used for keyHandle authorization


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest that authorizes the inputs and use of
10 20 TPM_AUTHDATA privAuth
keyHandle. HMAC key: key.usageAuth.

Level 2 Revision 85 13 February 2005 Published 61


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1045 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_UnBind
4 4 3S 4 UINT32 outDataSize The length of the returned decrypted data
5 <> 4S <> BYTE[ ] outData The resulting decrypted data.

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
8 20 TPM_AUTHDATA resAuth
key.usageAuth.

1046 Description
1047 UnBind SHALL operate on a single block only.

1048 Actions
1049 The TPM SHALL perform the following:
1050 1. If the inDataSize is 0 the TPM returns TPM_BAD_PARAMETER
1051 2. Validate the AuthData to use the key pointed to by keyHandle
1052 3. If the keyUsage field of the key referenced by keyHandle does not have the value
1053 TPM_KEY_BIND or TPM_KEY_LEGACY, the TPM must return the error code
1054 TPM_INVALID_KEYUSAGE
1055 4. Decrypt the inData using the key pointed to by keyHandle
1056 5. if (keyHandle -> encScheme does not equal TPM_ES_RSAESOAEP_SHA1_MGF1) and
1057 (keyHandle -> keyUsage equals TPM_KEY_LEGACY),
1058 a. The payload does not have TPM specific markers to validate, so no consistency check
1059 can be performed.
1060 b. Set the output parameter outData to the value of the decrypted value of inData.
1061 (Padding associated with the encryption wrapping of inData SHALL NOT be
1062 returned.)
1063 c. Set the output parameter outDataSize to the size of outData, as deduced from the
1064 decryption process.
1065 6. else
1066 a. Interpret the decrypted data under the assumption that it is a TPM_BOUND_DATA
1067 structure, and validate that the payload type is TPM_PT_BIND

62 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1068 b. Set the output parameter outData to the value of TPM_BOUND_DATA ->
1069 payloadData. (Other parameters of TPM_BOUND_DATA SHALL NOT be returned.
1070 Padding associated with the encryption wrapping of inData SHALL NOT be returned.)
1071 c. Set the output parameter outDataSize to the size of outData, as deduced from the
1072 decryption process and the interpretation of TPM_BOUND_DATA.
1073 7. Return the output parameters.

Level 2 Revision 85 13 February 2005 Published 63


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1074 10.4 TPM_CreateWrapKey


1075 Start of informative comment:
1076 The TPM_CreateWrapKey command both generates and creates a secure storage bundle for
1077 asymmetric keys.
1078 The newly created key can be locked to a specific PCR value by specifying a set of PCR
1079 registers.
1080 End of informative comment.

1081 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CreateWrapKey
4 4 TPM_KEY_HANDLE parentHandle Handle of a loaded key that can perform key wrapping.
5 20 2S 20 TPM_ENCAUTH dataUsageAuth Encrypted usage AuthData for the sealed data.
6 20 3S 20 TPM_ENCAUTH dataMigrationAuth Encrypted migration AuthData for the sealed data.
Information about key to be created, pubkey.keyLength and
7 <> 4S <> TPM_KEY keyInfo
keyInfo.encData elements are 0. MAY be TPM_KEY12

8 4 TPM_AUTHHANDLE authHandle parent key authorization. Must be an OSAP session.


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
10 1 4H1 1 BOOL continueAuthSession Ignored
11 20 TPM_AUTHDATA pubAuth Authorization HMAC key: parentKey.usageAuth.

1082 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CreateWrapKey
The TPM_KEY structure which includes the public and encrypted private
4 <> 4S <> TPM_KEY wrappedKey
key. MAY be TPM_KEY12

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, fixed at FALSE
7 20 TPM_AUTHDATA resAuth Authorization HMAC key: parentKey.usageAuth.

64 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1083 Descriptions
1084 This command requires the encryption of two parameters. To create two XOR strings the
1085 caller combines the two nonces in use by the OSAP session with the session shared secret.
1086 DataUsageAuth is XOR'd with the SHA-1 hash of the concatenation of the OSAP session
1087 shared secret with the even numbered nonce generated by the TPM (authLastNonceEven).
1088 MigrationAuth is XOR'd with the SHA-1 hash of the concatenation of the OSAP session
1089 shared secret with the odd numbered nonce generated by the caller (nonceOdd).

1090 Actions
1091 The TPM SHALL do the following:
1092 1. Validate the AuthData to use the key pointed to by parentHandle. Return
1093 TPM_AUTHFAIL on any error.
1094 2. Validate the session type for parentHandle is OSAP.
1095 3. If the TPM is not designed to create a key of the type requested in keyInfo, return the
1096 error code TPM_BAD_KEY_PROPERTY
1097 4. Verify that parentHandle->keyUsage equals TPM_KEY_STORAGE
1098 5. If parentHandle -> keyFlags -> migratable is TRUE and keyInfo -> keyFlags -> migratable
1099 is FALSE then return TPM_INVALID_KEYUSAGE
1100 6. Validate key parameters
1101 a. keyInfo -> keyUsage MUST NOT be TPM_KEY_IDENTITY or
1102 TPM_KEY_AUTHCHANGE. If it is, return TPM_INVALID_KEYUSAGE
1103 b. If keyInfo -> keyFlags -> migrateAuthority is TRUE then return
1104 TPM_INVALID_KEYUSAGE
1105 7. If TPM_PERMANENT_FLAGS -> FIPS is TRUE then
1106 a. If keyInfo -> keySize is less than 1024 return TPM_NOTFIPS
1107 b. If keyInfo -> authDataUsage specifies TPM_AUTH_NEVER return TPM_NOTFIPS
1108 c. If keyInfo -> keyUsage specifies TPM_KEY_LEGACY return TPM_NOTFIPS
1109 8. If keyInfo -> keyUsage equals TPM_KEY_STORAGE or TPM_KEY_MIGRATE
1110 i. algorithmID MUST be TPM_ALG_RSA
1111 ii. encScheme MUST be TPM_ES_RSAESOAEP_SHA1_MGF1
1112 iii. sigScheme MUST be TPM_SS_NONE
1113 iv. key size MUST be 2048
1114 9. Determine the version of key
1115 a. If keyInfo -> ver is 1.1
1116 i. Set V1 to 1
1117 ii. Map wrappedKey to a TPM_KEY structure
1118 iii. Validate all remaining TPM_KEY structures

Level 2 Revision 85 13 February 2005 Published 65


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1119 b. Else if keyInfo -> tag is TPM_TAG_KEY12


1120 i. Set V1 to 2
1121 ii. Map wrappedKey to a TPM_KEY12 structure
1122 iii. Validate all remaining TPM_KEY12 structures
1123 10. If authHandle indicates XOR encryption for the AuthData secrets
1124 a. Create X1 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
1125 authLastNonceEven)
1126 b. Create X2 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
1127 nonceOdd)
1128 c. Create DU1 the XOR of DataUsageAuth and X1
1129 d. Create DM1 the XOR of DataMigrationAuth and X2
1130 11. Else
1131 a. Decrypt DataUsageAuth and DataMigrationAuth using the algorithm indicated in the
1132 OSAP session
1133 i. Create DU1 from DataUsageAuth
1134 ii. Create DM1 from DataMigrationAuth
1135 b. Key is from authHandle -> sharedSecret
1136 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
1137 12. Set continueAuthSession to FALSE
1138 13. Generate asymmetric key according to algorithm information in keyInfo
1139 14. Fill in the wrappedKey structure with information from the newly generated key.
1140 a. Set wrappedKey -> encData -> usageAuth to DU1
1141 b. If the KeyFlags -> migratable bit is set to 1, the wrappedKey -> encData ->
1142 migrationAuth SHALL contain the decrypted value from DataMigrationAuth.
1143 c. If the KeyFlags -> migratable bit is set to 0, and wrappedKey -> encData ->
1144 migrationAuth SHALL be set to the value tpmProof
1145 15. If keyInfo->PCRInfoSize is non-zero
1146 a. If V1 is 1
1147 i. Set wrappedKey -> pcrInfo to a TPM_PCR_INFO structure using the pcrSelection
1148 to indicate the PCR’s in use
1149 b. Else
1150 i. Set wrappedKey -> pcrInfo to a TPM_PCR_INFO_LONG structure
1151 c. Set digestAtCreation to the TPM_COMPOSITE_HASH indicated by
1152 creationPCRSelection
1153 d. If V1 is 2 set localityAtCreation to TPM_STANY_DATA -> locality
1154 16. Encrypt the private portions of the wrappedKey structure using the key in parentHandle

66 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1155 17. Return the newly generated key in the wrappedKey parameter

Level 2 Revision 85 13 February 2005 Published 67


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1156 10.5 TPM_LoadKey2


1157 Start of informative comment:
1158 Before the TPM can use a key to either wrap, unwrap, bind, unbind, seal, unseal, sign or
1159 perform any other action, it needs to be present in the TPM. The TPM_LoadKey function
1160 loads the key into the TPM for further use.
1161 The TPM assigns the key handle. The TPM always locates a loaded key by use of the handle.
1162 The assumption is that the handle may change due to key management operations. It is the
1163 responsibility of upper level software to maintain the mapping between handle and any
1164 label used by external software.
1165 This command has the responsibility of enforcing restrictions on the use of keys. For
1166 example, when attempting to load a STORAGE key it will be checked for the restrictions on
1167 a storage key (2048 size etc.).
1168 The load command must maintain a record of whether any previous key in the key
1169 hierarchy was bound to a PCR using parentPCRStatus.
1170 The flag parentPCRStatus enables the possibility of checking that a platform passed
1171 through some particular state or states before finishing in the current state. A grandparent
1172 key could be linked to state-1, a parent key could linked to state-2, and a child key could be
1173 linked to state-3, for example. The use of the child key then indicates that the platform
1174 passed through states 1 and 2 and is currently in state 3, in this example. The issue of
1175 TPM_Startup is with stType == TPM_ST_CLEAR is an indication that the platform has been
1176 reset, so the platform has not passed through the previous states. Hence keys with
1177 parentPCRStatus==TRUE must be unloaded if TPM_Startup is issued with stType ==
1178 TPM_ST_CLEAR.
1179 If a TPM_KEY structure has been decrypted AND the integrity test using "pubDataDigest"
1180 has passed AND the key is non-migratory, the key must have been created by the TPM. So
1181 there is every reason to believe that the key poses no security threat to the TPM. While there
1182 is no known attack from a rogue migratory key, there is a desire to verify that a loaded
1183 migratory key is a real key, arising from a general sense of unease about execution of
1184 arbitrary data as a key. Ideally a consistency check would consist of an encrypt/decrypt
1185 cycle, but this may be expensive. For RSA keys, it is therefore suggested that the
1186 consistency test consists of dividing the supposed RSA product by the supposed RSA prime,
1187 and checking that there is no remainder.
1188 End of informative comment.

1189 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_LoadKey2.
4 4 TPM_KEY_HANDLE parentHandle TPM handle of parent key.
Incoming key structure, both encrypted private and clear public portions.
5 <> 2S <> TPM_KEY inKey
MAY be TPM_KEY12

68 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

6 4 TPM_AUTHHANDLE authHandle The authorization session handle used for parentHandle authorization.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
7 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
8 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and parentHandle. HMAC
9 20 TPM_AUTHDATA parentAuth
key: parentKey.usageAuth.

1190 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_LoadKey2
4 4 TPM_KEY_HANDLE inkeyHandle Internal TPM handle where decrypted key was loaded.

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
7 20 TPM_AUTHDATA resAuth
parentKey.usageAuth.

1191 Actions
1192 The TPM SHALL perform the following steps:
1193 1. Validate the command and the parameters using parentAuth and parentHandle ->
1194 usageAuth
1195 2. If parentHandle -> keyUsage is NOT TPM_KEY_STORAGE return
1196 TPM_INVALID_KEYUSAGE
1197 3. If the TPM is not designed to operate on a key of the type specified by inKey, return the
1198 error code TPM_BAD_KEY_PROPERTY
1199 4. The TPM MUST handle both TPM_KEY and TPM_KEY12 structures
1200 5. Decrypt the inKey -> privkey to obtain TPM_STORE_ASYMKEY structure using the key
1201 in parentHandle
1202 6. Validate the integrity of inKey and decrypted TPM_STORE_ASYMKEY
1203 a. Reproduce inKey -> TPM_STORE_ASYMKEY -> pubDataDigest using the fields of
1204 inKey, and check that the reproduced value is the same as pubDataDigest
1205 7. Validate the consistency of the key and it’s key usage.
1206 a. If inKey -> keyFlags -> migratable is TRUE, the TPM SHALL verify consistency of the
1207 public and private components of the asymmetric key pair. If inKey -> keyFlags ->
1208 migratable is FALSE, the TPM MAY verify consistency of the public and private
1209 components of the asymmetric key pair. The consistency of an RSA key pair MAY be

Level 2 Revision 85 13 February 2005 Published 69


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1210 verified by dividing the supposed (P*Q) product by a supposed prime and checking
1211 that there is no remainder..
1212 b. If inKey -> keyUsage is TPM_KEY_IDENTITY, verify that inKey->keyFlags->migratable
1213 is FALSE. If it is not, return TPM_INVALID_KEYUSAGE
1214 c. If inKey -> keyUsage is TPM_KEY_AUTHCHANGE, return TPM_INVALID_KEYUSAGE
1215 d. If inKey -> keyFlags -> migratable equals 0 then verify that TPM_STORE_ASYMKEY -
1216 > migrationAuth equals TPM_PERMANENT_DATA -> tpmProof
1217 e. Validate the mix of encryption and signature schemes
1218 f. If TPM_PERMANENT_FLAGS -> FIPS is TRUE then
1219 i. If keyInfo -> keySize is less than 1024 return TPM_NOTFIPS
1220 ii. If keyInfo -> authDataUsage specifies TPM_AUTH_NEVER return TPM_NOTFIPS
1221 iii. If keyInfo -> keyUsage specifies TPM_KEY_LEGACY return TPM_NOTFIPS
1222 g. If inKey -> keyUsage is TPM_KEY_STORAGE or TPM_KEY_MIGRATE
1223 i. algorithmID MUST be TPM_ALG_RSA
1224 ii. Key size MUST be 2048
1225 iii. sigScheme MUST be TPM_SS_NONE
1226 h. If inKey -> keyUsage is TPM_KEY_IDENTITY
1227 i. algorithmID MUST be TPM_ALG_RSA
1228 ii. Key size MUST be 2048
1229 iii. encScheme MUST be TPM_ES_NONE
1230 i. If the decrypted inKey -> pcrInfo is NULL,
1231 i. The TPM MUST set the internal indicator to indicate that the key is not using any
1232 PCR registers.
1233 j. Else
1234 i. The TPM MUST store pcrInfo in a manner that allows the TPM to calculate a
1235 composite hash whenever the key will be in use
1236 ii. The TPM MUST handle both version 1.1 TPM_PCR_INFO and 1.2
1237 TPM_PCR_INFO_LONG structures according to the type of TPM_KEY structure
1238 iii. The TPM MUST validate the TPM_PCR_INFO or TPM_PCR_INFO_LONG
1239 structures
1240 8. Perform any processing necessary to make TPM_STORE_ASYMKEY key available for
1241 operations
1242 9. Load key and key information into internal memory of the TPM. If insufficient memory
1243 exists return error TPM_NOSPACE.
1244 10. Assign inKeyHandle according to internal TPM rules.
1245 11. Set InKeyHandle -> parentPCRStatus to parentHandle -> parentPCRStatus.

70 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1246 12. If ParentHandle indicates it is using PCR registers then set inKeyHandle ->
1247 parentPCRStatus to TRUE.

Level 2 Revision 85 13 February 2005 Published 71


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1248 10.6 TPM_GetPubKey


1249 Start of informative comment:
1250 The owner of a key may wish to obtain the public key value from a loaded key. This
1251 information may have privacy concerns so the command must have authorization from the
1252 key owner.
1253 End of informative comment.

1254 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_GetPubKey.
4 4 TPM_KEY_HANDLE keyHandle TPM handle of key.

5 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle authorization.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
6 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
8 20 TPM_AUTHDATA keyAuth Authorization HMAC key: key.usageAuth.

1255 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_GetPubKey.
4 <> 3S <> TPM_PUBKEY pubKey Public portion of key in keyHandle.

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
7 20 TPM_AUTHDATA resAuth Authorization. HMAC key: key.usageAuth.

1256 Actions
1257 The TPM SHALL perform the following steps:
1258 1. Validate the command the parameters using keyAuth, on error
1259 a. If keyHandle has TPM_AUTH_PRIV_USE_ONLY ignore the error
1260 b. Otherwise return TPM_AUTHFAIL
1261 2. If keyHandle == TPM_KH_SRK then

72 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1262 a. If TPM_PERMANENT_FLAGS -> readSRKPub is FALSE then return


1263 TPM_INVALID_KEYHANDLE
1264 3. If keyHandle -> pcrInfoSize is not 0
1265 a. If keyHandle -> keyFlags has pcrIgnoredOnRead set to FALSE
1266 i. Create a digestAtRelease according to the specified PCR registers and compare to
1267 keyHandle -> digestAtRelease and if a mismatch return TPM_WRONGPCRVAL
1268 ii. If specified validate any locality requests
1269 4. Create a TPM_PUBKEY structure and return

Level 2 Revision 85 13 February 2005 Published 73


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1270 10.7 TPM_Sealx


1271 Start of informative comment:
1272 The SEALX command works exactly like the SEAL command with the additional
1273 requirement of encryption for the inData parameter. When using this command also places
1274 in the sealed blob the information that the unseal also requires encryption.
1275 SEALX requires the use of 1.2 data structures. The actions are the same as SEAL without
1276 the checks for 1.1 data structure usage.
1277 End of informative comment.

1278 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SealX
4 4 TPM_KEY_HANDLE keyHandle Handle of a loaded key that can perform seal operations.
The encrypted AuthData for the sealed data. The encryption key is the
5 20 2S 20 TPM_ENCAUTH encAuth
shared secret from the OSAP protocol.
6 4 3S 4 UINT32 pcrInfoSize The size of the pcrInfo parameter. If 0 there are no PCR registers in use
7 <> 4S <> TPM_PCR_INFO pcrInfo MUST use TPM_PCR_INFO_LONG.
8 4 5S 4 UINT32 inDataSize The size of the inData parameter
9 <> 6S <> BYTE[ ] inData The data to be sealed to the platform and any specified PCRs

The authorization session handle used for keyHandle authorization.


10 4 TPM_AUTHHANDLE authHandle
Must be an OSAP session for this command.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
11 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
12 1 4H1 1 BOOL continueAuthSession Ignored
The authorization session digest for inputs and keyHandle. HMAC key:
13 20 TPM_AUTHDATA pubAuth
key.usageAuth.

74 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1279 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Sealx
Encrypted, integrity-protected data object that is the result of the
4 <> 3S 4 TPM_STORED_DATA sealedData
TPM_Sealx operation.

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, fixed value of FALSE
The authorization session digest for the returned parameters. HMAC key:
7 20 TPM_AUTHDATA resAuth
key.usageAuth.

1280 Actions
1281 1. Validate the authorization to use the key pointed to by keyHandle
1282 2. If the inDataSize is 0 the TPM returns TPM_BAD_PARAMETER
1283 3. If the keyUsage field of the key indicated by keyHandle does not have the value
1284 TPM_KEY_STORAGE, the TPM must return the error code TPM_INVALID_KEYUSAGE.
1285 4. If the keyHandle points to a migratable key then the TPM MUST return the error code
1286 TPM_INVALID_KEY_USAGE.
1287 5. if pcrInfoSize is not 0 then
1288 a. If pcrInfo -> tag is not TPM_TAG_PCR_INFO_LONG return
1289 TPM_INVALID_STRUCTURE
1290 6. Create S1 a TPM_STORED_DATA12 structure
1291 7. Set s1 -> encDataSize to 0
1292 8. Set s1 -> encData to NULL
1293 9. Set s1 -> sealInfoSize to pcrInfoSize
1294 10. Set s1 -> sealInfo -> localityAtRelease to pcrInfo -> localityAtRelease
1295 11. If pcrInfoSize is not 0 then
1296 a. Validate pcrInfo as a valid TPM_PCR_INFO_LONG structure, return TPM_BADINDEX
1297 on error
1298 b. Set s1 -> sealInfo -> creationPCRSelection to pcrInfo -> creationPCRSelection
1299 c. Set s1 -> sealInfo -> releasePCRSelection to pcrInfo -> releasePCRSelection
1300 d. Set s1 -> sealInfo -> digestAtRelease to pcrInfo -> digestAtRelease
1301 e. Create h2 the composite hash of the PCR selected by pcrInfo -> creationPCRSelection
1302 f. Set s1 -> sealInfo -> digestAtCreation to h2

Level 2 Revision 85 13 February 2005 Published 75


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1303 g. Set s1 -> sealInfo -> localityAtCreation to TPM_STANY_DATA -> localityModifier


1304 12. Create s2 a TPM_SEALED_DATA structure
1305 13. If keyHandle indicates XOR encryption for the AuthData secrets
1306 a. Create X1 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
1307 authLastNonceEven)
1308 b. Create a1 by XOR X1 and encAuth
1309 c. Set s1 -> et to TPM_ET_KEYXOR
1310 14. Else
1311 a. Create a1 by decrypting encAuth using the algorithm indicated in the OSAP session
1312 b. Key is from authHandle -> sharedSecret
1313 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
1314 d. Set S1 -> et to algorithm indicated in the OSAP session
1315 15. The TPM provides NO validation of a1. Well-known values (like NULLS) are valid and
1316 possible.
1317 16. If keyHandle indicates XOR encryption
1318 a. Use MGF1 to create string X2 of length inDataSize. The inputs to MGF1 are;
1319 authLastNonceEven, nonceOdd, “XOR”, and authHandle -> sharedSecret. The four
1320 concatenated values form the Z value that is the seed for MFG1.
1321 b. Create o1 by XOR of inData and X2
1322 17. Else
1323 a. Create o1 by decrypting inData using the algorithm indicated by keyHandle
1324 b. Key is from authHandle -> sharedSecret
1325 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
1326 18. Create s2 a TPM_SEALED_DATA structure
1327 a. Set s2 -> payload to TPM_PT_SEAL
1328 b. Set s2 -> tpmProof to TPM_PERMANENT_DATA -> tpmProof
1329 c. Create h3 the SHA-1 of s1
1330 d. Set s2 -> storedDigest to h3
1331 e. Set s2 -> authData to a1
1332 f. Set s2 -> dataSize to inDataSize
1333 g. Set s2 -> data to o1
1334 19. Validate that the size of s2 can be encrypted by the key pointed to by keyHandle, return
1335 TPM_BAD_DATASIZE on error
1336 20. Create s3 the encryption of s2 using the key pointed to by keyHandle
1337 21. Set continueAuthSession to FALSE
1338 22. Set s1 -> encDataSize to the size of s3

76 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1339 23. Set s1 -> encData to s3


1340 24. Return s1 as sealedData

Level 2 Revision 85 13 February 2005 Published 77


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1341 11. Migration


1342 Start of informative comment:
1343 The migration of a key from one TPM to another is a vital aspect to many use models of the
1344 the TPM. The migration commands are the commands that allow this operation to occur.
1345 There are two types of migratable keys, the version 1.1 migratable keys and the version 1.2
1346 certifiable migratable keys.
1347 End of informative comment.

1348 11.1 TPM_CreateMigrationBlob


1349 Start of informative comment:
1350 The TPM_CreateMigrationBlob command implements the first step in the process of moving
1351 a migratable key to a new parent or platform. Execution of this command requires
1352 knowledge of the migrationAuth field of the key to be migrated.
1353 Migrate mode is generally used to migrate keys from one TPM to another for backup,
1354 upgrade or to clone a key on another platform. To do this, the TPM needs to create a data
1355 blob that another TPM can deal with. This is done by loading in a backup public key that
1356 will be used by the TPM to create a new data blob for a migratable key.
1357 The TPM Owner does the selection and authorization of migration public keys at any time
1358 prior to the execution of TPM_CreateMigrationBlob by performing the
1359 TPM_AuthorizeMigrationKey command.
1360 IReWrap mode is used to directly move the key to a new parent (either on this platform or
1361 another). The TPM simply re-encrypts the key using a new parent, and outputs a normal
1362 encrypted element that can be subsequently used by a TPM_LoadKey command.
1363 TPM_CreateMigrationBlob implicitly cannot be used to migrate a non-migratory key. No
1364 explicit check is required. Only the TPM knows tpmProof. Therefore it is impossible for the
1365 caller to submit an AuthData value equal to tpmProof and migrate a non-migratory key.
1366 End of informative comment.

78 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1367 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CreateMigrationBlob
4 4 TPM_KEY_HANDLE parentHandle Handle of the parent key that can decrypt encData.
5 2 2S 2 TPM_MIGRATE_SCHEME migrationType The migration type, either MIGRATE or REWRAP
6 <> 3S <> TPM_MIGRATIONKEYAUTH migrationKeyAuth Migration public key and its authorization session digest.
7 4 4S 4 UINT32 encDataSize The size of the encData parameter
8 <> 5S <> BYTE[ ] encData The encrypted entity that is to be modified.

9 4 TPM_AUTHHANDLE parentAuthHandle The authorization session handle used for the parent key.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
10 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with parentAuthHandle
11 1 4H1 1 BOOL continueAuthSession Continue use flag for parent session
12 20 20 TPM_AUTHDATA parentAuth Authorization HMAC key: parentKey.usageAuth.

13 4 TPM_AUTHHANDLE entityAuthHandle The authorization session handle used for the encrypted entity.
2H2 20 TPM_NONCE entitylastNonceEven Even nonce previously generated by TPM
14 20 3H2 20 TPM_NONCE entitynonceOdd Nonce generated by system associated with entityAuthHandle
15 1 4H2 1 BOOL continueEntitySession Continue use flag for entity session
16 20 TPM_AUTHDATA entityAuth Authorization HMAC key: entity.migrationAuth.

1368

Level 2 Revision 85 13 February 2005 Published 79


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1369 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CreateMigrationBlob
4 4 3S 4 UINT32 randomSize The used size of the output area for random
5 <> 4S <> BYTE[ ] random String used for xor encryption
6 4 5S 4 UINT32 outDataSize The used size of the output area for outData
7 <> 6S <> BYTE[ ] outData The modified, encrypted entity.

8 20 3H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
4H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with parentAuthHandle
9 1 5H1 1 BOOL continueAuthSession Continue use flag for parent key session
10 20 20 TPM_AUTHDATA resAuth Authorization. HMAC key: parentKey.usageAuth.

11 20 3H2 20 TPM_NONCE entityNonceEven Even nonce newly generated by TPM to cover entity
4H2 20 TPM_NONCE entitynonceOdd Nonce generated by system associated with entityAuthHandle
12 1 5 H2 1 BOOL continueEntitySession Continue use flag for entity session
13 20 TPM_AUTHDATA entityAuth Authorization HMAC key: entity.migrationAuth.

1370 Description
1371 The TPM does not check the PCR values when migrating values locked to a PCR.
1372 The second authorisation session (using entityAuth) MUST be OIAP because OSAP does not
1373 have a suitable entityType

1374 Actions
1375 1. Validate that parentAuth authorizes the use of the key pointed to by parentHandle.
1376 2. Create d1 a TPM_STORE_ASYMKEY structure by decrypting encData using the key
1377 pointed to by parentHandle.
1378 3. Validate that entityAuth authorizes the migration of d1. The validation MUST use d1 ->
1379 migrationAuth as the secret.
1380 4. Verify that the digest within migrationKeyAuth is legal for this TPM and public key
1381 5. If migrationType == TPM_MS_MIGRATE the TPM SHALL perform the following actions:
1382 a. Build two bytes array, K1 and K2:
1383 i. K1 = d1.privKey[0..19] (d1.privKey.keyLength + 16 bytes of d1.privKey.key),
1384 sizeof(K1) = 20
1385 ii. K2 = d1.privKey[20..131] (position 16-127 of d1 . privKey.key), sizeof(K2) = 112
1386 b. Build M1 a TPM_MIGRATE_ASYMKEY structure
1387 i. TPM_MIGRATE_ASYMKEY.payload = TPM_PT_MIGRATE

80 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1388 ii. TPM_MIGRATE_ASYMKEY.usageAuth = d1.usageAuth


1389 iii. TPM_MIGRATE_ASYMKEY.pubDataDigest = d1. pubDataDigest
1390 iv. TPM_MIGRATE_ASYMKEY.partPrivKeyLen = 112 – 127.
1391 v. TPM_MIGRATE_ASYMKEY.partPrivKey = K2
1392 c. Create o1 (which SHALL be 198 bytes for a 2048 bit RSA key) by performing the
1393 OAEP encoding of m using OAEP parameters of
1394 i. m = M1 the TPM_MIGRATE_ASYMKEY structure
1395 ii. pHash = d1->migrationAuth
1396 iii. seed = s1 = K1
1397 d. Create r1 a random value from the TPM RNG. The size of r1 MUST be the size of o1.
1398 Return r1 in the Random parameter.
1399 e. Create x1 by XOR of o1 with r1
1400 f. Copy r1 into the output field “random”.
1401 g. Encrypt x1 with the migration public key included in migrationKeyAuth.
1402 6. If migrationType == TPM_MS_REWRAP the TPM SHALL perform the following actions:
1403 a. Rewrap the key using the public key in migrationKeyAuth, keeping the existing
1404 contents of that key.
1405 b. Set randomSize to 0 in the output parameter array
1406 7. Else
1407 a. Return TPM_BAD_PARAMETER

Level 2 Revision 85 13 February 2005 Published 81


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1408 11.2 TPM_ConvertMigrationBlob


1409 Start of informative comment:
1410 This command takes a migration blob and creates a normal wrapped blob. The migrated
1411 blob must be loaded into the TPM using the normal TPM_LoadKey function.
1412 Note that the command migrates private keys, only. The migration of the associated public
1413 keys is not specified by TPM because they are not security sensitive. Migration of the
1414 associated public keys may be specified in a platform specific specification. A TPM_KEY
1415 structure must be recreated before the migrated key can be used by the target TPM in a
1416 LoadKey command.
1417 End of informative comment.

1418 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ConvertMigrationBlob.
4 4 TPM_KEY_HANDLE parentHandle Handle of a loaded key that can decrypt keys.
5 4 2S 4 UINT32 inDataSize Size of inData
6 <> 3S <> BYTE [ ] inData The XOR’d and encrypted key
7 4 4S 4 UINT32 randomSize Size of random
8 <> 5S <> BYTE [ ] random Random value used to hide key data.

9 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle.


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
10 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
11 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest that authorizes the inputs and the
12 20 TPM_AUTHDATA parentAuth
migration of the key in parentHandle. HMAC key: parentKey.usageAuth

1419

82 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1420 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ConvertMigrationBlob
4 4 3S 4 UINT32 outDataSize The used size of the output area for outData
5 <> 4S <> BYTE[ ] outData The encrypted private key that can be loaded with TPM_LoadKey

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
8 20 TPM_AUTHDATA resAuth
parentKey.usageAuth

1421 Action
1422 The TPM SHALL perform the following:
1423 1. Validate the AuthData to use the key in parentHandle
1424 2. If the keyUsage field of the key referenced by parentHandle does not have the value
1425 TPM_KEY_STORAGE, the TPM must return the error code TPM_INVALID_KEYUSAGE
1426 3. Create d1 by decrypting the inData area using the key in parentHandle
1427 4. Create o1 by XOR d1 and random parameter
1428 5. Create m1 a TPM_MIGRATE_ASYMKEY structure
1429 6. Verify that m1 -> payload == TPM_PT_MIGRATE
1430 7. Create k1 by combining seed and the TPM_MIGRATE_ASYMKEY -> partPrivKey field
1431 8. Create d2 a TPM_STORE_ASYMKEY structure
1432 a. Verify that m1 -> payload == TPM_PT_MIGRATE
1433 b. Set d2 -> payload = TPM_PT_MIGRATE
1434 c. Set d2 -> usageAuth to m1 -> usageAuth
1435 d. Set d2 -> migrationAuth to pHash
1436 e. Set d2 -> pubDataDigest to m1 -> pubDataDigest
1437 f. Set d2 -> privKey field to k1
1438 9. Create outData using the key in parentHandle to perform the encryption

Level 2 Revision 85 13 February 2005 Published 83


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1439 11.3 TPM_AuthorizeMigrationKey


1440 Start of informative comment:
1441 This command creates an authorization blob, to allow the TPM owner to specify which
1442 migration facility they will use and allow users to migrate information without further
1443 involvement with the TPM owner.
1444 It is the responsibility of the TPM Owner to determine whether migrationKey is appropriate
1445 for migration. The TPM checks just the cryptographic strength of migrationKey.
1446 End of informative comment.

1447 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_AuthorizeMigrationKey
4 2 2S 2 TPM_MIGRATE_SCHEME migrationScheme Type of migration operation that is to be permitted for this key.
4 <> 3S <> TPM_PUBKEY migrationKey The public key to be authorized.

5 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
6 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and owner authorization.
8 20 TPM_AUTHDATA ownerAuth
HMAC key: ownerAuth.

1448 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_AuthorizeMigrationKey
4 <> 3S <> TPM_MIGRATIONKEYAUTH outData Returned public key and authorization session digest.

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC
7 20 TPM_AUTHDATA resAuth
key: ownerAuth.
1449

1450 Action
1451 The TPM SHALL perform the following:

84 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1452 1. Check that the cryptographic strength of migrationKey is at least that of a 2048 bit RSA
1453 key. If migrationKey is an RSA key, this means that migrationKey MUST be 2048 bits or
1454 greater
1455 2. Validate the AuthData to use the TPM by the TPM Owner
1456 3. Create a f1 a TPM_MIGRATIONKEYAUTH structure
1457 4. Verify that migrationKey-> algorithmParms -> encScheme is
1458 TPM_ES_RSAESOAEP_SHA1_MGF1, and return the error code
1459 TPM_INAPPROPRIATE_ENC if it is not
1460 5. Set f1 -> migrationKey to the input migrationKey
1461 6. Set f1 -> migrationScheme to the input migrationScheme
1462 7. Create v1 by concatenating (migrationKey || migrationScheme ||
1463 TPM_PERMANENT_DATA -> tpmProof)
1464 8. Create h1 by performing a SHA1 hash of v1
1465 9. Set f1 -> digest to h1
1466 10. Return f1 as outData

Level 2 Revision 85 13 February 2005 Published 85


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1467 11.4 TPM_MigrateKey


1468 Start of informative comment:
1469 The TPM_MigrateKey command performs the function of a migration authority.
1470 The command is relatively simple; it just decrypts the input packet (coming from
1471 TPM_CreateMigrationBlob or TPM_CMK_CreateBlob) and then re-encrypts it with the input
1472 public key. The output of this command would then be sent to TPM_ConvertMigrationBlob
1473 or TPM_CMK_ConvertMigration on the target TPM.
1474 TPM_MigrateKey does not make ANY assumptions about the contents of the encrypted blob.
1475 Since it does not have the XOR string, it cannot actually determine much about the key
1476 that is being migrated.
1477 This command exists to permit the TPM to be a migration authority. If used in this way, it is
1478 expected that the physical security of the system containing the TPM and the AuthData
1479 value for the MA key would be tightly controlled.
1480 To prevent the execution of this command using any other key as a parent key, this
1481 command works only if keyUsage for maKeyHandle is TPM_KEY_MIGRATE.
1482 End of informative comment.

1483 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_MigrateKey
4 4 TPM_KEY_HANDLE maKeyHandle Handle of the key to be used to migrate the key.
5 <> 2S <> TPM_PUBKEY pubKey Public key to which the blob is to be migrated
6 4 3S 4 UINT32 inDataSize The size of inData
7 <> 4S <> BYTE[ ] inData The input blob

8 4 TPM_AUTHHANDLE maAuthHandle The authorization session handle used for maKeyHandle.


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with certAuthHandle
10 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for the inputs and key to be signed.
11 20 TPM_AUTHDATA keyAuth
HMAC key: maKeyHandle.usageAuth.

86 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1484 Outgoing Operands and Sizes


Param HMAC
Type Name Description
# Sz # Sz

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal TPM_ORD_MigrateKey
4 4 3S 4 UINT32 outDataSize The used size of the output area for outData
5 <> 4S <> BYTE[ ] outData The re-encrypted blob

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM


3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with certAuthHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag for cert key session
The authorization session digest for the target key. HMAC key:
8 20 TPM_AUTHDATA keyAuth
maKeyHandle.usageAuth

1485 Actions
1486 1. Validate that keyAuth authorizes the use of the key pointed to by maKeyHandle
1487 2. The TPM validates that the key pointed to by maKeyHandle has a key usage value of
1488 TPM_KEY_MIGRATE, and that the allowed encryption scheme is
1489 TPM_ES_RSAESOAEP_SHA1_MGF1.
1490 3. The TPM validates that pubKey is of a size supported by the TPM and that its size is
1491 consistent with the input blob and maKeyHandle.
1492 4. The TPM decrypts inData and re-encrypts it using pubKey.

Level 2 Revision 85 13 February 2005 Published 87


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1493 11.5 TPM_CMK_SetRestrictions


1494 Start of informative comment:
1495 This command is used by the Owner to dictate the usage of a certified-migration key with
1496 delegated authorisation (authorisation other than actual owner authorisation).
1497 This command is provided for privacy reasons and must not itself be delegated, because a
1498 certified-migration-key may involve a contractual relationship between the Owner and an
1499 external entity.
1500 End of informative comment.

1501 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes incl. paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Ordinal: TPM_ORD_CMK_SetRestrictions
4 4 2S 4 TPM_CMK_DELEGATE restriction The bit mask of how to set the restrictions on CMK keys

5 4 TPM_AUTHHANDLE authHandle The authorization session handle TPM Owner authentication


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
6 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
8 20 TPM_AUTHDATA ownerAuth The authorization session digest. HMAC key:ownerAuth

1502 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes
3 4 1S 4 TPM_RESULT returnCode The return code of the operation
2S 4 TPM_COMMAND_CODE ordinal Ordinal: TPM_ORD_CMK_SetRestrictions

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
6 20 TPM_AUTHDATA resAuth Authorization HMAC key: ownerAuth.

1503 Actions
1504 1. If TPM Owner is installed
1505 a. Validate the ordinal and parameters using TPM Owner authentication, return
1506 TPM_AUTHFAIL on error
1507 2. Else

88 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1508 a. If no assertion of physical presence the TPM MUST return TPM_BAD_PRESENCE


1509 3. Set TPM_PERMANENT_DATA -> TPM_CMK_DELEGATE -> restrictDelegate = restriction
1510 4. Return TPM_SUCCESS

Level 2 Revision 85 13 February 2005 Published 89


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1511 11.6 TPM_CMK_ApproveMA


1512 Start of informative comment:
1513 This command creates an authorization ticket, to allow the TPM owner to specify which
1514 Migration Authorities they approve and allow users to create certified-migration-keys
1515 without further involvement with the TPM owner.
1516 It is the responsibility of the TPM Owner to determine whether a particular Migration
1517 Authority is suitable to control migration
1518 End of informative comment.

1519 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_CMK_ApproveMA
A digest of a TPM_MSA_COMPOSITE structure (itself one or more
4 20 2S 20 TPM_DIGEST migrationAuthorityDigest
digests of public keys belonging to migration authorities)

5 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
6 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
8 20 TPM_AUTHDATA ownerAuth Authorization HMAC, key: ownerAuth.

1520 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_CMK_ApproveMA
4 20 3S 20 TPM_HMAC outData HMAC of migrationAuthorityDigest

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
7 20 TPM_AUTHDATA resAuth Authorization HMAC, key: ownerAuth.

1521 Action
1522 The TPM SHALL perform the following:
1523 5. Validate the AuthData to use the TPM by the TPM Owner
1524 6. Create M2 a TPM_CMK_MA_APPROVAL structure

90 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1525 a. Set M2 ->migrationAuthorityDigest to migrationAuthorityDigest


1526 7. Set outData = HMAC(M2) using tpmProof as the secret
1527 8. Return TPM_SUCCESS

Level 2 Revision 85 13 February 2005 Published 91


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1528 11.7 TPM_CMK_CreateKey


1529 Start of informative comment:
1530 The TPM_CMK_CreateKey command both generates and creates a secure storage bundle for
1531 asymmetric keys whose migration is controlled by a migration authority.
1532 TPM_CMK_CreateKey is very similar to TPM_CreateWrapKey, but: (1) the resultant key must
1533 be a migratable key and can be migrated only by TPM_CMK_CreateBlob; (2) the command is
1534 Owner authorized via a ticket.
1535 TPM_CMK_CreateKey creates an otherwise normal migratable key except that (1)
1536 migrationAuth is an HMAC of the migration authority and the new key’s public key, signed
1537 by tpmProof (instead of being tpmProof); (2) the migrationAuthority bit is set TRUE; (3) the
1538 payload type is TPM_PT_MIGRATE_RESTRICTED.
1539 The migration-selection/migration authority is specified by passing in a public key (actually
1540 the digests of one or more public keys, so more than one migration authority can be
1541 specified).
1542 End of informative comment.

1543 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_CreateKey
4 4 TPM_KEY_HANDLE parentHandle Handle of a loaded key that can perform key wrapping.
5 20 2S 20 TPM_ENCAUTH dataUsageAuth Encrypted usage AuthData for the sealed data.
Information about key to be created, pubkey.keyLength and
6 <> 3S <> TPM_KEY12 keyInfo
keyInfo.encData elements are 0. MUST be TPM_KEY12
A ticket, created by the TPM Owner using TPM_CMK_ApproveMA,
7 20 4S 20 TPM_HMAC migrationAuthorityApproval
approving a TPM_MSA_COMPOSITE structure
8 20 5S 20 TPM_DIGEST migrationAuthorityDigest The digest of a TPM_MSA_COMPOSITE structure

The authorization session handle used for parent key authorization.


9 4 TPM_AUTHHANDLE authHandle
Must be an OSAP session.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
10 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
11 1 4H1 1 BOOL continueAuthSession Ignored
The authorization session digest that authorizes the use of the public
12 20 TPM_AUTHDATA pubAuth
key in parentHandle. HMAC key: parentKey.usageAuth.

92 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1544 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_CreateKey
The TPM_KEY structure which includes the public and encrypted private
4 <> 3S <> TPM_KEY12 wrappedKey
key. MUST be TPM_KEY12

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, fixed at FALSE
The authorization session digest for the returned parameters. HMAC key:
7 20 TPM_AUTHDATA resAuth
parentKey.usageAuth.

1545 Actions
1546 The TPM SHALL do the following:
1547 1. Validate the AuthData to use the key pointed to by parentHandle. Return
1548 TPM_AUTHFAIL on any error
1549 2. Validate the session type for parentHandle is OSAP
1550 3. If the TPM is not designed to create a key of the type requested in keyInfo, return the
1551 error code TPM_BAD_KEY_PROPERTY
1552 4. Verify that parentHandle->keyUsage equals TPM_KEY_STORAGE
1553 5. Verify that parentHandle-> keyFlags-> migratable == FALSE and parentHandle->
1554 encData -> migrationAuth == tpmProof
1555 6. If keyInfo -> keyFlags -> migratable is FALSE, return TPM_INVALID_KEYUSAGE
1556 7. If keyInfo -> keyFlags -> migrateAuthority is FALSE , return TPM_INVALID_KEYUSAGE
1557 8. Verify that the migration authority is authorized
1558 a. Create M1 a TPM_CMK_MA_APPROVAL structure
1559 i. Set M1 ->migrationAuthorityDigest to migrationAuthorityDigest
1560 b. Verify that migrationAuthorityApproval == HMAC(M1) using tpmProof as the secret
1561 and return error TPM_MA_AUTHORITY on mismatch
1562 9. Validate key parameters
1563 a. keyInfo -> keyUsage MUST NOT be TPM_KEY_IDENTITY or
1564 TPM_KEY_AUTHCHANGE. If it is, return TPM_INVALID_KEYUSAGE
1565 10. If TPM_PERMANENT_FLAGS -> FIPS is TRUE then
1566 a. If keyInfo -> keySize is less than 1024 return TPM_NOTFIPS
1567 b. If keyInfo -> authDataUsage specifies TPM_AUTH_NEVER return TPM_NOTFIPS

Level 2 Revision 85 13 February 2005 Published 93


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1568 c. If keyInfo -> keyUsage specifies TPM_KEY_LEGACY return TPM_NOTFIPS


1569 11. If keyInfo -> keyUsage equals TPM_KEY_STORAGE or TPM_KEY_MIGRATE
1570 a. algorithmID MUST be TPM_ALG_RSA
1571 b. encScheme MUST be TPM_ES_RSAESOAEP_SHA1_MGF1
1572 c. sigScheme MUST be TPM_SS_NONE
1573 d. key size MUST be 2048
1574 12. If keyinfo -> tag is NOT TPM_TAG_KEY12 return error TPM_INVALID_STRUCTURE
1575 13. Map wrappedKey to a TPM_KEY12 structure
1576 14. If authHandle indicates XOR encryption for the AuthData secrets
1577 a. Create X1 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
1578 authLastNonceEven)
1579 b. Create DU1 by XOR X1 and dataUsageAuth
1580 15. Else
1581 a. Create DU1 by decrypting dataUsageAuth using the algorithm indicated in the OSAP
1582 session
1583 b. Key is from authHandle -> sharedSecret
1584 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
1585 16. Set continueAuthSession to FALSE
1586 17. Generate asymmetric key according to algorithm information in keyInfo
1587 18. Fill in the wrappedKey structure with information from the newly generated key.
1588 a. Set wrappedKey -> encData -> usageAuth to DU1
1589 b. Set wrappedKey -> encData -> payload to TPM_PT_MIGRATE_RESTRICTED
1590 c. Create thisPubKey, a TPM_PUBKEY structure containing wrappedKey’s public key
1591 and algorithm parameters
1592 d. Create M2 a TPM_CMK_MIGAUTH structure
1593 i. Set M2 -> msaDigest to migrationAuthorityDigest
1594 ii. Set M2 -> pubKeyDigest to SHA-1 (thisPubKey)
1595 e. Set wrappedKey -> encData -> migrationAuth equal to HMAC(M2), using tpmProof
1596 as the shared secret
1597 19. If wrappedKey->PCRInfoSize is non-zero
1598 a. Set wrappedKey -> pcrInfo to a TPM_PCR_INFO_LONG structure
1599 b. Set digestAtCreation to the TPM_COMPOSITE_HASH indicated by
1600 creationPCRSelection
1601 c. Set localityAtCreation to TPM_STANY_FLAGS -> localityModifier
1602 20. Encrypt the private portions of the wrappedKey structure using the key in parentHandle
1603 21. Return the newly generated key in the wrappedKey parameter

94 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1604 11.8 TPM_CMK_CreateTicket


1605 Start of informative comment:
1606 The TPM_CMK_CreateTicket command uses a public key to verify the signature over a
1607 digest.
1608 TPM_CMK_CreateTicket returns a ticket that can be used to prove to the same TPM that
1609 signature verification with a particular public key was successful.
1610 End of informative comment.

1611 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_CreateTicket
4 <> 2S <> TPM_PUBKEY verificationKey The public key to be used to check signatureValue
5 20 3S 20 TPM_DIGEST signedData The data to be signed
6 4 4S 4 UINT32 signatureValueSize The size of the signatureValue
7 <> 5S <> BYTE[] signatureValue The signatureValue to be verified

8 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
10 1 4H1 1 BOOL continueAuthSession Ignored
The authorization session digest for inputs and owner. HMAC key:
11 20 TPM_AUTHDATA pubAuth
ownerAuth.

Level 2 Revision 85 13 February 2005 Published 95


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1612 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_CreateTicket
4 20 3S 20 TPM_HMAC sigTicket Ticket that proves digest created on this TPM

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag
7 20 TPM_AUTHDATA resAuth Authorization. HMAC key:. ownerAuth.

1613 Actions
1614 The TPM SHALL do the following:
1615 1. Validate the TPM Owner authentication to use the command
1616 2. Validate that the key type and algorithm are correct
1617 a. Validate that verificationKey -> algorithmParms -> algorithmID == TPM_ALG_RSA
1618 b. Validate that verificationKey -> algorithmParms ->encScheme == TPM_ES_NONE
1619 c. Validate that verificationKey ->algorithmParms ->sigScheme is a signature scheme
1620 supported by the TPM
1621 3. Use verificationKey to verify that signatureValue is a valid signature on signedData, and
1622 return error TPM_BAD_SIGNATURE on mismatch
1623 4. Create M2 a TPM_CMK_SIGTICKET
1624 a. Set M2 -> verKeyDigest to the SHA-1 (verificationKey)
1625 b. Set M2 -> signedData to signedData
1626 5. Set sigTicket = HMAC(M2) signed by using tpmProof as the secret
1627 6. Return TPM_SUCCESS

96 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1628 11.9 TPM_CMK_CreateBlob


1629 Start of informative comment:
1630 TPM_CMK_CreateBlob command is very similar to TPM_CreateMigrationBlob, except that it:
1631 (1) uses an extra ticket (restrictedKeyAuth) instead of a migrationAuth authorization
1632 session; (2) uses the migration options TPM_MS_RESTRICT_MIGRATE or
1633 TPM_MS_RESTRICT_APPROVE_DOUBLE; (3) produces a wrapped key blob whose
1634 migrationAuth is independent of tpmProof.
1635 If the destination (parent) public key is the MA, migration is implicitly permitted. Further
1636 checks are required if the MA is not the destination (parent) public key, and merely selects
1637 a migration destination: (1) sigTicket must prove that restrictTicket was signed by the MA;
1638 (2) restrictTicket must vouch that the target public key is approved for migration to the
1639 destination (parent) public key. (Obviously, this more complex method may also be used by
1640 an MA to approve migration to that MA.) In both cases, the MA must be one of the MAs
1641 implicitly listed in the migrationAuth of the target key-to-be-migrated.
1642 End of informative comment.

Level 2 Revision 85 13 February 2005 Published 97


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1643 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_CreateBlob
4 4 TPM_KEY_HANDLE parentHandle Handle of the parent key that can decrypt encData.
The migration type, either TPM_MS_RESTRICT_MIGRATE or
5 2 2S 2 TPM_MIGRATE_SCHEME migrationType
TPM_MS_RESTRICT_APPROVE_DOUBLE
6 <> 3S <> TPM_MIGRATIONKEYAUTH migrationKeyAuth Migration public key and its authorization session digest.
7 20 4S 20 TPM_DIGEST pubSourceKeyDigest The digest of the TPM_PUBKEY of the entity to be migrated
The size of the msaList parameter, which is a variable length
8 4 5S 4 UINT32 msaListSize
TPM_MSA_COMPOSITE structure
9 <> 6S <> TPM_MSA_COMPOSITE msaList One or more digests of public keys belonging to migration authorities
The size of the restrictTicket parameter, which is a TPM_CMK_AUTH
10 4 7S 4 UINT32 restrictTicketSize
structure if migration type is TPM_MS_RESTRICT_APPROVE_DOUBLE
Either a NULL parameter or a TPM_CMK_AUTH structure, containing the
11 <> 8S <> BYTE[] restrictTicket digests of the public keys belonging to the Migration Authority, the
destination parent key and the key-to-be-migrated.
The size of the sigTicket parameter, which is a TPM_HMAC structure if
12 4 9S 4 UINT32 sigTicketSize
migration type is TPM_MS_RESTRICT_APPROVE_DOUBLE.
Either a NULL parameter or a TPM_HMAC structure, generated by the
13 <> 10S <> BYTE[] sigTicket
TPM, signaling a valid signature over restrictTicket
14 4 11S 4 UINT32 encDataSize The size of the encData parameter
15 <> 12S <> BYTE[] encData The encrypted entity that is to be modified.

16 4 TPM_AUTHHANDLE parentAuthHandle The authorization session handle used for the parent key.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
17 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with parentAuthHandle
18 1 4H1 1 BOOL continueAuthSession Continue use flag for parent session
19 20 20 TPM_AUTHDATA parentAuth HMAC key: parentKey.usageAuth.

98 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1644 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_CreateBlob
4 4 3S 4 UINT32 randomSize The used size of the output area for random
5 <> 4S <> BYTE[ ] random String used for xor encryption
6 4 5S 4 UINT32 outDataSize The used size of the output area for outData
7 <> 6S <> BYTE[ ] outData The modified, encrypted entity.

8 20 3H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
4H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with parentAuthHandle
9 1 5H1 1 BOOL continueAuthSession Continue use flag for parent key session
10 20 20 TPM_AUTHDATA resAuth HMAC key: parentKey.usageAuth.

1645 Description
1646 The TPM does not check the PCR values when migrating values locked to a PCR.

1647 Actions
1648 1. Validate that parentAuth authorizes the use of the key pointed to by parentHandle.
1649 2. Verify that parentHandle-> keyFlags-> migratable == FALSE and parentHandle->
1650 encData -> migrationAuth == tpmProof
1651 3. Create d1 by decrypting encData using the key pointed to by parentHandle.
1652 4. Verify that the digest within migrationKeyAuth is legal for this TPM and public key
1653 5. Verify that d1 -> payload == TPM_PT_MIGRATE_RESTRICTED or
1654 TPM_PT_MIGRATE_EXTERNAL
1655 6. Verify that migrationKeyAuth -> migrationScheme == TPM_MS_RESTRICT_MIGRATE or
1656 TPM_MS_RESTRICT_APPROVE_DOUBLE.
1657 7. Verify that the migration authorities in msaList are authorized to migrate this key
1658 a. Create M2 a TPM_CMK_MIGAUTH structure
1659 i. Set M2 -> msaDigest to SHA1[msaList]
1660 ii. Set M2 -> pubKeyDigest to pubSourceKeyDigest
1661 b. Verify that d1 -> migrationAuth == HMAC(M2) using tpmProof as the secret and
1662 return error TPM_MA_AUTHORITY on mismatch
1663 8. If migrationKeyAuth -> migrationScheme == TPM_MS_RESTRICT_MIGRATE
1664 a. Verify that intended migration destination is an MA:

Level 2 Revision 85 13 February 2005 Published 99


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1665 i. For one of n=1 to n=(msaList -> MSAlist), verify that SHA1[migrationKeyAuth ->
1666 migrationKey] == msaList -> migAuthDigest[n]
1667 b. Validate that the MA key is the correct type
1668 i. Validate that migrationKeyAuth -> migrationKey -> algorithmParms ->
1669 algorithmID == TPM_ALG_RSA
1670 ii. Validate that migrationKeyAuth -> migrationKey -> algorithmParms ->
1671 encScheme is an encryption scheme supported by the TPM
1672 iii. Validate that migrationKeyAuth -> migrationKey ->algorithmParms -> sigScheme
1673 is TPM_SS_NONE
1674 9. else If migrationKeyAuth -> migrationScheme ==
1675 TPM_MS_RESTRICT_APPROVE_DOUBLE,
1676 a. Verify that the intended migration destination has been approved by the MSA:
1677 i. Verify that for one of the n=1 to n=(msaList -> MSAlist) values of msaList ->
1678 migAuthDigest[n], sigTicket == HMAC (V1) using tpmProof as the secret where V1
1679 is a TPM_CMK_SIGTICKET structure such that:
1680 ii. V1 -> verKeyDigest = msaList -> migAuthDigest[n]
1681 iii. V1 -> signedData = SHA1[restrictTicket]
1682 iv. If [restrictTicket -> destinationKeyDigest] != SHA1[migrationKeyAuth ->
1683 migrationKey], return error TPM_MA_DESTINATION
1684 v. If [restrictTicket -> sourceKeyDigest] != pubSourceKeyDigest, return error
1685 TPM_MA_SOURCE
1686 10. Else return with error TPM_BAD_PARAMETER.
1687 11. Build two bytes array, K1 and K2, using d1:
1688 a. K1 = TPM_STORE_ASYMKEY.privKey[0..19]
1689 (TPM_STORE_ASYMKEY.privKey.keyLength + 16 bytes of
1690 TPM_STORE_ASYMKEY.privKey.key), sizeof(K1) = 20
1691 b. K2 = TPM_STORE_ASYMKEY.privKey[20..131] (position 16-127 of
1692 TPM_STORE_ASYMKEY . privKey.key), sizeof(K2) = 112
1693 12. Build M1 a TPM_MIGRATE_ASYMKEY structure
1694 a. TPM_MIGRATE_ASYMKEY.payload = TPM_PT_CMK_MIGRATE
1695 b. TPM_MIGRATE_ASYMKEY.usageAuth = TPM_STORE_ASYMKEY.usageAuth
1696 c. TPM_MIGRATE_ASYMKEY.pubDataDigest = TPM_STORE_ASYMKEY. pubDataDigest
1697 d. TPM_MIGRATE_ASYMKEY.partPrivKeyLen = 112 – 127.
1698 e. TPM_MIGRATE_ASYMKEY.partPrivKey = K2
1699 13. Create o1 (which SHALL be 198 bytes for a 2048 bit RSA key) by performing the OAEP
1700 encoding of m using OAEP parameters m, pHash, and seed
1701 a. m is the previously created M1
1702 b. pHash = SHA1( SHA1[msaList] || pubSourceKeyDigest)

100 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1703 c. seed = s1 = the previously created K1


1704 14. Create r1 a random value from the TPM RNG. The size of r1 MUST be the size of o1.
1705 Return r1 in the random parameter
1706 15. Create x1 by XOR of o1 with r1
1707 16. Copy r1 into the output field “random”
1708 17. Encrypt x1 with the migrationKeyAuth-> migrationKey

Level 2 Revision 85 13 February 2005 Published 101


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1709 11.10 TPM_CMK_ConvertMigration


1710 Start of informative comment:
1711 TPM_CMK_ConvertMigration completes the migration of certified migration blobs.
1712 This command takes a certified migration blob and creates a normal wrapped blob with
1713 payload type TPM_PT_MIGRATE_EXTERNAL. The migrated blob must be loaded into the
1714 TPM using the normal TPM_LoadKey function.
1715 Note that the command migrates private keys, only. The migration of the associated public
1716 keys is not specified by TPM because they are not security sensitive. Migration of the
1717 associated public keys may be specified in a platform specific specification. A TPM_KEY
1718 structure must be recreated before the migrated key can be used by the target TPM in a
1719 LoadKey command.
1720 TPM_CMK_ConvertMigration checks that one of the MAs implicitly listed in the
1721 migrationAuth of the target key has approved migration of the target key to the destination
1722 (parent) key, and that the settings (flags etc.) in the target key are those of a CMK.
1723 End of informative comment.

1724 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_ConvertMigration
4 4 TPM_KEY_HANDLE parentHandle Handle of a loaded key that can decrypt keys.
The digests of public keys belonging to the Migration Authority, the
5 60 2S 60 TPM_CMK_AUTH restrictTicket
destination parent key and the key-to-be-migrated.
A signature ticket, generated by the TPM, signaling a valid signature
6 20 3S 20 TPM_HMAC sigTicket
over restrictTicket
The public key of the key-to-be-migrated. The private portion MUST be
7 <> 4S <> TPM_KEY12 migratedKey
TPM_MIGRATE_ASYMKEY properly XOR’d
The size of the msaList parameter, which is a variable length
8 4 5S 4 UINT32 msaListSize
TPM_MSA_COMPOSITE structure
9 <> 6S <> TPM_MSA_COMPOSITE msaList One or more digests of public keys belonging to migration authorities
10 4 7S 4 UINT32 randomSize Size of random
11 <> 8S <> BYTE [ ] random Random value used to hide key data.

12 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle.


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
13 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
14 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
15 20 TPM_AUTHDATA parentAuth Authorization HMAC: parentKey.usageAuth

102 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1725 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CMK_ConvertMigration
4 4 3S 4 UINT32 outDataSize The used size of the output area for outData
5 <> 4S <> BYTE[ ] outData The encrypted private key that can be loaded with TPM_LoadKey

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
8 20 TPM_AUTHDATA resAuth Authorization HMAC key .usageAuth

1726 Action
1727 1. Validate the AuthData to use the key in parentHandle
1728 2. If the keyUsage field of the key referenced by parentHandle does not have the value
1729 TPM_KEY_STORAGE, the TPM must return the error code TPM_INVALID_KEYUSAGE
1730 3. Create d1 by decrypting the migratedKey -> encData area using the key in parentHandle
1731 4. Create o1 by XOR d1 and random parameter
1732 5. Create m1 a TPM_MIGRATE_ASYMKEY, seed and pHash by OAEP decoding o1
1733 6. Create migratedPubKey a TPM_PUBKEY structure corresponding to migratedKey
1734 a. Verify that pHash == SHA1( SHA1[msaList] || SHA1(migratedPubKey )
1735 7. Create k1 by combining seed and the TPM_MIGRATE_ASYMKEY -> partPrivKey field
1736 8. Create d2 a TPM_STORE_ASYMKEY structure.
1737 a. Set the TPM_STORE_ASYMKEY -> privKey field to k1
1738 b. Set d2 -> usageAuth to m1 -> usageAuth
1739 c. Set d2 -> pubDataDigest to m1 -> pubDataDigest
1740 9. Verify that parentHandle-> keyFlags -> migratable == FALSE and parentHandle->
1741 encData -> migrationAuth == tpmProof
1742 10. Verify that m1 -> payload == TPM_PT_CMK_MIGRATE then set d2-> payload =
1743 TPM_PT_MIGRATE_EXTERNAL
1744 11. Verify that for one of the n=1 to n=(msaList -> MSAlist) values of msaList ->
1745 migAuthDigest[n] sigTicket == HMAC (V1) using tpmProof as the secret where V1 is a
1746 TPM_CMK_SIGTICKET structure such that:
1747 a. V1 -> verKeyDigest = msaList -> migAuthDigest[n]
1748 b. V1 -> signedData = SHA1[restrictTicket]

Level 2 Revision 85 13 February 2005 Published 103


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1749 12. Create parentPubKey, a TPM_PUBKEY structure corresponding to parenthandle


1750 13. If [restrictTicket -> destinationKeyDigest] != SHA1(parentPubKey), return error
1751 TPM_MA_DESTINATION
1752 14. Verify that migratedKey is corresponding to d2
1753 15. If migratedKey -> keyFlags -> migratable is FALSE, and return error
1754 TPM_INVALID_KEYUSAGE
1755 16. If migratedKey -> keyFlags -> migrateAuthority is FALSE, return error
1756 TPM_INVALID_KEYUSAGE
1757 17. If [restrictTicket -> sourceKeyDigest] != SHA1(migratedPubKey), return error
1758 TPM_MA_SOURCE
1759 18. Create M2 a TPM_CMK_MIGAUTH structure
1760 a. Set M2 -> msaDigest to SHA1[msaList]
1761 b. Set M2 -> pubKeyDigest to SHA1[migratedPubKey]
1762 19. Set d2 -> migrationAuth = HMAC(M2) using tpmProof as the secret
1763 20. Create outData using the key in parentHandle to perform the encryption

104 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1764 12. Maintenance Functions (optional)


1765 12.1 TPM_CreateMaintenanceArchive
1766 Start of informative comment:
1767 This command creates the MaintenanceArchive. It can only be executed by the owner, and
1768 may be shut off with the TPM_KillMaintenanceFeature command.
1769 End of informative comment.

1770 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Cmd ordinal: TPM_ORD_CreateMaintenanceArchive
4 1 2S 1 BOOL generateRandom Use RNG or Owner auth to generate ‘random’.

5 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
6 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
8 20 TPM_AUTHDATA ownerAuth HMAC key: ownerAuth.

1771 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND

2 4 UINT32 paramSize Total number of output bytes including paramSize and tag

3 4 1S 4 TPM_RESULT returnCode The return code of the operation.

2S 4 TPM_COMMAND_CODE ordinal Cmd ordinal: TPM_ORD_CreateMaintenanceArchive

4 4 3S 4 UINT32 randomSize Size of the returned random data. Will be 0 if generateRandom is FALSE.
5 <> 4S <> BYTE [ ] random Random data to XOR with result.
6 4 5S 4 UINT32 archiveSize Size of the encrypted archive
7 <> 6S <> BYTE [ ] archive Encrypted key archive.

8 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs

3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle

9 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
10 20 TPM_AUTHDATA resAuth
ownerAuth.

1772 Actions

Level 2 Revision 85 13 February 2005 Published 105


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1773 Upon authorization being confirmed this command does the following:
1774 1. Validates that the TPM_PERMANENT_FLAGS -> AllowMaintenance is TRUE. If it is
1775 FALSE, the TPM SHALL return TPM_DISABLED_CMD and exit this capability.
1776 2. Validates the TPM Owner AuthData.
1777 3. If the value of TPM_PERMANENT_DATA -> ManuMaintPub is zero, the TPM MUST return
1778 the error code TPM_KEYNOTFOUND
1779 4. Build a1 a TPM_KEY structure using the SRK. The encData field is not a normal
1780 TPM_STORE_ASYMKEY structure but rather a TPM_MIGRATE_ASYMKEY structure built
1781 using the following actions.
1782 5. Build a TPM_STORE_PRIVKEY structure from the SRK. This privKey element should be
1783 132 bytes long for a 2K RSA key.
1784 6. Create k1 and k2 by splitting the privKey element created in step 4 into 2 parts. k1 is
1785 the first 20 bytes of privKey, k2 contains the remainder of privKey.
1786 7. Build m1 by creating and filling in a TPM_MIGRATE_ASYMKEY structure
1787 a. m1 -> usageAuth is set to TPM_PERMANENT_FIELDS -> tpmProof
1788 b. m1 -> pubDataDigest is set to the digest value of the SRK fields from step 4
1789 c. m1 -> payload is set to TPM_PT_MAINT
1790 d. m1 -> partPrivKey is set to k2
1791 8. Create o1 (which SHALL be 198 bytes for a 2048 bit RSA key) by performing the OAEP
1792 encoding of m using OAEP parameters of
1793 a. m = TPM_MIGRATE_ASYMKEY structure (step 7)
1794 b. P = TPM_PERMANENT_FIELDS -> ownerAuth
1795 c. seed = s1 = k1 (step 6)
1796 9. If GenerateRandom = TRUE
1797 a. Create r1 by obtaining values from the TPM RNG. The size of r1 MUST be the same
1798 size as o1. Set RandomData parameter to r1
1799 10. If GenerateRandom = FALSE
1800 a. Create r1 by applying MGF1 to the TPM Owner AuthData. The size of r1 MUST be the
1801 same size as o1. Set RandomData parameter to null.
1802 11. Create x1 by XOR of o1 with r1
1803 12. Encrypt x1 with the ManuMaintPub key using the TPM_ES_RSAESOAEP_SHA1_MGF1
1804 encryption scheme.
1805 13. Set a1 -> encData to x1
1806 14. Set TPM_PERMANENT_FLAGS -> maintenanceDone to TRUE
1807 15. Return a1 in the archive parameter

106 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1808 12.2 TPM_LoadMaintenanceArchive


1809 Start of informative comment:
1810 This command loads in a Maintenance archive that has been massaged by the
1811 manufacturer to load into another TPM
1812 End of informative comment.

1813 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_LoadMaintenanceArchive
… … Vendor specific arguments

- 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
- 20 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
- 1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and owner authentication.
-- 20 TPM_AUTHDATA ownerAuth
HMAC key: ownerAuth.

1814 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 4 TPM_RESULT returnCode The return code of the operation.
4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_LoadMaintenanceArchive
.. .. Vendor specific arguments

- 20 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs


20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
- 1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
- 20 TPM_AUTHDATA resAuth
ownerAuth.

1815 Descriptions
1816 The maintenance mechanisms in the TPM MUST not require the TPM to hold a global
1817 secret. The definition of global secret is a secret value shared by more than one TPM.
1818 The TPME is not allowed to pre-store or use unique identifiers in the TPM for the purpose of
1819 maintenance. The TPM MUST NOT use the endorsement key for identification or encryption
1820 in the maintenance process. The maintenance process MAY use a TPM Identity to deliver
1821 maintenance information to specific TPM’s.

Level 2 Revision 85 13 February 2005 Published 107


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1822 The maintenance process can only change the SRK, tpmProof and TPM Owner AuthData
1823 fields.
1824 The maintenance process can only access data in shielded locations where this data is
1825 necessary to validate the TPM Owner, validate the TPME and manipulate the blob
1826 The TPM MUST be conformant to the TPM specification, protection profiles and security
1827 targets after maintenance. The maintenance MAY NOT decrease the security values from
1828 the original security target.
1829 The security target used to evaluate this TPM MUST include this command in the TOE.

1830 Actions
1831 The TPM SHALL perform the following when executing the command
1832 1. Validate the TPM Owner’s AuthData
1833 2. Validate that the maintenance information was sent by the TPME. The validation
1834 mechanism MUST use a strength of function that is at least the same strength of
1835 function as a digital signature performed using a 2048 bit RSA key.
1836 3. The packet MUST contain m2 as defined in TODOREF
1837 4. Ensure that only the target TPM can interpret the maintenance packet. The protection
1838 mechanism MUST use a strength of function that is at least the same strength of
1839 function as a digital signature performed using a 2048 bit RSA key.
1840 5. Process the maintenance information and update the SRK and TPM_PERMANENT_DATA
1841 -> tpmProof fields.
1842 6. Set the SRK usageAuth to be the same as TPM Owners AuthData
1843 7. Set TPM_PERMANENT_FLAGS -> maintenanceDone to TRUE

108 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1844 12.3 TPM_KillMaintenanceFeature


1845 Informative Comments:
1846 The KillMaintencanceFeature is a permanent action that prevents ANYONE from creating a
1847 maintenance archive. This action, once taken, is permanent until a new TPM Owner is set.
1848 This action is to allow those customers who do not want the maintenance feature to not
1849 allow the use of the maintenance feature.
1850 At the discretion of the Owner, it should be possible to kill the maintenance feature in such
1851 a way that the only way to recover maintainability of the platform would be to wipe out the
1852 root keys. This feature is mandatory in any TPM that implements the maintenance feature.
1853 End informative Comment

1854 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_KillMaintenanceFeature

4 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
5 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
7 20 TPM_AUTHDATA ownerAuth HMAC key: ownerAuth.

1855 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_KillMaintenanceFeature

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
6 20 TPM_AUTHDATA resAuth HMAC key: ownerAuth.

1856 Actions
1857 1. Validate the TPM Owner AuthData
1858 2. Set the TPM_PERMANENT_FLAGS.AllowMaintenance flag to FALSE.

Level 2 Revision 85 13 February 2005 Published 109


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1859 12.4 TPM_LoadManuMaintPub


1860 Informative Comments:
1861 The LoadManuMaintPub command loads the manufacturer’s public key for use in the
1862 maintenance process. The command installs ManuMaintPub in PERMANENT data storage
1863 inside a TPM. Maintenance enables duplication of non-migratory data in protected storage.
1864 There is therefore a security hole if a platform is shipped before the maintenance public key
1865 has been installed in a TPM.
1866 The command is expected to be used before installation of a TPM Owner or any key in TPM
1867 protected storage. It therefore does not use authorization.
1868 End of Informative Comments

1869 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_LoadManuMaintPub
4 20 TPM_NONCE antiReplay AntiReplay and validation nonce
5 <> TPM_PUBKEY pubKey The public key of the manufacturer to be in use for maintenance

1870 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_LoadManuMaintPub
4 20 TPM_DIGEST checksum Digest of pubKey and antiReplay

1871 Description
1872 The pubKey MUST specify an algorithm whose strength is not less than the RSA algorithm
1873 with 2048bit keys.
1874 pubKey SHOULD unambiguously identify the entity that will perform the maintenance
1875 process with the TPM Owner.
1876 TPM_PERMANENT_DATA -> ManuMaintPub SHALL exist in a TPM-shielded location, only.
1877 If an entity (Platform Entity) does not support the maintenance process but issues a
1878 platform credential for a platform containing a TPM that supports the maintenance process,
1879 the value of TPM_PERMANENT_DATA -> ManuMaintPub MUST be set to zero before the
1880 platform leaves the entity’s control.

1881 Actions

110 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1882 The first valid TPM_LoadManuMaintPub command received by a TPM SHALL


1883 1. Store the parameter pubKey as TPM_PERMANENT_DATA -> ManuMaintPub.
1884 2. Set checksum to SHA-1 of (pubkey || antiReplay)
1885 3. Export the checksum
1886 4. Subsequent calls to TPM_LoadManuMaintPub SHALL return code
1887 TPM_DISABLED_CMD.

Level 2 Revision 85 13 February 2005 Published 111


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1888 12.5 TPM_ReadManuMaintPub


1889 Informative Comments:
1890 The ReadManuMaintPub command is used to check whether the manufacturer’s public
1891 maintenance key in a TPM has the expected value. This may be useful during the
1892 manufacture process. The command returns a digest of the installed key, rather than the
1893 key itself. This hinders discovery of the maintenance key, which may (or may not) be useful
1894 for manufacturer privacy.
1895 The command is expected to be used before installation of a TPM Owner or any key in TPM
1896 protected storage. It therefore does not use authorization.
1897 End of Informative Comments

1898 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ReadManuMaintPub
4 20 TPM_NONCE antiReplay AntiReplay and validation nonce

1899 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ReadManuMaintPub
4 20 TPM_DIGEST checksum Digest of pubKey and antiReplay

1900 Description
1901 This command returns the hash of the antiReplay nonce and the previously loaded
1902 manufacturer’s maintenance public key.

1903 Actions
1904 The TPM_ ReadManuMaintKey command SHALL
1905 1. Create “checksum” by concatenating data to form (TPM_PERMANENT_DATA ->
1906 ManuMaintPub ||antiReplay) and passing the concatenated data through SHA1.
1907 2. Export the checksum

112 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1908 13. Cryptographic Functions


1909 13.1 TPM_SHA1Start
1910 Start of informative comment:
1911 This capability starts the process of calculating a SHA-1 digest.
1912 The exposure of the SHA-1 processing is a convenience to platforms in a mode that do not
1913 have sufficient memory to perform SHA-1 themselves. As such the use of SHA-1 is
1914 restrictive on the TPM.
1915 The TPM may not allow any other types of processing during the execution of a SHA-1
1916 session. There is only one SHA-1 session active on a TPM.
1917 After the execution of SHA1Start, and prior to SHA1End, the receipt of any command other
1918 than SHA1Update will cause the invalidation of the SHA-1 session.
1919 End of informative comment.

1920 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SHA1Start

1921 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
Maximum number of bytes that can be sent to TPM_SHA1Update. Must be a
4 4 UINT32 maxNumBytes
multiple of 64 bytes.

1922 Description
1923 1. This capability prepares the TPM for a subsequent TPM_SHA1Update,
1924 TPM_SHA1Complete or TPM_SHA1CompleteExtend command. The capability SHALL
1925 open a thread that calculates a SHA-1 digest.
1926 2. After receipt to TPM_SHA1Start, and prior to the receipt of TPM_SHA1Complete or
1927 TPM_SHA1CompleteExtend, receipt of any command other than TPM_SHA1Update
1928 invalidates the SHA-1 session

Level 2 Revision 85 13 February 2005 Published 113


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1929 13.2 TPM_SHA1Update


1930 Start of informative comment:
1931 This capability inputs complete blocks of data into a pending SHA-1 digest. At the end of
1932 the process, the digest remains pending.
1933 End of informative comment.

1934 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SHA1Update
4 4 UINT32 numBytes The number of bytes in hashData. Must be a multiple of 64 bytes.
5 <> BYTE [ ] hashData Bytes to be hashed

1935 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

1936 Description
1937 This command SHALL incorporate complete blocks of data into the digest of an existing
1938 SHA-1 thread. Only integral numbers of complete blocks (64 bytes each) can be processed.

114 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1939 13.3 TPM_SHA1Complete


1940 Start of informative comment:
1941 This capability terminates a pending SHA-1 calculation.
1942 End of informative comment.

1943 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SHA1Complete
4 4 UINT32 hashDataSize Number of bytes in hashData, MUST be 64 or less
5 <> BYTE [ ] hashData Final bytes to be hashed

1944 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 20 TPM_DIGEST hashValue The output of the SHA-1 hash.

1945 Description
1946 This command SHALL incorporate a partial or complete block of data into the digest of an
1947 existing SHA-1 thread, and terminate that thread. hashDataSize MAY have values in the
1948 range of 0 through 64, inclusive.
1949 If the SHA-1 thread has received no bytes the TPM SHALL calculate the SHA-1 of the empty
1950 buffer.

Level 2 Revision 85 13 February 2005 Published 115


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1951 13.4 TPM_SHA1CompleteExtend


1952 Start of informative comment:
1953 This capability terminates a pending SHA-1 calculation and EXTENDS the result into a
1954 Platform Configuration Register using a SHA-1 hash process.
1955 This command is designed to complete a hash sequence and extend a PCR in memory-less
1956 environments.
1957 End of informative comment.

1958 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_SHA1CompleteExtend
4 4 TPM_PCRINDEX pcrNum Index of the PCR to be modified
5 4 UINT32 hashDataSize Number of bytes in hashData, MUST be 64 or less
6 <> BYTE [ ] hashData Final bytes to be hashed

1959 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 20 TPM_DIGEST hashValue The output of the SHA-1 hash.
5 20 TPM_PCRVALUE outDigest The PCR value after execution of the command.

1960 Description
1961 This command SHALL incorporate a partial or complete block of data into the digest of an
1962 existing SHA-1 thread, EXTEND the resultant digest into a PCR, and terminate the SHA-1
1963 session. hashDataSize MAY have values in the range of 0 through 64, inclusive.

1964 Actions
1965 1. Map V1 to TPM_STANY_DATA
1966 2. Map L1 to V1 -> localityModifier
1967 3. If TPM_PERMANENT_DATA -> pcrAttrib [PCRIndex]. pcrExtendLocal[L1] is FALSE return
1968 TPM_BAD_LOCALITY
1969 4. Create H1 the TPM_DIGEST of the SHA-1 session ensuring that hashData, if any, is
1970 added to the SHA-1 session

116 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1971 5. Perform the actions of TPM_Extend using H1 as the data and pcrNum as the PCR to
1972 extend

Level 2 Revision 85 13 February 2005 Published 117


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

1973 13.5 TPM_Sign


1974 Start of informative comment:
1975 The Sign command signs data and returns the resulting digital signature
1976 End of informative comment.

1977 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Sign.
The keyHandle identifier of a loaded key that can perform digital
4 4 TPM_KEY_HANDLE keyHandle
signatures.
5 4 2s 4 UINT32 areaToSignSize The size of the areaToSign parameter
6 <> 3s <> BYTE[] areaToSign The value to sign

7 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle authorization
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest that authorizes the use of keyHandle.
10 20 TPM_AUTHDATA privAuth
HMAC key: key.usageAuth

1978 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Sign.
4 4 3S 4 UINT32 sigSize The length of the returned digital signature
5 <> 4S <> BYTE[ ] Sig The resulting digital signature.

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
8 20 TPM_AUTHDATA resAuth
key.usageAuth

1979 Description
1980 The TPM MUST support all values of areaToSignSize that are legal for the defined signature
1981 scheme and key size. The maximum value of areaToSignSize is determined by the defined
1982 signature scheme and key size.

118 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1983 In the case of PKCS1v15_SHA1 the areaToSignSize MUST be TPM_DIGEST (the hash size of
1984 a sha1 operation - see 8.5.1 TPM_SS_RSASSAPKCS1v15_SHA1). In the case of
1985 PKCS1v15_DER the maximum size of areaToSign is k-11 octets, where k is limited by the
1986 key size (see TPM_SS_RSASSAPKCS1v15_DER).

1987 Actions
1988 1. The TPM validates the AuthData to use the key pointed to by keyHandle.
1989 2. If the areaToSignSize is 0 the TPM returns TPM_BAD_PARAMETER.
1990 3. Validate that keyHandle -> keyUsage is TPM_KEY_SIGNING or TPM_KEY_LEGACY, if not
1991 return the error code TPM_INVALID_KEYUSAGE
1992 4. The TPM verifies that the signature scheme and key size can properly sign the
1993 areaToSign parameter.
1994 5. If signature scheme is TPM_SS_RSASSAPKCSv15_SHA1 then
1995 a. Validate that areaToSignSize is 20 return TPM_BAD_PARAMETER on error
1996 b. Set S1 to areaToSign
1997 6. Else if signature scheme is TPM_SS_RSASSAPKCS1v15_DER then
1998 a. Validate that areaToSignSize is at least 11 bytes less than the key size, return
1999 TPM_BAD_PARAMETER on error
2000 b. Set S1 to areaToSign
2001 7. else if signature scheme is TPM_SS_RSASSAPKCSv15_INFO then
2002 a. Create S2 a TPM_SIGN_INFO structure
2003 b. Set S2 -> fixed to “SIGN”
2004 c. Set S2 -> replay to nonceOdd
2005 i. If nonceOdd is not present due to an unauthorized command return
2006 TPM_BAD_PARAMETER
2007 d. Set S2 -> dataLen areaToSignSize
2008 e. Set S2 -> data to areaToSign
2009 f. Set S1 to the SHA-1(S2)
2010 8. Else return TPM_INVALID_KEYUSAGE
2011 9. The TPM computes the signature, sig, using the key referenced by keyHandle using S1
2012 as the value to sign
2013 10. Return the computed signature in Sig

Level 2 Revision 85 13 February 2005 Published 119


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2014 13.6 TPM_GetRandom


2015 Start of informative comment:
2016 GetRandom returns the next bytesRequested bytes from the random number generator to
2017 the caller.
2018 It is recommended that a TPM implement the RNG in a manner that would allow it to return
2019 RNG bytes such that the frequency of bytesRequested being more than the number of bytes
2020 available is an infrequent occurrence.
2021 End of informative comment.

2022 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_GetRandom.
4 4 UINT32 bytesRequested Number of bytes to return

2023 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 4 UINT32 randomBytesSize The number of bytes returned
5 <> BYTE[ ] randomBytes The returned bytes

2024 Actions
2025 1. The TPM determines if amount bytesRequested is available from the TPM.
2026 2. Set randomBytesSize to the number of bytes available from the RNG. This number MAY
2027 be less than bytesRequested.
2028 3. Set randomBytes to the next randomBytesSize bytes from the RNG

120 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2029 13.7 TPM_StirRandom


2030 Start of informative comment:
2031 StirRandom adds entropy to the RNG state.
2032 End of informative comment.

2033 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_StirRandom
4 4 UINT32 dataSize Number of bytes of input (<256)
5 <> BYTE[ ] inData Data to add entropy to RNG state

2034 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

2035 Actions
2036 The TPM updates the state of the current RNG using the appropriate mixing function.

Level 2 Revision 85 13 February 2005 Published 121


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2037 13.8 TPM_CertifyKey


2038 Start of informative comment:
2039 The TPM_CERTIFYKEY operation allows one key to certify the public portion of another key.
2040 A TPM identity key may be used to certify non-migratable keys but is not permitted to
2041 certify migratory keys or certified migration keys. As such, it allows the TPM to make the
2042 statement “this key is held in a TPM-shielded location, and it will never be revealed.” For
2043 this statement to have veracity, the Challenger must trust the policies used by the entity
2044 that issued the identity and the maintenance policy of the TPM manufacturer.
2045 Signing and legacy keys may be used to certify both migratable and non-migratable keys.
2046 Then the usefulness of a certificate depends on the trust in the certifying key by the
2047 recipient of the certificate.
2048 The key to be certified must be loaded before TPM_CertifyKey is called.
2049 The determination to use the TPM_CERTIFY_INFO or TPM_CERTIFY_INFO2 on the output is
2050 based on which PCRs and what localities the certified key is restricted to. A key to be
2051 certified that does not have locality restrictions and which uses no PCRs greater than PCR
2052 #15 will cause this command return and sign a TPM_CERTIFY_INFO structure, which
2053 provides compatibility with V1.1 TPMs.
2054 When this command is run to certify all other keys (those that use PCR #16 or higher, as
2055 well as those limited by locality in any way) it will return and sign a TPM_CERTIFY_INFO2
2056 structure.
2057 TPM_certifyKey does not support the case where (a) the certifying key requires a usage
2058 authorization to be provided but (b) the key-to-be-certified does not. In such cases,
2059 TPM_certifyKey2 must be used.
2060 If a command tag (in the parameter array) specifies only one authorisation session, then the
2061 TPM convention is that the first session listed is ignored (authDataUsage must be NEVER
2062 for this key) and the incoming session data is used for the second auth session in the list.
2063 In TPM_certifyKey, the first session is the certifying key and the second session is the key-
2064 to-be-certified. In TPM_certifyKey2, the first session is the key-to-be-certified and the
2065 second session is the certifying key.
2066 End of informative comment.

122 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2067 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_CertifyKey
4 4 TPM_KEY_HANDLE certHandle Handle of the key to be used to certify the key.
5 4 TPM_KEY_HANDLE keyHandle Handle of the key to be certified.
160 bits of externally supplied data (typically a nonce provided to
6 20 2S 20 TPM_NONCE antiReplay
prevent replay-attacks)

7 4 TPM_AUTHHANDLE certAuthHandle The authorization session handle used for certHandle.


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with certAuthHandle
9 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and certHandle. HMAC key:
10 20 TPM_AUTHDATA certAuth
certKey.auth.

11 4 TPM_AUTHHANDLE keyAuthHandle The authorization session handle used for the key to be signed.
2H2 20 TPM_NONCE keylastNonceEven Even nonce previously generated by TPM
12 20 3H2 20 TPM_NONCE keynonceOdd Nonce generated by system associated with keyAuthHandle
13 1 4H2 1 BOOL continueKeySession The continue use flag for the authorization session handle
The authorization session digest for the inputs and key to be signed.
14 20 TPM_AUTHDATA keyAuth
HMAC key: key.usageAuth.

Level 2 Revision 85 13 February 2005 Published 123


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2068 Outgoing Operands and Sizes


Param HMAC
Type Name Description
# Sz # Sz

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal TPM_ORD_CertifyKey
TPM_CERTIFY_INFO or TPM_CERTIFY_INFO2 structure that
4 <> 3S <> TPM_CERTIFY_INFO certifyInfo
provides information relative to keyhandle
5 4 4S 4 UINT32 outDataSize The used size of the output area for outData
6 <> 5S <> BYTE[ ] outData The signature of certifyInfo

7 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM


3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with certAuthHandle
8 1 4H1 1 BOOL continueAuthSession Continue use flag for cert key session
The authorization session digest for the returned parameters and
9 20 20 TPM_AUTHDATA resAuth
parentHandle. HMAC key: certKey -> auth.

10 20 2H2 20 TPM_NONCE keyNonceEven Even nonce newly generated by TPM


3H2 20 TPM_NONCE keynonceOdd Nonce generated by system associated with keyAuthHandle
11 1 4H2 1 BOOL continueKeySession Continue use flag for target key session
The authorization session digest for the target key. HMAC key:
12 20 TPM_AUTHDATA keyAuth
key.auth.

2069 Actions
2070 1. The TPM validates that the key pointed to by certHandle has a signature scheme of
2071 TPM_SS_RSASSAPKCS1v15_SHA1
2072 2. Verify command and key AuthData values:
2073 a. If tag is TPM_TAG_RQU_AUTH2_COMMAND
2074 i. The TPM verifies the AuthData in certAuthHandle provides authorization to use
2075 the key pointed to by certHandle, return TPM_AUTHFAIL on error
2076 ii. The TPM verifies the AuthData in keyAuthHandle provides authorization to use
2077 the key pointed to by keyHandle, return TPM_AUTH2FAIL on error
2078 b. else if tag is TPM_TAG_RQU_AUTH1_COMMAND
2079 i. Verify that authDataUsage is TPM_AUTH_NEVER for the key referenced by
2080 certHandle, return TPM_AUTHFAIL on error.
2081 ii. The TPM verifies the AuthData in keyAuthHandle provides authorization to use
2082 the key pointed to by keyHandle, return TPM_AUTHFAIL on error
2083 c. else if tag is TPM_TAG_RQU_COMMAND
2084 i. Verify that authDataUsage is TPM_AUTH_NEVER for the key referenced by
2085 certHandle, return TPM_AUTHFAIL on error.

124 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2086 ii. Verify that authDataUsage is TPM_AUTH_NEVER or TPM_AUTH_PRIV_USE_ONLY


2087 for the key referenced by keyHandle, return TPM_AUTHFAIL on error.
2088 3. If the key pointed to by certHandle is an identity key (certHandle -> keyUsage is
2089 TPM_KEY_IDENTITY)
2090 a. If keyHandle -> keyFlags -> migratable is TRUE return TPM_MIGRATEFAIL
2091 4. If keyHandle -> digestAtRelease requires the use of PCRs 16 or higher to calculate or if
2092 keyHandle -> localityAtRelease is not 0x1F
2093 a. Set V1 to 1.2
2094 5. Else
2095 a. Set V1 to 1.1
2096 6. If keyHandle -> pcrInfoSize is not 0
2097 a. If keyHandle -> keyFlags has pcrIgnoredOnRead set to FALSE
2098 i. Create a digestAtRelease according to the specified PCR registers and compare to
2099 keyHandle -> digestAtRelease and if a mismatch return TPM_WRONGPCRVAL
2100 ii. If specified validate any locality requests on error TPM_BAD_LOCALITY
2101 b. If V1 is 1.1
2102 i. Create C1 a TPM_CERTIFY_INFO structure
2103 ii. Fill in C1 with the information from the key pointed to by keyHandle
2104 iii. The TPM MUST set c1 -> pcrInfoSize to 44.
2105 iv. The TPM MUST set c1 -> pcrInfo to a TPM_PCR_INFO structure properly filled out
2106 using the information from keyHandle.
2107 v. The TPM MUST set c1 -> digestAtCreation to 20 bytes of 0x00.
2108 c. Else
2109 i. Create C1 a TPM_CERTIFY_INFO2 structure
2110 ii. Fill in C1 with the information from the key pointed to by keyHandle
2111 iii. Set C1 -> pcrInfoSize to the size of an appropriate TPM_PCR_INFO_SHORT
2112 structure.
2113 iv. Set C1 -> pcrInfo to a properly filled out TPM_PCR_INFO_SHORT structure, using
2114 the information from keyHandle.
2115 v. Set C1 -> migrationAuthoritySize to 0
2116 7. Else
2117 a. Create C1 a TPM_CERTIFY_INFO structure
2118 b. Fill in C1 with the information from the key pointed to by keyHandle
2119 c. The TPM MUST set c1 -> pcrInfoSize to 0
2120 8. Create TPM_DIGEST H1 which is the SHA-1 hash of keyHandle -> pubKey -> key. Note
2121 that <key> is the actual public modulus, and does not include any structure formatting.
2122 9. Set C1 -> pubKeyDigest to H1

Level 2 Revision 85 13 February 2005 Published 125


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2123 10. The TPM copies the antiReplay parameter to c1 -> data.
2124 11. The TPM sets certifyInfo to C1.
2125 12. The TPM creates m1, a message digest formed by taking the SHA1 of c1.
2126 a. The TPM then computes a signature using certHandle -> sigScheme. The resulting
2127 signed blob is returned in outData.

126 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2128 13.9 TPM_CertifyKey2


2129 Start of informative comment:
2130 This command is based on TPM_CertifyKey, but includes the ability to certify a Certifiable
2131 Migration Key (CMK), which requires extra input parameters.
2132 TPM_CertifyKey2 always produces a TPM_CERTIFY_INFO2 structure.
2133 TPM_certifyKey2 does not support the case where (a) the key-to-be-certified requires a
2134 usage authorization to be provided but (b) the certifying key does not.
2135 If a command tag (in the parameter array) specifies only one authorisation session, then the
2136 TPM convention is that the first session listed is ignored (authDataUsage must be NEVER
2137 for this key) and the incoming session data is used for the second auth session in the list.
2138 In TPM_CertifyKey2, the first session is the key to be certified and the second session is the
2139 certifying key.
2140 End of informative comment.

2141 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_CertifyKey2
4 4 TPM_KEY_HANDLE keyHandle Handle of the key to be certified.
5 4 TPM_KEY_HANDLE certHandle Handle of the key to be used to certify the key.
The digest of a TPM_MSA_COMPOSITE structure, containing at least
6 20 2S 20 TPM_DIGEST migrationPubDigest
one public key of a Migration Authority
160 bits of externally supplied data (typically a nonce provided to
7 20 3S 20 TPM_NONCE antiReplay
prevent replay-attacks)

8 4 TPM_AUTHHANDLE keyAuthHandle The authorization session handle used for the key to be signed.
2H1 20 TPM_NONCE keylastNonceEven Even nonce previously generated by TPM
9 20 3H1 20 TPM_NONCE keynonceOdd Nonce generated by system associated with keyAuthHandle
10 1 4H1 1 BOOL continueKeySession The continue use flag for the authorization session handle
The authorization session digest for the inputs and key to be signed.
11 20 TPM_AUTHDATA keyAuth
HMAC key: key.usageAuth.

12 4 TPM_AUTHHANDLE certAuthHandle The authorization session handle used for certHandle.


2H2 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
13 20 3H2 20 TPM_NONCE nonceOdd Nonce generated by system associated with certAuthHandle
14 1 4H2 1 BOOL continueAuthSession The continue use flag for the authorization session handle
15 20 TPM_AUTHDATA certAuth Authorization HMAC key: certKey.auth.

Level 2 Revision 85 13 February 2005 Published 127


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2142 Outgoing Operands and Sizes


Param HMAC
Type Name Description
# Sz # Sz

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal TPM_ORD_CertifyKey2
4 <> 3S <> TPM_CERTIFY_INFO2 certifyInfo TPM_CERTIFY_INFO2 relative to keyHandle
5 4 4S 4 UINT32 outDataSize The used size of the output area for outData
6 <> 5S <> BYTE[ ] outData The signed public key.

7 20 2H1 20 TPM_NONCE keyNonceEven Even nonce newly generated by TPM


3H1 20 TPM_NONCE keyNonceOdd Nonce generated by system associated with certAuthHandle
8 1 4H1 1 BOOL keyContinueAuthSession Continue use flag for cert key session
9 20 20 TPM_AUTHDATA keyResAuth Authorization HMAC key: keyHandle -> auth.

10 20 2H2 20 TPM_NONCE certNonceEven Even nonce newly generated by TPM


3H2 20 TPM_NONCE AuthLastNonceOdd Nonce generated by system associated with certAuthHandle
11 1 4H2 1 BOOL CertContinueAuthSession Continue use flag for cert key session
12 20 20 TPM_AUTHDATA certResAuth Authorization HMAC key: certHandle -> auth.

2143 Actions
2144 1. The TPM validates that the key pointed to by certHandle has a signature scheme of
2145 TPM_SS_RSASSAPKCS1v15_SHA1
2146 2. Verify command and key AuthData values:
2147 a. If tag is TPM_TAG_RQU_AUTH2_COMMAND
2148 i. The TPM verifies the AuthData in keyAuthHandle provides authorization to use
2149 the key pointed to by keyHandle, return TPM_AUTHFAIL on error
2150 ii. The TPM verifies the AuthData in certAuthHandle provides authorization to use
2151 the key pointed to by certHandle, return TPM_AUTH2FAIL on error
2152 b. else if tag is TPM_TAG_RQU_AUTH1_COMMAND
2153 i. Verify that authDataUsage is TPM_AUTH_NEVER or TPM_AUTH_PRIV_USE_ONLY
2154 for the key referenced by keyHandle, return TPM_AUTHFAIL on error
2155 ii. The TPM verifies the AuthData in authDataUsage provides authorization to use
2156 the key pointed to by certHandle , return TPM_AUTHFAIL on error
2157 c. else if tag is TPM_TAG_RQU_COMMAND
2158 i. Verify that authDataUsage is TPM_AUTH_NEVER or TPM_AUTH_PRIV_USE_ONLY
2159 for the key referenced by keyHandle, return TPM_AUTHFAIL on error
2160 ii. Verify that authDataUsage is TPM_AUTH_NEVER for the key referenced by
2161 certHandle, return TPM_AUTHFAIL on error.

128 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2162 3. If the key pointed to by certHandle is an identity key (certHandle -> keyUsage is
2163 TPM_KEY_IDENTITY)
2164 a. If keyHandle -> keyFlags -> migratable is TRUE and [keyHandle -> keyFlags->
2165 migrateAuthority is FALSE or (keyHandle -> payload !=
2166 TPM_PT_MIGRATE_RESTRICTED and keyHandle -> payload !=
2167 TPM_PT_MIGRATE_EXTERNAL)] return TPM_MIGRATEFAIL
2168 4. The TPM SHALL create a c1 a TPM_CERTIFY_INFO2 structure from the key pointed to
2169 by keyHandle
2170 5. Create TPM_DIGEST H1 which is the SHA-1 hash of keyHandle -> pubKey -> key. Note
2171 that <key> is the actual public modulus, and does not include any structure formatting.
2172 6. Set C1 -> pubKeyDigest to H1
2173 7. Copy the antiReplay parameter to c1 -> data
2174 8. Copy other keyHandle parameters into C1
2175 9. If keyHandle -> payload == TPM_PT_MIGRATE_RESTRICTED or
2176 TPM_PT_MIGRATE_EXTERNAL
2177 a. create thisPubKey, a TPM_PUBKEY structure containing the public key, algorithm
2178 and parameters corresponding to keyHandle
2179 b. Verify that the migration authorization is valid for this key
2180 i. Create M2 a TPM_CMK_MIGAUTH structure
2181 ii. Set M2 -> msaDigest to migrationPubDigest
2182 iii. Set M2 -> pubkeyDigest to SHA1[thisPubKey]
2183 iv. Verify that [keyHandle -> migrationAuth] == HMAC(M2) signed by using tpmProof
2184 as the secret and return error TPM_MA_SOURCE on mismatch
2185 c. Set C1 -> migrationAuthority = SHA-1(migrationPubDigest || keyHandle -> payload)
2186 d. if keyHandle -> payload == TPM_PT_MIGRATE_RESTRICTED
2187 i. Set C1 -> payloadType = TPM_PT_MIGRATE_RESTRICTED
2188 e. if keyHandle -> payload == TPM_PT_MIGRATE_EXTERNAL
2189 i. Set C1 -> payloadType = TPM_PT_MIGRATE_EXTERNAL
2190 10. Else
2191 a. set C1 -> migrationAuthority = NULL
2192 b. set C1 -> migrationAuthoritySize =0
2193 c. Set C1 -> payloadType = TPM_PT_ASYM
2194 11. If keyHandle -> pcrInfoSize is not 0
2195 a. The TPM MUST set c1 -> pcrInfoSize to match the pcrInfoSize from the keyHandle
2196 key.
2197 b. The TPM MUST set c1 -> pcrInfo to match the pcrInfo from the keyHandle key
2198 c. If keyHandle -> keyFlags has pcrIgnoredOnRead set to FALSE

Level 2 Revision 85 13 February 2005 Published 129


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2199 i. Create a digestAtRelease according to the specified PCR registers and compare to
2200 keyHandle -> digestAtRelease and if a mismatch return TPM_WRONGPCRVAL
2201 ii. If specified validate any locality requests on error TPM_BAD_LOCALITY
2202 12. Else
2203 a. The TPM MUST set c1 -> pcrInfoSize to 0
2204 13. The TPM creates m1, a message digest formed by taking the SHA1 of c1
2205 a. The TPM then computes a signature using certHandle -> sigScheme. The resulting
2206 signed blob is returned in outData

130 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2207 14. Endorsement Key Handling


2208 Start of informative comment:
2209 There are two create EK commands. The first matches the 1.1 functionality. The second
2210 provides the mechanism to enable revokeEK.
2211 The TPM and platform manufacturer decide on the inclusion or exclusion of the ability to
2212 execute revokeEK.
2213 The restriction to have the TPM generate the EK does not remove the manufacturing option
2214 to “squirt” the EK. During manufacturing, the TPM does not enforce all protections or
2215 requirements; hence, the restriction on only TPM generation of the EK is also not in force.
2216 End of informative comment.
2217 1. A TPM SHALL NOT install an EK unless generated on the TPM by execution of
2218 TPM_CreateEndorsementKeyPair or TPM_CreateRevocableEK

Level 2 Revision 85 13 February 2005 Published 131


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2219 14.1 TPM_CreateEndorsementKeyPair


2220 Start of informative comment:
2221 This command creates the TPM endorsement key. It returns a failure code if an
2222 endorsement key already exists.
2223 End of informative comment.

2224 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CreateEndorsementKeyPair
4 20 TPM_NONCE antiReplay Arbitrary data
5 <> TPM_KEY_PARMS keyInfo Information about key to be created, this includes all algorithm parameters

2225 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 <> TPM_PUBKEY pubEndorsementKey The public endorsement key
5 20 TPM_DIGEST Checksum Hash of pubEndorsementKey and antiReplay

2226 Actions
2227 1. If an EK already exists, return TPM_DISABLED_CMD
2228 2. Validate the keyInfo parameters for the key description
2229 a. If the algorithm type is RSA the key length MUST be a minimum of 2048. For
2230 interoperability the key length SHOULD be 2048
2231 b. If the algorithm type is other than RSA the strength provided by the key MUST be
2232 comparable to RSA 2048
2233 c. The other parameters of keyInfo (signatureScheme etc.) are ignored.
2234 3. Create a key pair called the “endorsement key pair” using a TPM-protected capability.
2235 The type and size of key are that indicated by keyInfo
2236 4. Create checksum by performing SHA1 on the concatenation of (PUBEK || antiReplay)
2237 5. Store the PRIVEK
2238 6. Create TPM_PERMANENT_DATA -> TPM_DAA_TPM_SEED from the TPM RNG
2239 7. Set TPM_PERMANENT_FLAGS -> CEKPUsed to TRUE

132 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2240 8. Set TPM_PERMANENT_FLAGS -> enableRevokeEK to FALSE

Level 2 Revision 85 13 February 2005 Published 133


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2241 14.2 TPM_CreateRevocableEK


2242 Start of informative comment:
2243 This command creates the TPM endorsement key. It returns a failure code if an
2244 endorsement key already exists. The TPM vendor may have a separate mechanism to create
2245 the EK and “squirt” the value into the TPM.
2246 The input parameters specify whether the EK is capable of being reset, whether the
2247 AuthData value to reset the EK will be generated by the TPM, and the new AuthData value
2248 itself if it is not to be generated by the TPM. The output parameter is the new AuthData
2249 value that must be used when resetting the EK (if it is capable of being reset).
2250 The command TPM_RevokeTrust must be used to reset an EK (if it is capable of being
2251 reset).
2252 Owner authorisation is unsuitable for authorizing resetting of an EK: someone with
2253 Physical Presence can remove a genuine Owner, install a new Owner, and revoke the EK.
2254 The genuine Owner can reinstall, but the platform will have lost its original attestation and
2255 may not be trusted by challengers. Therefore if a password is to be used to revoke an EK, it
2256 must be a separate password, given to the genuine Owner.
2257 In v1.2 an OEM has extra choices when creating EKs.
2258 a) An OEM could manufacture all of its TPMs with enableRevokeEK==TRUE.
2259 If the OEM has tracked the EKreset passwords for these TPMs, the OEM can give the
2260 passwords to customers. The customers can use the passwords as supplied, change the
2261 passwords, or clear the EKs and create new EKs with new passwords.
2262 If EKreset passwords are random values, the OEM can discard those values and not give
2263 them to customers. There is then a low probability (statistically zero) chance of a local DOS
2264 attack to reset the EK by guessing the password. The chance of a remote DOS attack is zero
2265 because Physical Presence must also be asserted to use TPM_RevokeTrust.
2266 b) An OEM could manufacture some of its TPMs with enableRevokeEK==FALSE. Then the
2267 EK can never be revoked, and the chance of even a local DOS attack on the EK is
2268 eliminated.
2269 End of informative comment.
2270 This is an optional command

134 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2271 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_CreateRevocableEK
4 20 TPM_NONCE antiReplay Arbitrary data
5 <> TPM_KEY_PARMS keyInfo Information about key to be created, this includes all algorithm parameters
If TRUE use TPM RNG to generate EKreset. If FALSE use the passed
6 1 BOOL generateReset
value inputEKreset
The authorization value to be used with TPM_RevokeTrust if
7 20 TPM_NONCE inputEKreset
generateReset==FALSE

2272 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RSP_COMMAND

2 4 UINT32 paramSize Total number of output bytes including paramSize and tag

3 4 TPM_RESULT returnCode The return code of the operation.

4 <> TPM_PUBKEY pubEndorsementKey The public endorsement key

5 20 TPM_DIGEST Checksum Hash of pubEndorsementKey and antiReplay

6 20 TPM_NONCE outputEKreset The AuthData value to use TPM_RevokeTrust

2273 Actions
2274 1. If an EK already exists, return TPM_DISABLED_CMD
2275 2. Perform the actions of TPM_CreateEndorsementKeyPair, if any errors return with error
2276 3. Set TPM_PERMANENT_FLAGS -> enableRevokeEK to TRUE
2277 a. If generateReset is TRUE then
2278 i. Set TPM_PERMANENT_DATA -> EKreset to the next value from the TPM RNG
2279 b. Else
2280 i. Set TPM_PERMANENT_DATA -> EKreset to inputEKreset
2281 4. Return PUBEK, checksum and Ekreset
2282 5. Create TPM_PERMANENT_DATA -> TPM_DAA_TPM_SEED from the TPM RNG
2283 6. The outputEKreset AuthData is sent in the clear. There is no uniqueness on the TPM
2284 available to actually perform encryption or use an encrypted channel. The assumption is
2285 that this operation is occurring in a controlled environment and sending the value in the
2286 clear is acceptable.

Level 2 Revision 85 13 February 2005 Published 135


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2287 14.3 TPM_RevokeTrust


2288 Start of informative comment:
2289 This command clears the EK and sets the TPM back to a pure default state. The generation
2290 of the AuthData value occurs during the generation of the EK. It is the responsibility of the
2291 EK generator to properly protect and disseminate the RevokeTrust AuthData.
2292 End of informative comment.
2293 This is an optional command

2294 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_RevokeTrust
4 20 TPM_DIGEST EKReset The value that will be matched to EK Reset

2295 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

2296 Actions
2297 1. The TPM MUST validate that TPM_PERMANENT_FLAGS -> enableRevokeEK is TRUE,
2298 return TPM_PERMANENTEK on error
2299 2. The TPM MUST validate that the EKReset matches TPM_PERMANENT_DATA -> EKReset
2300 return TPM_AUTHFAIL on error.
2301 3. Ensure that physical presence is being asserted
2302 4. Perform the actions of TPM_OwnerClear (excepting the command authentication)
2303 a. NV items with the pubInfo -> nvIndex D value set MUST be deleted. This changes the
2304 TPM_OwnerClear handling of the same NV areas
2305 b. Set TPM_PERMANENT_FLAGS -> nvLocked to FALSE
2306 5. Invalidate TPM_PERMANENT_DATA -> tpmDAASeed
2307 6. Invalidate the EK and any internal state associated with the EK

136 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2308 14.4 TPM_ReadPubek


2309 Start of informative comment:
2310 Return the endorsement key public portion. This value should have controls placed upon
2311 access as it is a privacy sensitive value
2312 End of informative comment.

2313 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ReadPubek
4 20 TPM_NONCE antiReplay Arbitrary data

2314 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 <> TPM_PUBKEY pubEndorsementKey The public endorsement key
5 20 TPM_DIGEST checksum Hash of pubEndorsementKey and antiReplay

2315 Description
2316 This command returns the PUBEK.

2317 Actions
2318 The TPM_ReadPubek command SHALL
2319 1. If TPM_PERMANENT_FLAGS -> readPubek is FALSE return TPM_DISABLED_CMD
2320 a. As this flag is set with TPM_TakeOwnership and reset on TPM_OwnerClear it mimics
2321 if a TPM Owner is present.
2322 2. If no EK is present the TPM MUST return TPM_NO_ENDORSEMENT
2323 3. Create checksum by performing SHA1 on the concatenation of (pubEndorsementKey ||
2324 antiReplay).
2325 4. Export the PUBEK and checksum.

Level 2 Revision 85 13 February 2005 Published 137


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2326 14.5 TPM_OwnerReadInternalPub


2327 Start of informative comment:
2328 A TPM Owner authorized command that returns the public portion of the EK or SRK.
2329 End of informative comment.

2330 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_OwnerReadInternalPub
4 4 2S 4 TPM_KEY_HANDLE keyHandle Handle for either PUBEK or SRK

5 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
6 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and owner authentication.
8 20 TPM_AUTHDATA ownerAuth
HMAC key: ownerAuth.

2331 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_OwnerReadInternalPub
4 <> 3S <> TPM_PUBKEY publicPortion The public portion of the requested key

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
7 20 TPM_AUTHDATA resAuth
ownerAuth.

2332 Actions
2333 1. Validate the parameters and TPM Owner AuthData for this command
2334 2. If keyHandle is TPM_KH_EK
2335 a. Set publicPortion to PUBEK
2336 3. Else If keyHandle is TPM_KH_SRK
2337 a. Set publicPortion to the TPM_PUBKEY of the SRK

138 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2338 4. Else return TPM_BAD_PARAMETER


2339 5. Export the public key of the referenced key

Level 2 Revision 85 13 February 2005 Published 139


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2340 15. Identity Creation and Activation


2341 15.1 TPM_MakeIdentity
2342 Start of informative comment:
2343 Generate a new Attestation Identity Key (AIK)
2344 End of informative comment.

2345 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of input bytes incl. paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_MakeIdentity.
4 20 2S 20 TPM_ENCAUTH identityAuth Encrypted usage AuthData for the new identity
5 20 3S 20 TPM_CHOSENID_HASH labelPrivCADigest The digest of the identity label and privacy CA chosen for the AIK
Structure containing all parameters of new identity key.
6 <> 4S <> TPM_KEY idKeyParams pubKey.keyLength & idKeyParams.encData are both 0 MAY be
TPM_KEY12

7 4 TPM_AUTHHANDLE srkAuthHandle The authorization session handle used for SRK authorization.
2H1 20 TPM_NONCE srkLastNonceEven Even nonce previously generated by TPM
8 20 3H1 20 TPM_NONCE srknonceOdd Nonce generated by system associated with srkAuthHandle
9 1 4H1 1 BOOL continueSrkSession Ignored
The authorization session digest for the inputs and the SRK. HMAC
10 20 TPM_AUTHDATA srkAuth
key: srk.usageAuth.

The authorization session handle used for owner authentication.


11 4 TPM_AUTHHANDLE authHandle
Session type MUST be OSAP.
2H2 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
12 20 3H2 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
13 1 4H2 1 BOOL continueAuthSession Ignored
The authorization session digest for inputs and owner. HMAC key:
14 20 20 TPM_AUTHDATA ownerAuth
ownerAuth.

140 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2346 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal:TPM_ORD_MakeIdentity.
4 <> 3S <> TPM_KEY idKey The newly created identity key. MAY be TPM_KEY12
5 4 4S 4 UINT32 identityBindingSize The used size of the output area for identityBinding
6 <> 5S <> BYTE[ ] identityBinding Signature of TPM_IDENTITY_CONTENTS using idKey.private.

7 20 2H2 20 TPM_NONCE srkNonceEven Even nonce newly generated by TPM.


3H2 20 TPM_NONCE srknonceOdd Nonce generated by system associated with srkAuthHandle
8 1 4H2 1 BOOL continueSrkSession Continue use flag. Fixed value of FALSE
The authorization session digest used for the outputs and srkAuth
9 20 TPM_AUTHDATA srkAuth
session. HMAC key: srk.usageAuth.

10 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
11 1 4H1 1 BOOL continueAuthSession Continue use flag. Fixed value of FALSE
The authorization session digest for the returned parameters. HMAC key:
12 20 20 TPM_AUTHDATA resAuth
ownerAuth.

2347 Description
2348 The public key of the new TPM identity SHALL be identityPubKey. The private key of the
2349 new TPM identity SHALL be tpm_signature_key.

2350 Properties of the new identity


Type Name Description
TPM_PUBKEY identityPubKey This SHALL be the public key of a previously unused asymmetric key pair.
TPM_STORE_ASYMKEY tpm_signature_key This SHALL be the private key that forms a pair with identityPubKey and SHALL be
extant only in a TPM-shielded location.
2351
2352 This capability also generates a TPM_KEY containing the tpm_signature_key.
2353 If identityPubKey is stored on a platform it SHALL exist only in storage to which access is
2354 controlled and is available to authorized entities.

2355 Actions
2356 A Trusted Platform Module that receives a valid TPM_MakeIdentity command SHALL do the
2357 following:
2358 1. Validate the idKeyParams parameters for the key description
2359 a. If the algorithm type is RSA the key length MUST be a minimum of 2048. For
2360 interoperability the key length SHOULD be 2048

Level 2 Revision 85 13 February 2005 Published 141


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2361 b. If the algorithm type is other than RSA the strength provided by the key MUST be
2362 comparable to RSA 2048
2363 c. If the TPM is not designed to create a key of the requested type, return the error code
2364 TPM_BAD_KEY_PROPERTY
2365 d. If TPM_PERMANENT_FLAGS -> FIPS is TRUE then
2366 i. If authDataUsage specifies TPM_AUTH_NEVER return TPM_NOTFIPS
2367 2. Use authHandle to verify that the Owner authorized all TPM_MakeIdentity input
2368 parameters.
2369 3. Use srkAuthHandle to verify that the SRK owner authorized all TPM_MakeIdentity input
2370 parameters.
2371 4. Verify that idKeyParams -> keyUsage is TPM_KEY_IDENTITY. If it is not, return
2372 TPM_INVALID_KEYUSAGE
2373 5. Verify that idKeyParams -> keyFlags -> migratable is FALSE. If it is not, return
2374 TPM_INVALID_KEYUSAGE
2375 6. If ownerAuth indicates XOR encryption for the AuthData secrets
2376 a. Create X1 the SHA-1 of the concatenation of (ownerAuth -> sharedSecret ||
2377 authLastNonceEven)
2378 b. Create a1 by XOR X1 and identityAuth
2379 7. Else
2380 a. Create a1 by decrypting identityAuth using the algorithm indicated in the OSAP
2381 session
2382 b. Key is from ownerAuth -> sharedSecret
2383 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
2384 8. Set continueAuthSession and continueSRKSession to FALSE.
2385 9. Determine the structure version
2386 a. If idKeyParms -> tag is TPM_TAG_KEY12
2387 i. Set V1 to 2
2388 ii. Create idKey a TPM_KEY12 structure using idKeyParams as the default values for
2389 the structure
2390 b. If idKeyParms -> ver is 1.1
2391 i. Set V1 to 1
2392 ii. Create idKey a TPM_KEY structure using idKeyParams as the default values for
2393 the structure
2394 10. Set the digestAtCreation values for pcrInfo
2395 a. For PCR_INFO_LONG include the locality of the current command
2396 11. Create an asymmetric key pair (identityPubKey and tpm_signature_key) using a TPM-
2397 protected capability, in accordance with the algorithm specified in idKeyParams

142 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2398 12. Ensure that the AuthData information in A1 is properly stored in the idKey as
2399 usageAuth.
2400 13. Attach identityPubKey and tpm_signature_key to idKey
2401 14. Set idKey -> migrationAuth to TPM_PERMANENT_DATA-> tpmProof
2402 15. Ensure that all TPM_PAYLOAD_TYPE structures identify this key as TPM_PT_ASYM
2403 16. Encrypt the private portion of idKey using the SRK as the parent key
2404 17. Create a TPM_IDENTITY_CONTENTS structure named idContents using
2405 labelPrivCADigest and the information from idKey
2406 18. Sign idContents using tpm_signature_key and TPM_SS_RSASSAPKCS1v15_SHA1. Store
2407 the result in identityBinding.

Level 2 Revision 85 13 February 2005 Published 143


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2408 15.2 TPM_ActivateIdentity


2409 Start of informative comment:
2410 The purpose of TPM_ActivateIdentity is to twofold. The first purpose is to obtain assurance
2411 that the credential in the TPM_SYM_CA_ATTESTATION is for this TPM. The second purpose
2412 is to obtain the session key used to encrypt the TPM_IDENTITY_CREDENTIAL.
2413 This is an extension to the 1.1 functionality of TPM_ActivateIdentity. The blob sent to from
2414 the CA can be in the 1.1 format or the 1.2 format. The TPM determines the type from the
2415 size or version information in the blob.
2416 TPM_ActivateIdentity checks that the symmetric session key corresponds to a TPM-identity
2417 before releasing that session key.
2418 Only the Owner of the TPM has the privilege of activating a TPM identity. The Owner is
2419 required to authorize the TPM_ActivateIdentity command. The owner may authorize the
2420 command using either the TPM_OIAP or TPM_OSAP authorization protocols.
2421 The creator of the ActivateIdentity package can specify if any PCR values are to be checked
2422 before releasing the session key.
2423 End of informative comment.

2424 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of input bytes incl. paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ActivateIdentity
4 4 TPM_KEY_HANDLE idKeyHandle Identity key to be activated
5 4 2S 4 UINT32 blobSize Size of encrypted blob from CA
6 <> 3S <> BYTE [ ] blob The encrypted ASYM_CA_CONTENTS or TPM_EK_BLOB

7 4 TPM_AUTHHANDLE idKeyAuthHandle The authorization session handle used for ID key authorization.
2H1 20 TPM_NONCE idKeyLastNonceEven Even nonce previously generated by TPM
8 20 3H1 20 TPM_NONCE idKeynonceOdd Nonce generated by system associated with idKeyAuthHandle
9 1 4H1 1 BOOL continueIdKeySession Continue usage flag for idKeyAuthHandle.
The authorization session digest for the inputs and ID key. HMAC key:
10 20 TPM_AUTHDATA idKeyAuth
idKey.usageAuth.

11 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H2 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
12 20 3H2 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
13 1 4H2 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and owner. HMAC key:
14 20 20 TPM_AUTHDATA ownerAuth
ownerAuth.

144 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2425 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal:TPM_ORD_ActivateIdentity
4 <> 3S <> TPM_SYMMETRIC_KEY symmetricKey The decrypted symmetric key.

5 20 2H1 20 TPM_NONCE idKeyNonceEven Even nonce newly generated by TPM.


3H1 20 TPM_NONCE idKeynonceOdd Nonce generated by system associated with idKeyAuthHandle
6 1 4H1 1 BOOL continueIdKeySession Continue use flag, TRUE if handle is still active
The authorization session digest used for the returned parameters and
7 20 TPM_AUTHDATA idKeyAuth
idKeyAuth session. HMAC key: idKey.usageAuth.

8 20 2H2 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H2 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H2 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC
10 20 20 TPM_AUTHDATA resAuth
key: ownerAuth.

2426 Description
2427 1. The command TPM_ActivateIdentity activates a TPM identity created using the command
2428 TPM_MakeIdentity.
2429 2. The command assumes the availability of the private key associated with the identity.
2430 The command will verify the association between the keys during the process.
2431 3. The command will decrypt the input blob and extract the session key and verify the
2432 connection between the public and private keys. The input blob can be in 1.1 or 1.2
2433 format.

2434 Actions
2435 A Trusted Platform Module that receives a valid TPM_ActivateIdentity command SHALL do
2436 the following:
2437 1. Using the authHandle field, validate the owner’s AuthData to execute the command and
2438 all of the incoming parameters.
2439 2. Using the idKeyAuthHandle, validate the AuthData to execute command and all of the
2440 incoming parameters
2441 3. Validate that the idKey is the public key of a valid TPM identity by checking that
2442 idKeyHandle -> keyUsage is TPM_KEY_IDENTITY. Return TPM_BAD_PARAMETER on
2443 mismatch
2444 4. Create H1 the digest of a TPM_PUBKEY derived from idKey
2445 5. Decrypt blob creating B1 using PRIVEK as the decryption key

Level 2 Revision 85 13 February 2005 Published 145


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2446 6. Determine the type and version of B1


2447 a. If B1 -> tag is TPM_TAG_EK_BLOB then
2448 i. B1 is a TPM_EK_BLOB
2449 b. Else
2450 i. B1 is a TPM_ASYM_CA_CONTENTS. As there is no tag for this structure it is
2451 possible for the TPM to make a mistake here but other sections of the structure
2452 undergo validation
2453 7. If B1 is a version 1.1 TPM_ASYM_CA_CONTENTS then
2454 a. Compare H1 to B1 -> idDigest on mismatch return TPM_BAD_PARAMETER
2455 b. Set K1 to B1 -> sessionKey
2456 8. If B1 is a TPM_EK_BLOB then
2457 a. Validate that B1 -> ekType is TPM_EK_BLOB_ACTIVATE, return TPM_BAD_TYPE if
2458 not.
2459 b. Assign A1 as a TPM_EK_TYPE_ACTIVATE structure from B1 -> blob
2460 c. Compare H1 to A1 -> idDigest on mismatch return TPM_BAD_PARAMETER
2461 d. If A1 -> pcrSelection is not NULL
2462 i. Compute a composite hash C1 using the PCR selection A1 -> pcrSelection
2463 ii. Compare C1 to A1 -> pcrInfo->digestAtRelease and return TPM_WRONGPCRVAL
2464 on a mismatch
2465 iii. If A1 -> pcrInfo specifies a locality ensure that the appropriate locality has been
2466 asserted, return TPM_BAD_LOCALITY on error
2467 e. Set K1 to A1 -> symmetricKey
2468 9. Return K1

146 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2469 16. Integrity Collection and Reporting


2470 Start of informative comment:
2471 This section deals with what commands have direct access to the PCR
2472 End of informative comment.
2473 1. The TPM SHALL only allow the following commands to alter the value of a PCR
2474 a. TPM_Extend
2475 b. TPM_SHA1CompleteExtend
2476 c. TPM_Startup
2477 d. TPM_PCRReset

Level 2 Revision 85 13 February 2005 Published 147


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2478 16.1 TPM_Extend


2479 Start of informative comment:
2480 This adds a new measurement to a PCR
2481 End of informative comment.

2482 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Extend.
4 4 TPM_PCRINDEX pcrNum The PCR to be updated.
5 20 TPM_DIGEST inDigest The 160 bit value representing the event to be recorded.

2483 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 20 TPM_PCRVALUE outDigest The PCR value after execution of the command.

2484 Descriptions
2485 Add a measurement value to a PCR

2486 Actions
2487 1. Map V1 to TPM_STANY_FLAGS
2488 2. Map L1 to V1 -> localityModifier
2489 3. If TPM_PERMANENT_DATA -> pcrAttrib [PCRIndex]. pcrExtendLocal[L1] is FALSE return
2490 TPM_BAD_LOCALITY
2491 4. Create c1 by concatenating (PCRindex TPM_PCRVALUE || inDigest). This takes the
2492 current PCR value and concatenates the inDigest parameter.
2493 5. Create h1 by performing a SHA1 digest of c1.
2494 6. Store h1 as the new TPM_PCRVALUE of PCRindex
2495 7. If TPM_PERMANENT_FLAG -> disable is TRUE
2496 a. Set outDigest to 20 bytes of 0x00
2497 8. Else
2498 a. Set outDigest to h1

148 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2499 16.2 TPM_PCRRead


2500 Start of informative comment:
2501 The TPM_PCRRead operation provides non-cryptographic reporting of the contents of a
2502 named PCR.
2503 End of informative comment.

2504 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_PCRRead.
4 4 TPM_PCRINDEX pcrIndex Index of the PCR to be read

2505 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 20 TPM_PCRVALUE outDigest The current contents of the named PCR

2506 Actions
2507 The TPM_PCRRead operation returns the current contents of the named register to the
2508 caller.

Level 2 Revision 85 13 February 2005 Published 149


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2509 16.3 TPM_Quote


2510 Start of informative comment:
2511 The TPM_Quote operation provides cryptographic reporting of PCR values. A loaded key is
2512 required for operation. TPM_Quote uses a key to sign a statement that names the current
2513 value of a chosen PCR and externally supplied data (which may be a nonce supplied by a
2514 Challenger).
2515 The term "ExternalData" is used because an important use of TPM_Quote is to provide a
2516 digital signature on arbitrary data, where the signature includes the PCR values of the
2517 platform at time of signing. Hence the "ExternalData" is not just for anti-replay purposes,
2518 although it is (of course) used for that purpose in an integrity challenge.
2519 End of informative comment.

2520 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Quote.
4 4 TPM_KEY_HANDLE keyHandle The keyHandle identifier of a loaded key that can sign the PCR values.
160 bits of externally supplied data (typically a nonce provided by a
5 20 2S 20 TPM_NONCE externalData
server to prevent replay-attacks)
6 <> 3S <> TPM_PCR_SELECTION targetPCR The indices of the PCRs that are to be reported.

7 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle authorization.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and keyHandle. HMAC key:
10 20 TPM_AUTHDATA privAuth
key -> usageAuth.

150 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2521 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Quote.
A structure containing the same indices as targetPCR, plus the
4 <> 3S <> TPM_PCR_COMPOSITE pcrData
corresponding current PCR values.
5 4 4S 4 UINT32 sigSize The used size of the output area for the signature
6 <> 5S <> BYTE[ ] sig The signed data blob.

7 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
8 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
9 20 TPM_AUTHDATA resAuth
Key -> usageAuth.

2522 Actions
2523 1. The TPM MUST validate the AuthData to use the key pointed to by keyHandle.
2524 2. The keyHandle -> sigScheme MUST use SHA-1, return TPM_INAPPROPRIATE_SIG if it
2525 does not
2526 3. Validate targetPCR
2527 a. targetPCR is a valid TPM_PCR_SELECTION structure
2528 b. On errors return TPM_INVALID_PCR_INFO
2529 4. Create H1 a SHA-1 hash of a TPM_PCR_COMPOSITE using the PCRs indicated by
2530 targetPCR -> pcrSelect
2531 5. Create Q1 a TPM_QUOTE_INFO structure
2532 a. Set Q1 -> version to 1.1.0.0
2533 b. Set Q1 -> fixed to “QUOT”
2534 c. Set Q1 -> digestValue to H1
2535 d. Set Q1 -> externalData to externalData
2536 6. Sign SHA-1 hash of Q1 using keyHandle as the signature key
2537 7. Return the signature in sig

Level 2 Revision 85 13 February 2005 Published 151


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2538 16.4 TPM_PCR_Reset


2539 Start of informative comment:
2540 For PCR with the pcrReset attribute set to TRUE, this command resets the PCR back to the
2541 default value, this mimics the actions of TPM_Init. The PCR may have restrictions as to
2542 which locality can perform the reset operation.
2543 Sending a null pcrSelection results in an error is due to the requirement that the command
2544 actually do something. If pcrSelection is null there are no PCR to reset and the command
2545 would then do nothing.
2546 For PCR that are resettable, the presence of a Trusted Operating System (TOS) can change
2547 the behavior of TPM_PCR_Reset. The following pseudo code shows how the behavior
2548 changes
2549 At TPM_Startup
2550 If TPM_PCR_ATTRIBUTES->pcrReset is FALSE
2551 Set PCR to 0x00…00
2552 Else
2553 Set PCR to 0xFF…FF
2554 At TPM_PCR_Reset
2555 If TPM_PCR_ATTRIBUTES->pcrReset is TRUE
2556 If TOSPresent
2557 Set PCR to 0x00…00
2558 Else
2559 Set PCR to 0xFF…FF
2560 Else
2561 Return error
2562 End of informative comment.

2563 Incoming Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_PCR_Reset
4 <> TPM_PCR_SELECTION pcrSelection The PCR’s to reset

2564 Outgoing Parameters and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

152 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

2565 Descriptions
2566 This command resets PCR values back to the default value. The command MUST validate
2567 that all PCR registers that are selected are available to be reset before resetting any PCR.
2568 This command MUST either reset all selected PCR registers or none of the PCR registers.

2569 Actions
2570 1. Validate that pcrSelection is valid
2571 a. is a valid TPM_PCR_SELECTION structure
2572 b. pcrSelection -> pcrSelect is non-zero
2573 c. On errors return TPM_INVALID_PCR_INFO
2574 2. Map V1 to TPM_STANY_FLAGS
2575 3. For each PCR selected perform the following
2576 4. If pcrAttrib[pcrIndex].pcrReset is FALSE
2577 a. Return TPM_NOTRESETABLE
2578 5. If pcrAttrib[pcrIndex].pcrResetLocal[ V1 -> localityModifier] is FALSE
2579 a. Return TPM_NOTLOCAL
2580 6. For each PCR selected perform the following
2581 a. If TPM_STANY_FLAGS -> TOSPresent is TRUE
2582 i. Reset PCR to 0x00…00
2583 b. Else
2584 i. Reset PCR to 0xFF…FF

Level 2 Revision 85 13 February 2005 Published 153


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2585 16.5 TPM_Quote2


2586 Start of informative comment:
2587 The TPM_Quote operation provides cryptographic reporting of PCR values. A loaded key is
2588 required for operation. TPM_Quote uses a key to sign a statement that names the current
2589 value of a chosen PCR and externally supplied data (which may be a nonce supplied by a
2590 Challenger).
2591 The term "ExternalData" is used because an important use of TPM_Quote is to provide a
2592 digital signature on arbitrary data, where the signature includes the PCR values of the
2593 platform at time of signing. Hence the "ExternalData" is not just for anti-replay purposes,
2594 although it is (of course) used for that purpose in an integrity challenge.
2595 Quote2 differs from quote in that Quote2 uses TPM_PCR_INFO_SHORT to hold information
2596 relative to the PCR registers. INFO_SHORT includes locality information to provide the
2597 requestor a more complete view of the current platform configuration.
2598 End of informative comment.

2599 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Quote2
4 4 TPM_KEY_HANDLE keyHandle The keyHandle identifier of a loaded key that can sign the PCR values.
160 bits of externally supplied data (typically a nonce provided by a
5 20 2S 20 TPM_NONCE externalData
server to prevent replay-attacks)
6 <> 3S <> TPM_PCR_SELECTION targetPCR The indices of the PCRs that are to be reported.
7 1 4S 1 BOOL addVersion When TRUE add TPM_CAP_VERSION_INFO to the output

8 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle authorization.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
10 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
The authorization session digest for inputs and keyHandle. HMAC key:
11 20 TPM_AUTHDATA privAuth
key -> usageAuth.

154 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2600 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_Quote2
4 <> 3S <> TPM_PCR_INFO_SHORT pcrData The value created and signed for the quote
5 4 4S 4 UINT32 versionInfoSize Size of the version info
6 <> 5S <> TPM_CAP_VERSION_INFO versionInfo The version info
7 4 6S 4 UINT32 sigSize The used size of the output area for the signature
8 <> 7S <> BYTE[ ] sig The signed data blob.

9 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
10 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
11 20 TPM_AUTHDATA resAuth
Key -> usageAuth.

2601 Actions
2602 1. The TPM MUST validate the AuthData to use the key pointed to by keyHandle.
2603 2. The keyHandle -> sigScheme MUST use SHA-1, return TPM_INAPPROPRIATE_SIG if it
2604 does not
2605 3. Validate targetPCR is a valid TPM_PCR_SELECTION structure, on errors return
2606 TPM_INVALID_PCR_INFO
2607 4. Create H1 a SHA-1 hash of a TPM_PCR_COMPOSITE using the PCRs indicated by
2608 targetPCR -> pcrSelect
2609 5. Create S1 a TPM_PCR_INFO_SHORT
2610 a. Set S1->pcrSelection to targetPCR
2611 b. Set S1->localityAtRelease to TPM_STANY_DATA -> localityModifier
2612 c. Set S1->digestAtRelease to H1
2613 6. Create Q1 a TPM_QUOTE_INFO2 structure
2614 a. Set Q1 -> fixed to “QUT2”
2615 b. Set Q1 -> infoShort to S1
2616 c. Set Q1 -> externalData to externalData
2617 7. If addVersion is TRUE
2618 a. Concatenate to Q1 a TPM_CAP_VERSION_INFO structure
2619 b. Set the output parameters for versionInfo

Level 2 Revision 85 13 February 2005 Published 155


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2620 8. Else
2621 a. Set versionInfoSize to 0
2622 b. Return no bytes in versionInfo
2623 9. Sign a SHA-1 hash of Q1 using keyHandle as the signature key
2624 10. Return the signature in sig

156 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2625 17. Changing AuthData


2626 17.1 TPM_ChangeAuth
2627 Start of informative comment:
2628 The TPM_ChangeAuth command allows the owner of an entity to change the AuthData for
2629 the entity.
2630 TPM_ChangeAuth requires the encryption of one parameter (“NewAuth”). For the sake of
2631 uniformity with other commands that require the encryption of more than one parameter,
2632 the string used for XOR encryption is generated by concatenating the evenNonce (created
2633 during the OSAP session) with the session shared secret and then hashing the result.
2634 The parameter list to this command must always include two authorization sessions,
2635 regardless of the state of authDataUsage for the respective keys.
2636 End of informative comment.
PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed at TPM_ORD_ChangeAuth
4 4 TPM_KEY_HANDLE parentHandle Handle of the parent key to the entity.
5 2 2S 2 TPM_PROTOCOL_ID protocolID The protocol in use.
The encrypted new AuthData for the entity. The encryption key is the
6 20 3S 20 TPM_ENCAUTH newAuth
shared secret from the OSAP protocol.
7 2 4S 2 TPM_ENTITY_TYPE entityType The type of entity to be modified
8 4 5S 4 UINT32 encDataSize The size of the encData parameter
9 <> 6S <> BYTE[ ] encData The encrypted entity that is to be modified.

10 4 TPM_AUTHHANDLE parentAuthHandle The authorization session handle used for the parent key.
2 H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
11 20 3 H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with parentAuthHandle
12 1 4 H1 1 BOOL continueAuthSession Ignored, parentAuthHandle is always terminated.
The authorization session digest for inputs and parentHandle. HMAC
13 20 TPM_AUTHDATA parentAuth
key: parentKey.usageAuth.

The authorization session handle used for the encrypted entity. The
14 4 TPM_AUTHHANDLE entityAuthHandle
session type MUST be OIAP
2 H2 20 TPM_NONCE entitylastNonceEven Even nonce previously generated by TPM
15 20 3 H2 20 TPM_NONCE entitynonceOdd Nonce generated by system associated with entityAuthHandle
16 1 4 H2 1 BOOL continueEntitySession Ignored, entityAuthHandle is always terminated.
The authorization session digest for the inputs and encrypted entity.
17 20 TPM_AUTHDATA entityAuth
HMAC key: entity.usageAuth.

Level 2 Revision 85 13 February 2005 Published 157


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2637 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH2_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation. See section 4.3.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_ChangeAuth
4 4 3S 4 UINT32 outDataSize The used size of the output area for outData
5 <> 4S <> BYTE[ ] outData The modified, encrypted entity.

6 20 2 H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs


3 H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with parentAuthHandle
7 1 4 H1 1 BOOL continueAuthSession Continue use flag, fixed value of FALSE
The authorization session digest for the returned parameters and
8 20 TPM_AUTHDATA resAuth
parentHandle. HMAC key: parentKey.usageAuth.

9 20 2 H2 20 TPM_NONCE entityNonceEven Even nonce newly generated by TPM to cover entity


3 H2 20 TPM_NONCE entitynonceOdd Nonce generated by system associated with entityAuthHandle
entityContinueAuthSes
10 1 4 H2 1 BOOL Continue use flag, fixed value of FALSE
sion
The authorization session digest for the returned parameters and entity.
11 20 TPM_AUTHDATA entityAuth
HMAC key: newly changed entity.usageAuth.

2638 Description
2639 1. The parentAuthHandle session type MUST be TPM_PID_OSAP.
2640 2. In this capability, the SRK cannot be accessed as entityType TPM_ET_KEY, since the
2641 SRK is not wrapped by a parent key.

2642 Actions
2643 1. Verify that entityType is one of TPM_ET_DATA, TPM_ET_KEY and return the error
2644 TPM_WRONG_ENTITYTYPE if not.
2645 2. Verify that parentAuthHandle session type is TPM_PID_OSAP return TPM_BAD_MODE
2646 on error
2647 3. Verify that entityAuthHandle session type is TPM_PID_OIAP return TPM_BAD_MODE on
2648 error
2649 4. The encData parameter MUST be the encData field from either the TPM_STORED_DATA
2650 or TPM_KEY structures.
2651 5. If parentAuthHandle indicates XOR encryption for the AuthData secrets
2652 a. Create X1 the SHA-1 of the concatenation of (parentAuthHandle -> sharedSecret ||
2653 authLastNonceEven)
2654 b. Create decryptAuth by XOR X1 and newAuth
2655 6. Else

158 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2656 a. Create newAuth by decrypting newAuth using the algorithm indicated in the OSAP
2657 session
2658 b. Key is from parentAuthHandle -> sharedSecret
2659 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
2660 7. The TPM MUST validate the command using the AuthData in the parentAuth parameter
2661 8. After parameter validation the TPM creates b1 by decrypting encData using the key
2662 pointed to by parentHandle.
2663 9. The TPM MUST validate that b1 is a valid TPM structure, either a
2664 TPM_STORE_ASYMKEY or a TPM_SEALED_DATA
2665 a. Check the tag, length and authValue for match, return TPM_INVALID_STRUCTURE
2666 on any mismatch
2667 10. The TPM replaces the AuthData for b1 with decryptAuth created above.
2668 11. The TPM encrypts b1 using the appropriate mechanism for the type using the
2669 parentKeyHandle to provide the key information.
2670 12. The TPM MUST enforce the destruction of both the parentAuthHandle and
2671 entityAuthHandle sessions.

Level 2 Revision 85 13 February 2005 Published 159


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2672 17.2 TPM_ChangeAuthOwner


2673 Start of informative comment:
2674 The TPM_ChangeAuthOwner command allows the owner of an entity to change the
2675 AuthData for the TPM Owner or the SRK.
2676 This command requires authorization from the current TPM Owner to execute.
2677 End of informative comment.

2678 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_ChangeAuthOwner
4 2 2S 2 TPM_PROTOCOL_ID protocolID The protocol in use.
The encrypted new AuthData for the entity. The encryption key is the
5 20 3S 20 TPM_ENCAUTH newAuth
shared secret from the OSAP protocol.
6 2 4S 2 TPM_ENTITY_TYPE entityType The type of entity to be modified

7 4 TPM_AUTHHANDLE ownerAuthHandle The authorization session handle used for the TPM Owner.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with ownerAuthHandle
9 1 4H1 1 BOOL continueAuthSession Continue use flag the TPM ignores this value
The authorization session digest for inputs and ownerHandle. HMAC key:
10 20 TPM_AUTHDATA ownerAuth
ownerAuth.

2679 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal Command ordinal TPM_ORD_ChangeAuthOwner

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with ownerAuthHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, fixed value of FALSE
The authorization session digest for the returned parameters and
6 20 TPM_AUTHDATA resAuth ownerHandle. HMAC key: ownerAuth, the original value and not the new
auth value

160 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2680 Actions
2681 1. The TPM MUST validate the command using the AuthData in the ownerAuth parameter
2682 2. The ownerAuthHandle session type MUST be TPM_PID_OSAP
2683 3. Verify that entityType is either TPM_ET_OWNER or TPM_ET_SRK, and return the error
2684 TPM_WRONG_ENTITYTYPE if not.
2685 4. If ownerAuthHandle indicates XOR encryption for the AuthData secrets
2686 a. Create X1 the SHA-1 of the concatenation of (ownerAuthHandle -> sharedSecret ||
2687 authLastNonceEven)
2688 b. Create decryptAuth by XOR X1 and newAuth
2689 5. Else
2690 a. Create newAuth by decrypting newAuth using the algorithm indicated in the OSAP
2691 session
2692 b. Key is the previous ownerAuth
2693 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
2694 6. The TPM MUST enforce the destruction of the ownerAuthHandle session upon
2695 completion of this command (successful or unsuccessful). This includes setting
2696 continueAuthSession to FALSE
2697 7. Set the AuthData for the indicated entity to decryptAuth
2698 8. Invalidate all authorization sessions, active or saved

Level 2 Revision 85 13 February 2005 Published 161


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2699 18. Authorization Sessions


2700 18.1 TPM_OIAP
2701 Incoming Operands and Sizes
PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_OIAP.

2702 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 4 TPM_AUTHHANDLE authHandle Handle that TPM creates that points to the authorization state.
5 20 TPM_NONCE nonceEven Nonce generated by TPM and associated with session.

2703 Actions
2704 1. The TPM_OIAP command allows the creation of an authorization session handle and the
2705 tracking of the handle by the TPM. The TPM generates the handle and nonce.
2706 2. The TPM has an internal limit as to the number of handles that may be open at one
2707 time, so the request for a new handle may fail if there is insufficient space available.
2708 3. Internally the TPM will do the following:
2709 a. TPM allocates space to save handle, protocol identification, both nonces and any
2710 other information the TPM needs to manage the session.
2711 b. TPM generates authHandle and nonceEven, returns these to caller
2712 4. On each subsequent use of the OIAP session the TPM MUST generate a new nonceEven
2713 value.
2714 5. When TPM_OIAP is wrapped in an encrypted transport session no input or output
2715 parameters encrypted

2716 18.1.1 Actions to validate an OIAP session


2717 Start of informative comment:
2718 This section describes the authorization-related actions of a TPM when it receives a
2719 command that has been authorized with the OIAP protocol.
2720 Many commands use OIAP authorization. The following description is therefore necessarily
2721 abstract.

162 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2722 End of informative comment.

2723 Actions
2724 The TPM MUST perform the following operations:
2725 1. The TPM MUST verify that the authorization session handle (H, say) referenced in the
2726 command points to a valid session. If it does not, the TPM returns the error code
2727 TPM_INVALID_AUTHHANDLE
2728 2. The TPM SHALL retrieve the latest version of the caller’s nonce (nonceOdd) and
2729 continueAuthSession flag from the input parameter list, and store it in internal TPM
2730 memory with the authSession ‘H’.
2731 3. The TPM SHALL retrieve the latest version of the TPM’s nonce stored with the
2732 authorization session H (authLastNonceEven) computed during the previously executed
2733 command.
2734 4. The TPM MUST retrieve the secret AuthData (SecretE, say) of the target entity. The
2735 entity and its secret must have been previously loaded into the TPM.
2736 5. The TPM SHALL perform a HMAC calculation using the entity secret data, ordinal, input
2737 command parameters and authorization parameters per section TODOREF
2738 6. The TPM SHALL compare HM to the AuthData value received in the input parameters. If
2739 they are different, the TPM returns the error code TPM_AUTHFAIL if the authorization
2740 session is the first session of a command, or TPM_AUTH2FAIL if the authorization
2741 session is the second session of a command. Otherwise, the TPM executes the command
2742 which (for this example) produces an output that requires authentication.
2743 7. The TPM SHALL generate a nonce (nonceEven).
2744 8. The TPM creates an HMAC digest to authenticate the return code, return values and
2745 authorization parameters to the same entity secret per section TODOREF
2746 9. The TPM returns the return code, output parameters, authorization parameters and
2747 authorization session digest.
2748 10. If the output continueUse flag is FALSE, then the TPM SHALL terminate the session.
2749 Future references to H will return an error.

Level 2 Revision 85 13 February 2005 Published 163


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2750 18.2 TPM_OSAP


2751 Start of informative comment:
2752 The TPM_OSAP command creates the authorization session handle, the shared secret and
2753 generates nonceEven and nonceEvenOSAP.
2754 End of informative comment.

2755 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_OSAP.
4 2 TPM_ENTITY_TYPE entityType The type of entity in use
5 4 UINT32 entityValue The selection value based on entityType, e.g. a keyHandle #
6 20 TPM_NONCE nonceOddOSAP The nonce generated by the caller associated with the shared secret.

2756 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 4 TPM_AUTHHANDLE authHandle Handle that TPM creates that points to the authorization state.
5 20 TPM_NONCE nonceEven Nonce generated by TPM and associated with session.
6 20 TPM_NONCE nonceEvenOSAP Nonce generated by TPM and associated with shared secret.

2757 Description
2758 1. The TPM_OSAP command allows the creation of an authorization session handle and the
2759 tracking of the handle by the TPM. The TPM generates the handle, nonceEven and
2760 nonceEvenOSAP.
2761 2. The TPM has an internal limit on the number of handles that may be open at one time,
2762 so the request for a new handle may fail if there is insufficient space available.
2763 3. The TPM_OSAP allows the binding of an authorization to a specific entity. This allows
2764 the caller to continue to send in AuthData for each command but not have to request
2765 the information or cache the actual AuthData.
2766 4. When TPM_OSAP is wrapped in an encrypted transport session
2767 a. For input and output no parameters are encrypted or logged
2768 5. If the owner pointer is pointing to a delegate row, the TPM internally MUST treat the
2769 OSAP session as a DSAP session

164 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2770 Actions
2771 1. The TPM creates S1 a storage area that keeps track of the information associated with
2772 the authorization.
2773 2. S1 MUST track the following information
2774 a. Protocol identification
2775 b. nonceEven
2776 i. Initialized to the next value from the TPM RNG
2777 c. shared secret
2778 d. Any other internal TPM state the TPM needs to manage the session
2779 3. The TPM MUST create and MAY track the following information
2780 a. nonceEvenOSAP
2781 i. Initialized to the next value from the TPM RNG
2782 4. The TPM calculates the shared secret using an HMAC calculation. The key for the HMAC
2783 calculation is the secret AuthData assigned to the key handle identified by entityValue.
2784 The input to the HMAC calculation is the concatenation of nonces nonceEvenOSAP and
2785 nonceOddOSAP. The output of the HMAC calculation is the shared secret which is
2786 saved in the authorization area associated with authHandle
2787 5. If entityType = TPM_ET_KEYHANDLE or TPM_ET_KEYAES or TPM_ET_KEYXOR
2788 a. The entity to authorize is a key held in the TPM. entityValue contains the keyHandle
2789 that holds the key.
2790 b. If entityValue is TPM_KH_OPERATOR return TPM_BADHANDLE
2791 6. else if entityType = TPM_ET_OWNER or TPM_ET_OWENERAES or TPM_ET_OWNERXOR
2792 a. This value indicates that the entity is the TPM owner. entityValue is ignored
2793 b. The HMAC key is the secret pointed to by ownerReference (owner secret or delegated
2794 secret)
2795 7. else if entityType = TPM_ET_SRK
2796 a. The entity to authorize is the SRK. entityValue is ignored.
2797 8. else if entityType = TPM_ET_COUNTER
2798 a. The entity is a monotonic counter, entityValue contains the counter handle
2799 9. else if entityType = TPM_ET_NV
2800 a. The entity is a NV index, entityValue contains the NV index
2801 10. else return TPM_BAD_PARAMETER
2802 11. End if
2803 12. On each subsequent use of the OSAP session the TPM MUST generate a new nonce
2804 value.
2805 13. The TPM MUST ensure that OSAP shared secret is only available while the OSAP session
2806 is valid.

Level 2 Revision 85 13 February 2005 Published 165


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2807 14. The session MUST terminate upon any of the following conditions:
2808 a. The command that uses the session returns an error
2809 b. The resource is evicted from the TPM or otherwise invalidated
2810 c. The session is used in any command for which the shared secret is used to encrypt
2811 an input parameter (TPM_ENCAUTH)
2812 d. The TPM Owner is cleared
2813 e. TPM_ChangeAuthOwner is executed and this session is attached to the owner
2814 authorization
2815 f. The session explicitly terminated with continueAuth, TPM_Reset or
2816 TPM_FlushSpecific
2817 g. All OSAP sessions MUST be invalidated when any of the following commands
2818 execute:
2819 i. TPM_Delegate_Manage
2820 ii. TPM_Delegate_CreateOwnerDelegation with Increment==TRUE
2821 iii. TPM_Delegate_LoadOwnerDelegation

2822 18.2.1 Actions to validate an OSAP session


2823 Start of informative comment:
2824 This section describes the authorization-related actions of a TPM when it receives a
2825 command that has been authorized with the OSAP protocol.
2826 Many commands use OSAP authorization. The following description is therefore necessarily
2827 abstract.
2828 End of informative comment

2829 Actions
2830 1. On reception of a command with ordinal C1 that uses an authorization session, the TPM
2831 SHALL perform the following actions:
2832 2. The TPM MUST have been able to retrieve the shared secret (Shared, say) of the target
2833 entity when the authorization session was established with TPM_OSAP. The entity and
2834 its secret must have been previously loaded into the TPM.
2835 3. The TPM MUST verify that the authorization session handle (H, say) referenced in the
2836 command points to a valid session. If it does not, the TPM returns the error code
2837 TPM_INVALID_AUTHHANDLE.
2838 4. The TPM MUST calculate the HMAC (HM1, say) of the command parameters according
2839 to section TODOREF
2840 5. The TPM SHALL compare HM1 to the AuthData value received in the command. If they
2841 are different, the TPM returns the error code TPM_AUTHFAIL if the authorization session
2842 is the first session of a command, or TPM_AUTH2FAIL if the authorization session is the
2843 second session of a command., the TPM executes command C1 which produces an
2844 output (O, say) that requires authentication and uses a particular return code (RC, say).

166 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2845 6. The TPM SHALL generate the latest version of the even nonce (nonceEven).
2846 7. The TPM MUST calculate the HMAC (HM2) of the return parameters according to section
2847 TODOREF
2848 8. The TPM returns HM2 in the parameter list.
2849 9. The TPM SHALL retrieve the continue flag from the received command. If the flag is
2850 FALSE, the TPM SHALL terminate the session and destroy the thread associated with
2851 handle H.
2852 10. If the shared secret was used to provide confidentiality for data in the received
2853 command, the TPM SHALL terminate the session and destroy the thread associated with
2854 handle H.
2855 11. Each time that access to an entity (key) is authorized using OSAP, the TPM MUST
2856 ensure that the OSAP shared secret is that derived from the entity using TPM_OSAP

Level 2 Revision 85 13 February 2005 Published 167


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2857 18.3 TPM_DSAP


2858 Start of informative comment:
2859 The TPM_DSAP command creates the authorization session handle using a delegated
2860 AuthData value passed into the command as an encrypted blob or from the internal
2861 delegation table. It can be used to start an authorization session for a user key or the
2862 owner.
2863 Identically to TPM_OSAP, it generates a shared secret and generates nonceEven and
2864 nonceEvenOSAP.
2865 End of informative comment.

2866 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, fixed value of TPM_ORD_DSAP.
4 2 TPM_ENTITY_TYPE entityType The type of delegation information to use
Key for which delegated authority corresponds, or 0 if delegated owner activity.
5 4 TPM_KEY_HANDLE KeyHandle
Only relevant if entityValue equals TPM_DELEGATE_USEKEY_BLOB
6 20 TPM_NONCE nonceOddDSAP The nonce generated by the caller associated with the shared secret.
7 4 UINT32 entityValueSize The size of entityValue.
TPM_DELEGATE_USERKEY_BLOB or TPM_DELEGATE_OWNER_BLOB or
index MUST not be empty
8 <> BYTE [ ] entityValue
If entityType is TPM_ET_DEL_ROW then entityValue is a
TPM_DELEGATE_INDEX

2867 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.
4 4 TPM_AUTHHANDLE authHandle Handle that TPM creates that points to the authorization state.
5 20 TPM_NONCE nonceEven Nonce generated by TPM and associated with session.
6 20 TPM_NONCE nonceEvenDSAP Nonce generated by TPM and associated with shared secret.

2868 Description
2869 1. The TPM_DSAP command allows the creation of an authorization session handle and the
2870 tracking of the handle by the TPM. The TPM generates the handle, nonceEven and
2871 nonceEvenOSAP.
2872 2. The TPM has an internal limit on the number of handles that may be open at one time,
2873 so the request for a new handle may fail if there is insufficient space available.

168 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2874 3. The TPM_DSAP allows the binding of a delegated authorization to a specific entity. This
2875 allows the caller to continue to send in AuthData for each command but not have to
2876 request the information or cache the actual AuthData.
2877 4. On each subsequent use of the DSAP session the TPM MUST generate a new nonce
2878 value and check if the ordinal to be executed has delegation to execute. The TPM MUST
2879 ensure that the DSAP shared secret is only available while the DSAP session is valid.
2880 5. When TPM_DSAP is wrapped in an encrypted transport session
2881 a. For input the only parameter encrypted or logged is entityValue
2882 b. For output no parameters are encrypted or logged
2883 6. The DSAP session MUST terminate under any of the following conditions
2884 a. The command that uses the session returns an error
2885 b. If attached to a key, when the key is evicted from the TPM or otherwise invalidated
2886 c. The session is used in any command for which the shared secret is used to encrypt
2887 an input parameter (TPM_ENCAUTH)
2888 d. The TPM Owner is cleared
2889 e. TPM_ChangeAuthOwner is executed and this session is attached to the owner
2890 authorization
2891 f. The session explicitly terminated with continueAuth, TPM_Reset or
2892 TPM_FlushSpecific
2893 g. All DSAP sessions MUST be invalidated when any of the following commands
2894 execute:
2895 i. TPM_Delegate_CreateOwnerDelegation
2896 ii. When Increment is TRUE
2897 iii. TPM_Delegate_LoadOwnerDelegation
2898 iv. TPM_Delegate_Manage
2899 entityType = TPM_ET_DEL_OWNER_BLOB
2900 The entityValue parameter contains a delegation blob structure.
2901 entityType = TPM_ET_DEL_ROW
2902 The entityValue parameter contains a row number in the nv Delegation table which should
2903 be used for the AuthData value.

2904 Actions
2905 1. If entityType == TPM_ET_DEL_OWNER_BLOB
2906 a. Map entityValue to B1 a TPM_DELEGATE_OWNER_BLOB
2907 b. Validate that B1 is a valid TPM_DELEGATE_OWNER_BLOB, return
2908 TPM_WRONG_ENTITYTYPE on error
2909 c. Locate B1 -> familyID in the TPM_FAMILY_TABLE and set familyRow to indicate row,
2910 return TPM_BADINDEX if not found

Level 2 Revision 85 13 February 2005 Published 169


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2911 d. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]


2912 e. If FR -> flags TPM_FAMFLAG_ENABLED is FALSE, return TPM_DISABLED_CMD
2913 f. Verify that B1->verificationCount equals FR -> verificationCount.
2914 g. Validate the integrity of the blob
2915 i. Copy B1 -> integrityDigest to H2
2916 ii. Set B1 -> integrityDigest to NULL
2917 iii. Create H3 the HMAC of B1 using tpmProof as the secret
2918 iv. Compare H2 to H3 return TPM_AUTHFAIL on mismatch
2919 h. Create S1 a TPM_DELEGATE_SENSITIVE by decrypting B1 -> sensitiveArea using
2920 TPM_DELEGATE_KEY
2921 i. Validate S1 values
2922 i. S1 -> tag is TPM_TAG_DELEGATE_SENSITIVE
2923 ii. Return TPM_BAD_DELEGATE on error
2924 j. Set A1 to S1 -> authValue
2925 2. Else if entityType == TPM_ET_DEL_ROW
2926 a. Verify that entityValue points to a valid row in the delegation table.
2927 b. Set d1 to the delegation information in the row.
2928 c. Set a1 to d1->authValue.
2929 d. Locate D1 -> familyID in the TPM_FAMILY_TABLE and set familyRow to indicate that
2930 row, return TPM_BADINDEX if not found
2931 e. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]
2932 f. If FR -> flags TPM_FAMFLAG_ENABLED is FALSE, return TPM_DISABLED_CMD
2933 g. Verify that d1->verificationCount equals FR -> verificationCount.
2934 3. Else if entityType == TPM_ET_DEL_KEY_BLOB
2935 a. Map entityValue to K1 a TPM_DELEGATE_KEY_BLOB
2936 b. Validate that K1 is a valid TPM_DELEGATE_KEY_BLOB, return
2937 TPM_WRONG_ENTITYTYPE on error
2938 c. Locate K1 -> familyID in the TPM_FAMILY_TABLE and set familyRow to indicate that
2939 row, return TPM_BADINDEX if not found
2940 d. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]
2941 e. If FR -> flags TPM_FAMFLAG_ENABLED is FALSE, return TPM_DISABLED_CMD
2942 f. Verify that K1 -> verificationCount equals FR -> verificationCount.
2943 g. Validate the integrity of the blob
2944 i. Copy K1 -> integrityDigest to H2
2945 ii. Set K1 -> integrityDigest to NULL

170 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2946 iii. Create H3 the HMAC of K1 using tpmProof as the secret


2947 iv. Compare H2 to H3 return TPM_AUTHFAIL on mismatch
2948 h. Validate the K1 -> pubKeyDigest identifies keyHandle, return TPM_KEYNOTFOUND
2949 on error
2950 i. Create S1 a TPM_DELEGATE_SENSITIVE by decrypting K1 -> sensitiveArea using
2951 TPM_DELEGATE_KEY
2952 j. Validate S1 values
2953 i. S1 -> tag is TPM_TAG_DELEGATE_SENSTIVE
2954 ii. Return TPM_BAD_DELEGATE on error
2955 k. Set A1 to S1 -> authValue
2956 4. Generate a new authorization session handle and reserve space to save protocol
2957 identification, shared secret, pcrInfo, both nonces, delegated permission bits and any
2958 other information the TPM needs to manage the session.
2959 5. Read two new values from the RNG to generate nonceEven and nonceEvenOSAP.
2960 6. The TPM calculates the shared secret using an HMAC calculation. The key for the HMAC
2961 calculation is a1. The input to the HMAC calculation is the concatenation of nonces
2962 nonceEvenOSAP and nonceOddOSAP. The output of the HMAC calculation is the
2963 shared secret which is saved in the authorization area associated with authHandle.

Level 2 Revision 85 13 February 2005 Published 171


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2964 18.4 TPM_SetOwnerPointer


2965 Start of informative comment:
2966 This command will set a reference to which secret the TPM will use when executing an
2967 owner secret related OIAP or OSAP session.
2968 This command should only be used if legacy code must be enabled for delegation to work.
2969 End of informative comment.

2970 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_ COMMAND


2 4 UINT32 paramSize Total number of input bytes incl. paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Ordinal: TPM_ORD_SetOwnerPointer
4 2 TPM_ENTITY_TYPE entityType The type of entity in use
5 4 UINT32 entityValue The selection value based on entityType,

2971 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_ COMMAND


2 4 UINT32 paramSize Total number of output bytes
3 4 TPM_RESULT returnCode The return code of the operation

2972 Actions
2973 1. Map TPM_STCLEAR_DATA to V1
2974 2. If entityType = TPM_ET_DEL_ROW
2975 a. This value indicates that the entity is a delegate row. entityValue is a delegate index
2976 in the delegation table.
2977 b. Validate that entityValue points to a legal row within the delegate table stored within
2978 the TPM. If not ok return TPM_BADINDEX
2979 c. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]
2980 d. If FR -> flags TPM_FAMFLAG_ENABLED is FALSE, return TPM_DISABLED_CMD
2981 e. Verify that B1->verificationCount equals FR -> verificationCount.
2982 f. The TPM sets V1-> OwnerReference to entityValue
2983 g. Return TPM_SUCCESS
2984 3. else if entityType = TPM_ET_OWNER
2985 a. This value indicates that the entity is the TPM owner. entityValue is ignored.
2986 b. The TPM sets V1-> OwnerReference to TPM_KH_OWNER

172 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

2987 c. Return TPM_SUCCESS


2988 4. Return TPM_FAIL

Level 2 Revision 85 13 February 2005 Published 173


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

2989 19. Delegation Commands


2990 19.1 TPM_Delegate_Manage
2991 Start of informative comment:
2992 TPM_Delegate_Manage is the fundamental process for managing the Family tables,
2993 including enabling/disabling Delegation for a selected Family. Normally
2994 TPM_Delegate_Manage must be executed at least once (to create Family tables for a
2995 particular family) before any other type of Delegation command in that family can succeed.
2996 Delegate_Manage is authorized by the TPM Owner if an Owner is installed, because
2997 changing a table is a privileged Owner operation. If no Owner is installed, Delegate_Manage
2998 requires no privilege to execute. This does not disenfranchise an Owner, since there is no
2999 Owner, and simplifies loading of tables during platform manufacture or on first-boot. Burn-
3000 out of TPM non-volatile storage by inappropriate use is mitigated by the TPM’s normal limits
3001 on NV-writes in the absence of an Owner. Tables can be locked after loading, to prevent
3002 subsequent tampering, and only unlocked by the Owner, his delegate, or the act of
3003 removing the Owner (even if there is no Owner).
3004 TPM_Delegate_Manage command is customized by opcode:
3005 (1) TPM_FAMILY_ENABLE enables/disables use of a family and all the rows of the delegate
3006 table belonging to that family,
3007 (2) TPM_FAMILY_ADMIN can be used to prevent further management of the Tables until an
3008 Owner is installed, or until the Owner is removed from the TPM. (Note that the Physical
3009 Presence command TPM_ForceClear always enables further management, even if
3010 TPM_ForceClear is used when no Owner is installed.)
3011 (3) TPM_FAMILY_CREATE creates a new family.
3012 (4) TPM_FAMILY_INVALIDATE invalidates an existing family.
3013 End of informative comment.

3014 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_Delegate_Manage

4 4 2S 4 TPM_FAMILY_ID familyID The familyID that is to be managed

5 4 3s 4 TPM_FAMILY_OPERATION opCode Operation to be performed by this command.


6 4 4s 4 UINT32 opDataSize Size in bytes of opData
7 <> 5s <> BYTE [ ] opData Data necessary to implement opCode

8 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle

174 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

10 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
11 20 TPM_AUTHDATA ownerAuth HMAC key: ownerAuth.

Level 2 Revision 85 13 February 2005 Published 175


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3015 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation
2S 4 TPM_COMMAND_CODE ordinal ordinal: TPM_ORD_Delegate_Manage
4 4 3S 4 UINT32 retDataSize Size in bytes of retData
5 <> 4S <> BYTE [ ] retData Returned data

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
8 20 TPM_AUTHDATA resAuth HMAC key: ownerAuth.

3016 Action
3017 1. If TPM Owner is installed
3018 a. Validate the command and parameters using TPM Owner authentication, return
3019 TPM_AUTHFAIL on error
3020 b. If the authHandle session type is TPM_PID_DSAP
3021 i. If opCode = TPM_FAMILY_CREATE
3022 ii. The TPM MUST ignore familyID
3023 iii. Else
3024 iv. Verify that the familyID associated with authHandle matches the familyID
3025 parameter, return TPM_DELEGATE_FAMILY on error
3026 2. Else
3027 a. If opCode != TPM_FAMILY_CREATE and (familyTable -> famTableRow -> flags ->
3028 TPM_DELEGATE_ADMIN_LOCK) is TRUE return TPM_DELEGATE_LOCK
3029 b. Validate max NV writes without an owner
3030 i. Set NV1 to TPM_PERMANENT_DATA -> noOwnerNVWrite
3031 ii. Increment NV1 by 1
3032 iii. If NV1 > TPM_MAX_NV_WRITE_NOOWNER return TPM_MAXNVWRITES
3033 iv. Set TPM_PERMANENT_DATA -> noOwnerNVWrite to NV1
3034 3. The TPM invalidates sessions
3035 a. MUST invalidate all DSAP sessions
3036 b. MUST invalidate all OSAP sessions associated with the delegation table
3037 c. MUST set TPM_STCLEAR_DATA -> ownerReference to TPM_KH_OWNER

176 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3038 d. MAY invalidate any other session


3039 4. If opCode == TPM_FAMILY_CREATE
3040 a. Validate that sufficient space exists within the TPM to store an additional family and
3041 map F2 to the newly allocated space.
3042 b. Validate that opData is a TPM_FAMILY_LABEL
3043 i. If opDataSize != sizeof(TPM_FAMILY_LABEL) return TPM_BAD_PARAM_SIZE
3044 c. Map F2 to a TPM_FAMILY_TABLE_ENTRY
3045 i. Set F2 -> tag to TPM_TAG_FAMILY_TABLE_ENTRY
3046 ii. Set F2 -> familyLabel to opData
3047 d. Increment TPM_PERMANENT_DATA -> lastFamilyID by 1
3048 e. Set F2 -> familyID = TPM_PERMANENT_DATA -> lastFamilyID
3049 f. Set F2 -> verificationCount = 1
3050 g. Set F2 -> flags -> TPM_FAMFLAG_ENABLE to FALSE
3051 h. Set F2 -> flags -> TPM_DELEGATE_ADMIN_LOCK to FALSE
3052 i. Set retDataSize = 4
3053 j. Set retData = F2 -> familyID
3054 k. Return TPM_SUCCESS
3055 5. Locate familyID in the TPM_FAMILY_TABLE and set familyRow to indicate row, return
3056 TPM_BADINDEX if not found
3057 a. If authHandle is of type DSAP then continueAuthSession MUST set to FALSE
3058 b. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]
3059 c. Sets TPM_STCLEAR_DATA-> ownerReference to TPM_KH_OWNER
3060 6. If opCode == TPM_FAMILY_ADMIN
3061 a. Validate that opDataSize == 1, and that opData is a Boolean value.
3062 b. Set (FR -> flags -> TPM_DELEGATE_ADMIN_LOCK) = opData
3063 c. Set retDataSize = 0
3064 d. Return TPM_SUCCESS
3065 7. else If opCode == TPM_FAMILY_ENABLE
3066 a. Validate that opDataSize == 1, and that opData is a Boolean value.
3067 b. Set FR -> flags-> TPM_FAMFLAG_ENABLE = opData
3068 c. Set retDataSize = 0
3069 d. Return TPM_SUCCESS
3070 8. else If opCode == TPM_FAMILY_INVALIDATE
3071 a. Invalidate all data associated with familyRow
3072 i. All data is all information pointed to by FR

Level 2 Revision 85 13 February 2005 Published 177


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3073 ii. return TPM_SELFTEST_FAILED on failure


3074 b. Set retDataSize = 0
3075 c. Return TPM_SUCCESS
3076 9. Else return TPM_BAD_PARAMETER

178 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3077 19.2 TPM_Delegate_CreateKeyDelegation


3078 Start of informative comment:
3079 This command delegates privilege to use a key by creating a blob that can be used by
3080 TPM_DSAP.
3081 These blobs CANNOT be used as input data for TPM_LoadOwnerDelegation because the
3082 internal TPM delegate table can store owner delegations only.
3083 (TPM_Delegate_CreateOwnerDelegation must be used to delegate Owner privilege.)
3084 End of informative comment

3085 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
Command ordinal, fixed value of
3 4 1S 4 TPM_COMMAND_CODE ordinal
TPM_ORD_Delegate_CreateKeyDelegation.
4 4 TPM_KEY_HANDLE keyHandle The keyHandle identifier of a loaded key.
5 <> 2S <> TPM_DELEGATE_PUBLIC publicInfo The public information necessary to fill in the blob
The encrypted new AuthData for the blob. The encryption key is the
6 20 3S 20 TPM_ENCAUTH delAuth
shared secret from the OSAP protocol.

7 4 TPM_AUTHHANDLE authHandle The authorization session handle used for keyHandle authorization
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H1 1 BOOL continueAuthSession Ignored
The authorization session digest that authorizes the use of keyHandle.
10 20 TPM_AUTHDATA privAuth
HMAC key: key.usageAuth

3086 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
Command ordinal, fixed value of
2S 4 TPM_COMMAND_CODE ordinal
TPM_ORD_Delegate_CreateKeyDelegation
4 4 3S 4 UINT32 blobSize The length of the returned blob
5 <> 4S <> TPM_DELEGATE_KEY_BLOB blob The partially encrypted delegation information.

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag. Fixed value of FALSE
8 20 TPM_AUTHDATA resAuth The authorization session digest for the returned parameters. HMAC key:

Level 2 Revision 85 13 February 2005 Published 179


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

key.usageAuth

3087 Description
3088 1. The use restrictions that may be present on the key pointed to by keyHandle are not
3089 enforced for this command. Stated another way CreateKeyDelegation is not a use of the
3090 key.

3091 Action
3092 1. Verify AuthData for the command and parameters using privAuth
3093 2. Locate publicInfo -> familyID in the TPM_FAMILY_TABLE and set familyRow to indicate
3094 row, return TPM_BADINDEX if not found
3095 3. If the key authentication is in fact a delegation, then the TPM SHALL validate the
3096 command and parameters using Delegation authorisation, then
3097 a. Validate that authHandle -> familyID equals publicInfo -> familyID return
3098 TPM_DELEGATE_FAMILY on error
3099 b. If TPM_FAMILY_TABLE.famTableRow[ delegation -> familyID] -> flags ->
3100 TPM_FAMFLAG_ENABLED is FALSE, return error TPM_DISABLED_CMD.
3101 c. Verify that the delegation bits in publicInfo do not grant more permissions then
3102 currently delegated. Otherwise return error TPM_BAD_AUTHFAIL
3103 4. Verify that authHandle indicates an OSAP session return TPM_INVALID_AUTHHANDLE
3104 on error
3105 5. If authHandle indicates XOR encryption for the AuthData secrets
3106 a. Create X1 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
3107 authLastNonceEven)
3108 b. Create a1 by XOR X1 and delAuth
3109 6. Else
3110 a. Create a1 by decrypting delAuth using the algorithm indicated in the OSAP session
3111 b. Key is from authHandle -> sharedSecret
3112 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
3113 7. Create h1 the SHA-1 of TPM_STORE_PUBKEY structure of the key pointed to by
3114 keyHandle
3115 8. Create M1 a TPM_DELEGATE_SENSITIVE structure
3116 a. Set M1 -> tag to TPM_TAG_DELEGATE_SENSITIVE
3117 b. Set M1 -> authValue to a1
3118 c. The TPM MAY add additional information of a sensitive nature relative to the
3119 delegation
3120 9. Create M2 the encryption of M1 using TPM_DELEGATE_KEY
3121 10. Create P1 a TPM_DELEGATE_KEY_BLOB
3122 a. Set P1 -> tag to TPM_TAG_DELG_KEY_BLOB

180 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3123 b. Set P1 -> pubKeyDigest to H1


3124 c. Set P1 -> pub to PublicInfo
3125 d. Set P1 -> integrityDigest to NULL
3126 e. The TPM sets additionalArea and additionalAreaSize appropriate for this TPM. The
3127 information MAY include symmetric IV, symmetric mode of encryption and other
3128 data that allows the TPM to process the blob in the future.
3129 f. Set P1 -> sensitiveSize to the size of M2
3130 g. Set P1 -> sensitiveArea to M2
3131 11. Calculate H2 the HMAC of P1 using tpmProof as the secret
3132 12. Set P1 -> integrityDigest to H2
3133 13. Ignore continueAuthSession on input set continueAuthSession to FALSE on output
3134 14. Return P1 as blob

Level 2 Revision 85 13 February 2005 Published 181


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3135 19.3 TPM_Delegate_CreateOwnerDelegation


3136 Start of informative comment:
3137 TPM_Delegate_CreateOwnerDelegation delegates the Owner’s privilege to use a set of
3138 command ordinals, by creating a blob. Such blobs can be used as input data for TPM_DSAP
3139 or TPM_Delegate_LoadOwnerDelegation.
3140 TPM_Delegate_CreateOwnerDelegation includes the ability to void all existing delegations
3141 (by incrementing the verification count) before creating the new delegation. This ensures
3142 that the new delegation will be the only delegation that can operate at Owner privilege in
3143 this family. This new delegation could be used to enable a security monitor (a local separate
3144 entity, or remote separate entity, or local host entity) to reinitialize a family and perhaps
3145 perform external verification of delegation settings. Normally the ordinals for a delegated
3146 security monitor would include TPM_Delegate_CreateKeyDelegation (this command) in order
3147 to permit the monitor to create further delegations, and TPM_Delegate_UpdateVerification to
3148 reactivate some previously voided delegations.
3149 If the verification count is incremented and the new delegation does not delegate any
3150 privileges (to any ordinals) at all, or uses an authorisation value that is then discarded, this
3151 family’s delegations are all void and delegation must be managed using actual Owner
3152 authorisation.
3153 (TPM_Delegate_CreateKeyDelegation must be used to delegate privilege to use a key.)
3154 End of informative comment.

3155 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal TPM_ORD_Delegate_CreateOwnerDelegation.
4 1 2S 1 BOOL increment Flag dictates whether verificationCount will be incremented
5 <> 3S <> TPM_DELEGATE_PUBLIC publicInfo The public parameters for the blob
The encrypted new AuthData for the blob. The encryption key is the
6 20 4S 20 TPM_ENCAUTH delAuth
shared secret from the OSAP protocol.

7 4 TPM_AUTHHANDLE authHandle The authorization session handle TPM Owner authentication


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H1 1 BOOL continueAuthSession Ignored
10 20 TPM_AUTHDATA privAuth The authorization session digest. HMAC key:ownerAuth

182 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3156 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal TPM_ORD_Delegate_CreateOwnerDelegation
4 4 3S 4 UINT32 blobSize The length of the returned blob
TPM_DELEGATE_OWNER_B
5 <> 4S <> blob The partially encrypted delegation information.
LOB

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag. Fixed value of FALSE
The authorization session digest for the returned parameters. HMAC key:
8 20 TPM_AUTHDATA resAuth
ownerAuth

3157 Action
3158 1. The TPM SHALL authenticate the command using TPM Owner authentication. Return
3159 TPM_AUTHFAIL on failure.
3160 2. If the TPM Owner authentication is in fact a delegation, then the TPM SHALL validate
3161 the command and parameters using Delegation authorisation, then
3162 a. Validate that delegation -> familyID equals publicInfo -> familyID return
3163 TPM_DELEGATE_FAMILY or error
3164 b. If TPM_FAMILY_TABLE.famTableRow[ delegation -> familyID] -> flags ->
3165 TPM_FAMFLAG_ENABLED is FALSE, return error TPM_DISABLED_CMD.
3166 c. Verify that the delegation bits in publicInfo do not grant more permissions then
3167 currently delegated. Otherwise return error TPM_BAD_AUTH.
3168 3. Locate publicInfo -> familyID in the TPM_FAMILY_TABLE and set familyRow to indicate
3169 the row return TPM_BADINDEX if not found
3170 a. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]
3171 4. If increment == TRUE
3172 a. Increment FR -> count
3173 b. Set TPM_STCLEAR_DATA-> OwnerReference to TPM_KH_OWNER
3174 c. The TPM invalidates sessions
3175 i. MUST invalidate all DSAP sessions
3176 ii. MUST invalidate all OSAP sessions associated with the delegation table
3177 iii. MAY invalidate any other session
3178 5. Verify that authHandle indicates an OSAP session return TPM_INVALID_AUTHHANDLE
3179 on error

Level 2 Revision 85 13 February 2005 Published 183


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3180 6. If authHandle indicates XOR encryption for the AuthData secrets


3181 a. Create X1 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
3182 authLastNonceEven)
3183 b. Create a1 by XOR X1 and delAuth
3184 7. Else
3185 a. Create a1 by decrypting delAuth using the algorithm indicated in the OSAP session
3186 b. Key is from authHandle -> sharedSecret
3187 c. IV is SHA-1 of (authLastNonceEven || nonceOdd)
3188 8. Create M1 a TPM_DELEGATE_SENSITIVE structure
3189 a. Set M1 -> tag to TPM_TAG_DELEGATE_SENSITIVE
3190 b. Set M1 -> authValue to a1
3191 c. Set other M1 fields as determined by the TPM vendor
3192 9. Create M2 the encryption of M1 using TPM_DELEGATE_KEY
3193 10. Create B1 a TPM_DELEGATE_OWNER_BLOB
3194 a. If delegated, verify that (B1 -> pub -> familyID) is the current familyID and return
3195 error TPM_DELEGATE_FAMILY otherwise
3196 b. Set B1 -> tag to TPM_TAG_DELG_OWNER_BLOB
3197 c. Set B1 -> pub to publicInfo
3198 d. Set B1 -> sensitiveSize to the size of M2
3199 e. Set B1 -> sensitiveArea to M2
3200 f. Set B1 -> integrityDigest to NULL
3201 g. Set B1 -> verificationCount to FR -> count
3202 11. The TPM sets additionalArea and additionalAreaSize appropriate for this TPM. The
3203 information MAY include symmetric IV, symmetric mode of encryption and other data
3204 that allows the TPM to process the blob in the future.
3205 12. Create H1 the HMAC of B1 using tpmProof as the secret
3206 13. Set B1 -> integrityDigest to H1
3207 14. Ignore continueAuthSession on input set continueAuthSession to FALSE on output
3208 15. Return B1 as blob

184 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3209 19.4 TPM_Delegate_LoadOwnerDelegation


3210 Start of informative comment:
3211 This command loads a delegate table row blob into a non-volatile delegate table row.
3212 Delegate_LoadOwnerDelegation can be used during manufacturing or on first boot (when no
3213 Owner is installed), or after an Owner is installed. If an Owner is installed,
3214 Delegate_LoadOwnerDelegation requires Owner authorisation, and sensitive information
3215 must be encrypted.
3216 Burn-out of TPM non-volatile storage by inappropriate use is mitigated by the TPM’s normal
3217 limits on NV-writes in the absence of an Owner. Tables can be locked after loading using
3218 TPM_Delegate_Manage, to prevent subsequent tampering.
3219 A management system outside the TPM is expected to manage the delegate table rows
3220 stored on the TPM, and can overwrite any previously stored data.
3221 This command cannot be used to load key delegation blobs into the TPM
3222 End of informative comment.

3223 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes incl. paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Ordinal: TPM_ORD_Delegate_LoadDelegationOwner
4 4 3S 4 TPM_DELEGATE_INDEX index The index of the delegate row to be written
5 4 4S 4 UINT32 blobSize The size of the delegate blob
TPM_DELEGATE_OWNER
6 <> 5S <> blob Delegation information, including encrypted portions as appropriate
_BLOB

7 4 TPM_AUTHHANDLE authHandle The authorization session handle TPM Owner authentication


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
9 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
10 20 TPM_AUTHDATA ownerAuth The authorization session digest. HMAC key:ownerAuth

Level 2 Revision 85 13 February 2005 Published 185


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3224 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes
3 4 1S 4 TPM_RESULT returnCode The return code of the operation
2S 4 TPM_COMMAND_CODE ordinal TPM_ORD_Delegate_LoadDelegationOwner

5 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
6 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
7 20 TPM_AUTHDATA resAuth Authorization HMAC key: ownerAuth.

3225 Actions
3226 1. Map blob to D1 a TPM_DELEGATE_OWNER_BLOB.
3227 a. Validate that D1 -> tag == TPM_TAG_DELEGATE_OWNER_BLOB
3228 2. Locate D1 -> pub -> familyID in the TPM_FAMILY_TABLE and set familyRow to indicate
3229 row, return TPM_BADINDEX if not found
3230 3. Set FR to TPM_FAMILY_TABLE -> famTableRow[familyRow]
3231 4. If TPM Owner is installed
3232 a. Validate the command and parameters using TPM Owner authentication, return
3233 TPM_AUTHFAIL on error
3234 b. If the authHandle session type is TPM_PID_DSAP, verify that D1 -> pub -> familyID
3235 matches authHandle -> familyID, on error return TPM_DELEGATE_FAMILY
3236 5. Else
3237 a. If FR -> flags -> TPM_DELEGATE_ADMIN_LOCK is TRUE return
3238 TPM_DELEGATE_LOCK
3239 b. Validate max NV writes without an owner
3240 i. i. Set NV1 to PD -> noOwnerNVWrite
3241 ii. ii. Increment NV1 by 1
3242 iii. iii. If NV1 > TPM_MAX_NV_WRITE_NOOWNER return TPM_MAXNVWRITES
3243 iv. iv. Set PD -> noOwnerNVWrite to NV1
3244 6. If FR -> flags -> TPM_FAMFLAG_ENABLED is FALSE, return TPM_DISABLED_CMD
3245 7. If TPM Owner is installed, validate the integrity of the blob
3246 a. Copy D1 -> integrityDigest to H2
3247 b. Set D1 -> integrityDigest to NULL
3248 c. Create H3 the HMAC of D1 using tpmProof as the secret

186 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3249 d. Compare H2 to H3, return TPM_AUTHFAIL on mismatch


3250 8. If TPM Owner is installed, create S1 a TPM_DELEGATE_SENSITIVE area by decrypting
3251 D1 -> sensitiveArea using TPM_DELEGATE_KEY. Otherwise set S1 = D1 -> sensitiveArea
3252 9. Validate S1
3253 a. Validate that S1 -> tag == TPM_TAG_DELEGATE_SENSITIVE, return
3254 TPM_INVALID_STRUCTURE on error
3255 10. Validate that index is a valid value for delegateTable, return TPM_BADINDEX on error
3256 11. The TPM invalidates sessions
3257 a. MUST invalidate all DSAP sessions
3258 b. MUST invalidate all OSAP sessions associated with the delegation table
3259 c. MAY invalidate any other session
3260 12. Copy data to the delegate table row
3261 a. Copy the TPM_DELEGATE_PUBLIC from D1 -> pub to TPM_DELEGATE_TABLE ->
3262 delRow[index] -> pub.
3263 b. Copy the TPM_SECRET from S1 -> authValue to TPM_DELEGATE_TABLE ->
3264 delRow[index] -> authValue.
3265 c. Set TPM_STCLEAR_DATA-> ownerReference to TPM_KH_OWNER
3266 d. If authHandle is of type DSAP then continueAuthSession MUST set to FALSE
3267 13. Return TPM_SUCCESS

Level 2 Revision 85 13 February 2005 Published 187


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3268 19.5 TPM_Delegate_ReadTable


3269 Start of informative comment:
3270 This command reads from the TPM the public contents of the family and delegate tables
3271 that are stored on the TPM. Such data is required during external verification of tables.
3272 There are no restrictions on the execution of this command; anyone can read this
3273 information regardless of the state of the PCRs, regardless of whether they know any
3274 specific AuthData value and regardless of whether or not the enable and admin bits are set
3275 one way or the other.
3276 End of informative comment.

3277 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal TPM_ORD_Delegate_ReadTable

3278 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation
4 4 UINT32 familyTableSize Size in bytes of familyTable
5 <> BYTE [ ] familyTable Array of TPM_FAMILY_TABLE_ENTRY elements
6 4 UINT32 delegateTableSize Size in bytes of delegateTable
Array of TPM_DELEGATE_INDEX and TPM_DELEGATE_PUBLIC
7 <> BYTE[] delegateTable
elements

3279 Actions
3280 1. Set familyTableSize to the number of valid families on the TPM times
3281 sizeof(TPM_FAMILY_TABLE_ELEMENT).
3282 2. Copy the valid entries in the internal family table to the output array familyTable
3283 3. Set delegateTableSize to the number of valid delegate table entries on the TPM times
3284 (sizeof(TPM_DELEGATE_PUBLIC) + 4).
3285 4. For each valid entry
3286 a. Write the TPM_DELEGATE_INDEX to delegateTable
3287 b. Copy the TPM_DELEGATE_PUBLIC to delegateTable
3288 5. Return TPM_SUCCESS

188 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3289 19.6 TPM_Delegate_UpdateVerification


3290 Start of informative comment:
3291 UpdateVerification sets the verificationCount in an entity (a blob or a delegation row) to the
3292 current family value, in order that the delegations represented by that entity will continue
3293 to be accepted by the TPM.
3294 End of informative comment.

3295 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_Delegate_Update

4 4 2S 4 UINT32 inputSize The size of inputData

TPM_DELEGATE_KEY_BLOB or TPM_DELEGATE_OWNER_BLOB
5 <> 3S <> BYTE inputData
or table index

6 4 TPM_AUTHHANDLE authHandle The authorization session handle used for owner authentication.
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
7 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
8 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
9 20 TPM_AUTHDATA ownerAuth Authorization HMAC key: ownerAuth.

Level 2 Revision 85 13 February 2005 Published 189


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3296 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation
2S 4 TPM_COMMAND_CODE ordinal Command ordinal: TPM_ORD_Delegate_UpdateVerification
4 4 3S 4 UINT32 outputSize The size of the output
5 <> 4S <> BYTE outputData TPM_DELEGATE_KEY_BLOB or TPM_DELEGATE_OWNER_BLOB

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
The authorization session digest for the returned parameters. HMAC key:
8 20 TPM_AUTHDATA resAuth
ownerAuth.

3297 Actions
3298 1. Verify the TPM Owner, directly or indirectly through delegation, authorizes the command
3299 and parameters, on error return TPM_AUTHFAIL
3300 2. Determine the type of inputData (TPM_DELEGATE_TABLE_ROW or
3301 TPM_TAG_DELG_OWNER_BLOB or TPM_DELEGATE_KEY_BLOB) and map D1 to that
3302 structure
3303 a. Mapping to TPM_DELEGATE_TABLE_ROW requires taking inputData as a tableIndex
3304 and locating the appropriate row in the table
3305 3. If D1 is TPM_TAG_DELG_OWNER_BLOB or TPM_DELEGATE_KEY_BLOB Validate the
3306 integrity of D1
3307 a. Copy D1 -> integrityDigest to H2
3308 b. Set D1 -> integrityDigest to NULL
3309 c. Create H3 the HMAC of D1 using tpmProof as the secret
3310 d. Compare H2 to H3 return TPM_AUTHFAIL on mismatch
3311 4. Locate (D1 -> pub -> familyID) in the TPM_FAMILY_TABLE and set familyRow to
3312 indicate row, return TPM_BADINDEX if not found
3313 5. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]
3314 6. If delegated, verify that family of the delegated Owner-auth is the same as D1: (delegate -
3315 > familyID) == (D1 -> pub -> familyID); otherwise return error TPM_DELEGATE_FAMILY
3316 7. If delegated, verify that the family of the delegated Owner-auth is enabled: if (delegate ->
3317 familyID -> flags TPM_FAMFLAG_ENABLED) is FALSE, return TPM_DISABLED_CMD
3318 8. Set D1 -> verificationCount to FR -> verificationCount
3319 9. If D1 is TPM_TAG_DELG_OWNER_BLOB or TPM_DELEGATE_KEY_BLOB set the
3320 integrity of D1

190 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3321 a. Set D1 -> integrityDigest to NULL


3322 b. Create H1 the HMAC of D1 using tpmProof as the secret
3323 c. Set D1 -> integrityDigest to H1
3324 10. If D1 is a blob recreate the blob and return it

Level 2 Revision 85 13 February 2005 Published 191


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3325 19.7 TPM_Delegate_VerifyDelegation


3326 Start of informative comment:
3327 VerifyDelegation interprets a delegate blob and returns success or failure, depending on
3328 whether the blob is currently valid. The delegate blob is NOT loaded into the TPM.
3329 End of informative comment.

3330 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 TPM_COMMAND_CODE ordinal Command ordinal, TPM_Delegate_VerifyDelegation
4 4 UINT32 delegationSize The length of the delegated information blob
5 <> BYTE[ ] delegation TPM_DELEGATE_KEY_BLOB or TPM_DELEGATE_OWNER_BLOB

3331 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 TPM_RESULT returnCode The return code of the operation.

3332 Actions
3333 1. Determine the type of blob, If delegation -> tag is equal to
3334 TPM_TAG_DELGATE_OWNER_BLOB then
3335 a. Map D1 a TPM_DELEGATE_OWNER_BLOB to delegation
3336 2. Else if delegation -> tag = TPM_TAG_DELG_OWNER_BLOB
3337 a. Map D1 a TPM_DELEGATE_KEY_BLOB to delegation
3338 3. Else return TPM_BAD_PARAMETER
3339 4. Locate D1 -> familyID in the TPM_FAMILY_TABLE and set familyRow to indicate row,
3340 return TPM_BADINDEX if not found
3341 5. Set FR to TPM_FAMILY_TABLE.famTableRow[familyRow]
3342 6. If FR -> flags TPM_FAMFLAG_ENABLED is FALSE, return TPM_DISABLED_CMD
3343 7. Validate that D1 -> pub -> verificationCount matches FR -> verificationCount, on
3344 mismatch return TPM_FAMILYCOUNT
3345 8. Validate the integrity of D1
3346 a. Copy D1 -> integrityDigest to H2
3347 b. Set D1 -> integrityDigest to NULL

192 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3348 c. Create H3 the HMAC of D1 using tpmProof as the secret


3349 d. Compare H2 to H3 return TPM_AUTHFAIL on mismatch
3350 9. Create S1 a TPM_DELEGATE_SENSITIVE area by decrypting D1 -> sensitiveArea using
3351 TPM_DELEGATE_KEY
3352 10. Validate S1 values
3353 a. S1 -> tag is TPM_TAG_DELEGATE_SENSTIVE
3354 b. Return TPM_BAD_PARAMETER on error
3355 11. Return TPM_SUCCESS

Level 2 Revision 85 13 February 2005 Published 193


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3356 20. Non-volatile Storage


3357 Start of informative comment:
3358 This section handles the allocation and use of the TPM non-volatile storage.
3359 End of informative comment.

3360 20.1 TPM_NV_DefineSpace


3361 Start of informative comment:
3362 This establishes the space necessary for the indicated index. The definition will include the
3363 access requirements for writing and reading the area.
3364 The space definition size does not include the area needed to manage the space.
3365 End of informative comment.

3366 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Ordinal, TPM_ORD_NV_DefineSpace
4 <> 2S <> TPM_NV_DATA_PUBLIC pubInfo The public parameters of the NV area
The encrypted AuthData, only valid if the attributes require subsequent
5 20 3S 20 TPM_ENCAUTH encAuth
authorization

6 4 TPM_AUTHHANDLE authHandle The authorization session handle used for ownerAuth


2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
7 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
8 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
9 20 TPM_AUTHDATA ownerAuth The authorization session digest HMAC key: ownerAuth

3367 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal ordinal, TPM_ORD_NV_DefineSpace

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, fixed to FALSE
6 20 TPM_AUTHDATA ownerAuth The authorization session digest HMAC key: ownerAuth

194 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3368 Actions
3369 1. If pubInfo -> nvIndex == TPM_NV_INDEX_LOCK and tag = TPM_TAG_RQU_COMMAND
3370 a. Set TPM_PERMANENT_FLAGS -> nvLocked to TRUE
3371 b. Return TPM_SUCCESS
3372 2. If TPM_PERMANENT_FLAGS -> nvLocked is FALSE then all authorization checks except
3373 for the Max NV writes are ignored
3374 a. Ignored checks include physical presence, authorization, 'D' bit check, and
3375 bGlobalLock
3376 3. If pubInfo -> nvIndex has the D bit (bit 28) set to a 1 or pubInfo -> nvIndex == 0 then
3377 a. Return TPM_BADINDEX
3378 b. The D bit specifies an index value that is set in manufacturing and can never be
3379 deleted or added to the TPM
3380 c. Index value of 0 is reserved and cannot be defined
3381 4. If tag = TPM_TAG_RQU_AUTH1_COMMAND then
3382 a. The TPM MUST validate the command and parameters using the TPM Owner
3383 authentication and ownerAuth, on error return TPM_AUTHFAIL
3384 b. authHandle session type MUST be OSAP
3385 c. If authHandle indicates XOR encryption for the AuthData secrets
3386 i. Create X1 the SHA-1 of the concatenation of (authHandle -> sharedSecret ||
3387 authLastNonceEven)
3388 ii. Create a1 by XOR X1 and encAuth
3389 d. Else
3390 i. Create a1 by decrypting encAuth using the algorithm indicated in the OSAP
3391 session
3392 ii. Key is from authHandle -> sharedSecret
3393 iii. IV is SHA-1 of (authLastNonceEven || nonceOdd)
3394 5. else
3395 a. Validate the assertion of physical presence. Return TPM_BAD_PRESENCE on error.
3396 b. If TPM Owner is present then return TPM_OWNER_SET.
3397 c. If pubInfo -> dataSize is 0 then return TPM_BAD_DATASIZE. Setting the size to 0
3398 represents an attempt to delete the value without TPM Owner authentication.
3399 d. Validate max NV writes without an owner
3400 i. Set NV1 to TPM_PERMANENT_DATA -> noOwnerNVWrite
3401 ii. Increment NV1 by 1
3402 iii. If NV1 > TPM_MAX_NV_WRITE_NOOWNER return TPM_MAXNVWRITES
3403 iv. Set TPM_PERMANENT_DATA -> noOwnerNVWrite to NV1

Level 2 Revision 85 13 February 2005 Published 195


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3404 e. Set A1 to encAuth. There is no nonce or authorization to create the encryption string,
3405 hence the AuthData value is passed in the clear
3406 6. If pubInfo -> nvIndex points to a valid previously defined storage area then
3407 a. Map D1 a TPM_NV_DATA_SENSITIVE to the storage area
3408 b. If D1 -> attributes specifies TPM_NV_PER_GLOBALLOCK then
3409 i. If TPM_STCLEAR_FLAGS -> bGlobalLock is TRUE then return
3410 TPM_AREA_LOCKED
3411 c. If D1 -> attributes specifies TPM_NV_PER_WRITE_STCLEAR
3412 i. If D1 -> pubInfo -> bWriteSTClear is TRUE then return TPM_AREA_LOCKED
3413 d. Invalidate the data area currently pointed to by D1 and ensure that if the area is
3414 reallocated no residual information is left
3415 e. If pubInfo -> dataSize is 0 then return TPM_SUCCESS
3416 7. Parse pubInfo -> pcrInfoRead
3417 a. Validate pcrInfoRead structure on error return TPM_INVALID_STRUCTURE
3418 i. Validation includes proper PCR selections and locality selections
3419 8. Parse pubInfo -> pcrInfoWrite
3420 a. Validate pcrInfoWrite structure on error return TPM_INVALID_STRUCTURE
3421 i. Validation includes proper PCR selections and locality selections
3422 b. If pcrInfoWrite -> localityAtRelease disallows some localities
3423 i. Set writeLocalities to TRUE
3424 c. Else
3425 i. Set writeLocalities to FALSE
3426 9. Validate that the attributes are consistent
3427 a. The TPM SHALL ignore the bReadSTClear, bWriteSTClear and bWriteDefine
3428 attributes during the execution of this command
3429 b. If TPM_NV_PER_OWNERWRITE is TRUE and TPM_NV_PER_AUTHWRITE is TRUE
3430 return TPM_AUTH_CONFLICT
3431 c. If TPM_NV_PER_OWNERREAD is TRUE and TPM_NV_PER_AUTHREAD is TRUE
3432 return TPM_AUTH_CONFLICT
3433 d. If TPM_NV_PER_OWNERWRITE and TPM_NV_PER_AUTHWRITE and
3434 TPM_NV_PER_WRITEDEFINE and TPM_NV_PER_PPWRITE and writeLocalities are all
3435 FALSE
3436 i. Return TPM_PER_NOWRITE
3437 e. Validate nvIndex
3438 i. Make sure that the index is applicable for this TPM return TPM_BADINDEX on
3439 error. A valid index is platform and context sensitive. That is attempting to
3440 validate an index may be successful in one configuration and invalid in another

196 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3441 configuration. The individual index values MUST indicate if there are any
3442 restrictions on the use of the index.
3443 f. If dataSize is 0 return TPM_BAD_PARAM_SIZE
3444 10. Create D1 a TPM_NV_DATA_SENSITIVE structure
3445 11. Validate that sufficient NV is available to store the data
3446 a. return TPM_NOSPACE if pubInfo -> dataSize is not available in the TPM
3447 12. Ensure that the TPM reserves the space for dataSize
3448 a. Set all bytes in the newly defined area to 0xFF
3449 13. Set D1 -> pubInfo to pubInfo
3450 14. Set D1 -> authValue to A1
3451 15. Set D1 -> pubInfo -> bReadSTClear = FALSE;
3452 16. Set D1 -> pubInfo -> bWriteSTClear = FALSE;
3453 17. Set D1 -> pubInfo -> bWriteDefine = FALSE;
3454 18. Ignore continueAuthSession on input and set to FALSE on output
3455 19. Return TPM_SUCCESS

Level 2 Revision 85 13 February 2005 Published 197


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3456 20.2 TPM_NV_WriteValue


3457 Start of informative comment:
3458 This command writes the value to a defined area. The write can be TPM Owner authorized
3459 or unauthorized and protected by other attributes and will work when no TPM Owner is
3460 present.
3461 End of informative comment.

3462 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Ordinal, TPM_ORD_NV_WRITEVALUE
4 4 2S 4 TPM_NV_INDEX nvIndex The index of the area to set
5 4 3S 4 UINT32 offset The offset into the NV Area
6 4 4S 4 UINT32 dataSize The size of the data parameter
7 <> 5S <> BYTE data The data to set the area to

8 4 TPM_AUTHHANDLE authHandle The authorization session handle used for TPM Owner
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE authNonceOdd Nonce generated by caller
10 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
11 20 TPM_AUTHDATA ownerAuth The authorization session digest HMAC key: ownerAuth

3463 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal ordinal, TPM_ORD_NV_WRITEVALUE

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE authNonceOdd Nonce generated by caller
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
6 20 TPM_AUTHDATA ownerAuth The authorization session digest HMAC key: ownerAuth

3464 Actions
3465 1. If TPM_PERMANENT_FLAGS -> nvLocked is FALSE then all authorization checks except
3466 for the max NV writes are ignored
3467 a. Ignored checks include physical presence, authorization, and PCR

198 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3468 2. If nvIndex = 0 then


3469 a. Set TPM_STCLEAR_FLAGS -> bGlobalLock to TRUE
3470 b. return TPM_SUCCESS
3471 3. Locate and set D1 to the TPM_NV_DATA_AREA that corresponds to nvIndex, return
3472 TPM_BADINDEX on error
3473 4. If tag = TPM_TAG_RQU_AUTH1_COMMAND then
3474 a. If D1 -> TPM_NV_OWNERWRITE is FALSE return TPM_AUTH_CONFLICT
3475 b. Validate command and parameters using ownerAuth HMAC with TPM Owner
3476 authentication as the secret, return TPM_AUTHFAIL on error
3477 5. Else
3478 a. If D1 -> TPM_NV_PER_OWNERWRITE is TRUE return TPM_AUTH_CONFLICT
3479 b. If no TPM Owner validate max NV writes without an owner
3480 i. Set NV1 to TPM_PERMANENT_DATA -> noOwnerNVWrite
3481 ii. Increment NV1 by 1
3482 iii. If NV1 > TPM_MAX_NV_WRITE_NOOWNER return TPM_MAXNVWRITES
3483 iv. Set TPM_PERMANENT_DATA -> noOwnerNVWrite to NV1
3484 6. Check that D1 -> pcrInfoWrite -> localityAtRelease for TPM_STANY_DATA ->
3485 localityModifier is TRUE
3486 a. For example if TPM_STANY_DATA -> localityModifier was 2 then D1 -> pcrInfo ->
3487 localityAtRelease -> TPM_LOC_TWO would have to be TRUE
3488 b. On error return TPM_BAD_LOCALITY
3489 7. If D1 -> attributes specifies TPM_NV_PER_PPWRITE then validate physical presence is
3490 asserted if not return TPM_BAD_PRESENCE
3491 8. If D1 -> attributes specifies TPM_NV_PER_WRITEDEFINE
3492 a. If D1 -> bWriteDefine is TRUE return TPM_AREA_LOCKED
3493 9. If D1 -> attributes specifies TPM_NV_PER_GLOBALLOCK
3494 a. If TPM_STCLEAR_DATA -> bGlobalLock is TRUE return TPM_AREA_LOCKED
3495 10. If D1 -> attributes specifies TPM_NV_PER_WRITE_STCLEAR
3496 a. If D1 ->bWriteSTClear is TRUE return TPM_AREA_LOCKED
3497 11. If D1 -> pcrInfoWrite -> pcrSelection specifies a selection of PCR
3498 a. Create P1 a composite hash of the PCR specified by D1 -> pcrInfoWrite
3499 b. Compare P1 to D1 -> pcrInfoWrite -> digestAtRelease return TPM_WRONGPCRVAL
3500 on mismatch
3501 12. If dataSize = 0 then
3502 a. Set D1 -> bWriteSTClear to TRUE
3503 b. Set D1 -> bWriteDefine to TRUE

Level 2 Revision 85 13 February 2005 Published 199


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3504 13. Else


3505 a. Set S1 to offset + dataSize
3506 b. If S1 > D1 -> dataSize return TPM_NOSPACE
3507 c. If D1 -> attributes specifies TPM_NV_PER_WRITEALL
3508 i. If dataSize != D1 -> dataSize return TPM_NOT_FULLWRITE
3509 d. Write the new value into the NV storage area
3510 14. Set D1 -> bReadSTClear to FALSE
3511 15. Return TPM_SUCCESS

200 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3512 20.3 TPM_NV_WriteValueAuth


3513 Start of informative comment:
3514 This command writes to a previously defined area. The area must require authorization to
3515 write. This command is for using when authorization other than the owner authorization is
3516 to be used. Otherwise, you should use TPM_NV_WriteValue
3517 End of informative comment.

3518 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG Tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Ordinal, TPM_ORD_NV_WRITEVALUEAUTH
4 4 2S 4 TPM_NV_INDEX nvIndex The index of the area to set
5 4 3S 4 UINT32 offset The offset into the chunk
6 4 4S 4 UINT32 dataSize The size of the data area
7 <> 5S <> BYTE data The data to set the area to

8 4 TPM_AUTHHANDLE authHandle The authorization session handle used for NV element authorization
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
9 20 3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
10 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
11 20 TPM_AUTHDATA authValue HMAC key: NV element auth value

3519 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S 4 TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal ordinal, TPM_ORD_NV_WRITEVALUEAUTH

4 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE NonceOdd Nonce generated by system associated with authHandle
5 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
6 20 TPM_AUTHDATA authValue HMAC key: NV element auth value

3520 Actions
3521 1. If TPM_PERMANENT_FLAGS -> nvLocked is FALSE then all authorization checks except
3522 for the max NV writes are ignored
3523 2. Locate and set D1 to the TPM_NV_DATA_AREA that corresponds to nvIndex, return
3524 TPM_BADINDEX on error

Level 2 Revision 85 13 February 2005 Published 201


TCG PUBLISHED
Copyright © TCG TPM Main Part 3 Commands
Specification Version 1.2

3525 3. If D1 -> attributes does not specify TPM_NV_PER_AUTHWRITE then return


3526 TPM_AUTH_CONFLICT
3527 4. Validate authValue using D1 -> authValue, return TPM_AUTHFAIL on error
3528 5. Check that D1 -> pcrInfoWrite -> localityAtRelease for TPM_STANY_DATA ->
3529 localityModifier is TRUE
3530 a. For example if TPM_STANY_DATA -> localityModifier was 2 then D1 -> pcrInfo ->
3531 localityAtRelease -> TPM_LOC_TWO would have to be TRUE
3532 b. On error return TPM_BAD_LOCALITY
3533 6. If D1 -> attributes specifies TPM_NV_PER_PPWRITE then validate physical presence is
3534 asserted if not return TPM_BAD_PRESENCE
3535 7. If D1 -> pcrInfoWrite -> pcrSelection specifies a selection of PCR
3536 a. Create P1 a composite hash of the PCR specified by D1 -> pcrInfoWrite
3537 b. Compare P1 to digestAtRelease return TPM_WRONGPCRVAL on mismatch
3538 8. If D1 -> attributes specifies TPM_NV_PER_WRITEDEFINE
3539 a. If D1 -> bWriteDefine is TRUE return TPM_AREA_LOCKED
3540 9. If D1 -> attributes specifies TPM_NV_PER_GLOBALLOCK
3541 a. If TPM_STCLEAR_FLAGS -> bGlobalLock is TRUE return TPM_AREA_LOCKED
3542 10. If D1 -> attributes specifies TPM_NV_PER_WRITE_STCLEAR
3543 a. If D1 -> bWriteSTClear is TRUE return TPM_AREA_LOCKED
3544 11. If dataSize = 0 then
3545 a. Set D1 -> bWriteSTClear to TRUE
3546 b. Set D1 -> bWriteDefine to TRUE
3547 12. Else
3548 a. Set S1 to offset + dataSize
3549 b. If S1 > D1 -> dataSize return TPM_NOSPACE
3550 c. If D1 -> attributes specifies TPM_NV_PER_WRITEALL
3551 i. If d1 -> dataSize is <= TPM_MAX_NV_SIZE and dataSize != D1 -> dataSize return
3552 TPM_NOT_FULLWRITE
3553 d. Write the new value into the NV storage area
3554 13. Set D1 -> bReadSTClear to FALSE
3555 14. Return TPM_SUCCESS

202 Published Level 2 Revision 85 13 February 2005


TCG PUBLISHED
TPM Main Part 3 Commands TCG © Copyright
Specification Version 1.2

3556 20.4 TPM_NV_ReadValue


3557 Start of informative comment:
3558 Read a value from the NV store. This command uses optional owner authentication.
3559 Action 1 indicates that if the NV are is not locked then reading of the NV area continues
3560 without ANY authorization. This is intentional and allows a platform manufacturer to set
3561 the NV areas, read them back, and then lock them all without having to install a TPM
3562 owner.
3563 End of informative comment.

3564 Incoming Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of input bytes including paramSize and tag
3 4 1S 4 TPM_COMMAND_CODE ordinal Ordinal, TPM_ORD_NV_READVALUE
4 4 2S 4 TPM_NV_INDEX nvIndex The index of the area to set
5 4 3S 4 UINT32 offset The offset into the area
6 4 4S 4 UINT32 dataSize The size of the data area

7 4 TPM_AUTHHANDLE authHandle The authorization session handle used for TPM Owner authorization
2H1 20 TPM_NONCE authLastNonceEven Even nonce previously generated by TPM to cover inputs
8 20 3H1 20 TPM_NONCE authNonceOdd Nonce generated by caller
9 1 4H1 1 BOOL continueAuthSession The continue use flag for the authorization session handle
10 20 TPM_AUTHDATA ownerAuth HMAC key: ownerAuth

3565 Outgoing Operands and Sizes


PARAM HMAC
Type Name Description
# SZ # SZ

1 2 TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND


2 4 UINT32 paramSize Total number of output bytes including paramSize and tag
3 4 1S TPM_RESULT returnCode The return code of the operation.
2S 4 TPM_COMMAND_CODE ordinal TPM_ORD_NV_READVALUE
4 4 3S 4 UINT32 dataSize The size of the data area
5 <> 4S <> BYTE data The data to set the area to

6 20 2H1 20 TPM_NONCE nonceEven Even nonce newly generated by TPM to cover outputs
3H1 20 TPM_NONCE nonceOdd Nonce generated by system associated with authHandle
7 1 4H1 1 BOOL continueAuthSession Continue use flag, TRUE if handle is still active
8 20 TPM_AUTHDATA ownerAuth HMAC key: ownerAuth

3566 Actions

Level 2 Revision 85 13 February 2005 Published 203


TCG PUBLISHED

You might also like