]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Include/Library/Tpm2CommandLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / SecurityPkg / Include / Library / Tpm2CommandLib.h
CommitLineData
c1d93242
JY
1/** @file\r
2 This library is used by other modules to send TPM2 command.\r
3\r
8ed85689 4Copyright (c) 2013 - 2021, Intel Corporation. All rights reserved. <BR>\r
289b714b 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
c1d93242
JY
6\r
7**/\r
8\r
9#ifndef _TPM2_COMMAND_LIB_H_\r
10#define _TPM2_COMMAND_LIB_H_\r
11\r
12#include <IndustryStandard/Tpm20.h>\r
13\r
14/**\r
15 This command starts a hash or an Event sequence.\r
16 If hashAlg is an implemented hash, then a hash sequence is started.\r
17 If hashAlg is TPM_ALG_NULL, then an Event sequence is started.\r
18\r
19 @param[in] HashAlg The hash algorithm to use for the hash sequence\r
20 An Event sequence starts if this is TPM_ALG_NULL.\r
21 @param[out] SequenceHandle A handle to reference the sequence\r
b3548d32 22\r
c1d93242
JY
23 @retval EFI_SUCCESS Operation completed successfully.\r
24 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
25**/\r
26EFI_STATUS\r
27EFIAPI\r
28Tpm2HashSequenceStart (\r
c411b485
MK
29 IN TPMI_ALG_HASH HashAlg,\r
30 OUT TPMI_DH_OBJECT *SequenceHandle\r
c1d93242
JY
31 );\r
32\r
33/**\r
34 This command is used to add data to a hash or HMAC sequence.\r
35 The amount of data in buffer may be any size up to the limits of the TPM.\r
36 NOTE: In all TPM, a buffer size of 1,024 octets is allowed.\r
37\r
38 @param[in] SequenceHandle Handle for the sequence object\r
39 @param[in] Buffer Data to be added to hash\r
b3548d32 40\r
c1d93242
JY
41 @retval EFI_SUCCESS Operation completed successfully.\r
42 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
43**/\r
44EFI_STATUS\r
45EFIAPI\r
46Tpm2SequenceUpdate (\r
c411b485
MK
47 IN TPMI_DH_OBJECT SequenceHandle,\r
48 IN TPM2B_MAX_BUFFER *Buffer\r
c1d93242
JY
49 );\r
50\r
51/**\r
52 This command adds the last part of data, if any, to an Event sequence and returns the result in a digest list.\r
53 If pcrHandle references a PCR and not TPM_RH_NULL, then the returned digest list is processed in\r
54 the same manner as the digest list input parameter to TPM2_PCR_Extend() with the pcrHandle in each\r
55 bank extended with the associated digest value.\r
56\r
57 @param[in] PcrHandle PCR to be extended with the Event data\r
58 @param[in] SequenceHandle Authorization for the sequence\r
59 @param[in] Buffer Data to be added to the Event\r
60 @param[out] Results List of digests computed for the PCR\r
b3548d32 61\r
c1d93242
JY
62 @retval EFI_SUCCESS Operation completed successfully.\r
63 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
64**/\r
65EFI_STATUS\r
66EFIAPI\r
67Tpm2EventSequenceComplete (\r
c411b485
MK
68 IN TPMI_DH_PCR PcrHandle,\r
69 IN TPMI_DH_OBJECT SequenceHandle,\r
70 IN TPM2B_MAX_BUFFER *Buffer,\r
71 OUT TPML_DIGEST_VALUES *Results\r
c1d93242
JY
72 );\r
73\r
74/**\r
75 This command adds the last part of data, if any, to a hash/HMAC sequence and returns the result.\r
76\r
77 @param[in] SequenceHandle Authorization for the sequence\r
78 @param[in] Buffer Data to be added to the hash/HMAC\r
79 @param[out] Result The returned HMAC or digest in a sized buffer\r
b3548d32 80\r
c1d93242
JY
81 @retval EFI_SUCCESS Operation completed successfully.\r
82 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
83**/\r
84EFI_STATUS\r
85EFIAPI\r
86Tpm2SequenceComplete (\r
c411b485
MK
87 IN TPMI_DH_OBJECT SequenceHandle,\r
88 IN TPM2B_MAX_BUFFER *Buffer,\r
89 OUT TPM2B_DIGEST *Result\r
c1d93242
JY
90 );\r
91\r
92/**\r
93 Send Startup command to TPM2.\r
94\r
95 @param[in] StartupType TPM_SU_CLEAR or TPM_SU_STATE\r
96\r
97 @retval EFI_SUCCESS Operation completed successfully.\r
98 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
99**/\r
100EFI_STATUS\r
101EFIAPI\r
102Tpm2Startup (\r
c411b485 103 IN TPM_SU StartupType\r
c1d93242
JY
104 );\r
105\r
106/**\r
107 Send Shutdown command to TPM2.\r
108\r
109 @param[in] ShutdownType TPM_SU_CLEAR or TPM_SU_STATE.\r
110\r
111 @retval EFI_SUCCESS Operation completed successfully.\r
112 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
113**/\r
114EFI_STATUS\r
115EFIAPI\r
116Tpm2Shutdown (\r
c411b485 117 IN TPM_SU ShutdownType\r
c1d93242
JY
118 );\r
119\r
120/**\r
121 This command causes the TPM to perform a test of its capabilities.\r
122 If the fullTest is YES, the TPM will test all functions.\r
123 If fullTest = NO, the TPM will only test those functions that have not previously been tested.\r
124\r
125 @param[in] FullTest YES if full test to be performed\r
126 NO if only test of untested functions required\r
127\r
128 @retval EFI_SUCCESS Operation completed successfully.\r
129 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
130**/\r
131EFI_STATUS\r
132EFIAPI\r
133Tpm2SelfTest (\r
c411b485 134 IN TPMI_YES_NO FullTest\r
c1d93242
JY
135 );\r
136\r
967eacca
JY
137/**\r
138 This command allows setting of the authorization policy for the platform hierarchy (platformPolicy), the\r
139 storage hierarchy (ownerPolicy), and and the endorsement hierarchy (endorsementPolicy).\r
140\r
141 @param[in] AuthHandle TPM_RH_ENDORSEMENT, TPM_RH_OWNER or TPM_RH_PLATFORM+{PP} parameters to be validated\r
142 @param[in] AuthSession Auth Session context\r
143 @param[in] AuthPolicy An authorization policy hash\r
144 @param[in] HashAlg The hash algorithm to use for the policy\r
145\r
146 @retval EFI_SUCCESS Operation completed successfully.\r
147 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
148**/\r
149EFI_STATUS\r
150EFIAPI\r
151Tpm2SetPrimaryPolicy (\r
c411b485
MK
152 IN TPMI_RH_HIERARCHY_AUTH AuthHandle,\r
153 IN TPMS_AUTH_COMMAND *AuthSession,\r
154 IN TPM2B_DIGEST *AuthPolicy,\r
155 IN TPMI_ALG_HASH HashAlg\r
967eacca
JY
156 );\r
157\r
c1d93242
JY
158/**\r
159 This command removes all TPM context associated with a specific Owner.\r
160\r
161 @param[in] AuthHandle TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP}\r
162 @param[in] AuthSession Auth Session context\r
b3548d32 163\r
c1d93242
JY
164 @retval EFI_SUCCESS Operation completed successfully.\r
165 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
166**/\r
167EFI_STATUS\r
168EFIAPI\r
169Tpm2Clear (\r
c411b485
MK
170 IN TPMI_RH_CLEAR AuthHandle,\r
171 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL\r
c1d93242
JY
172 );\r
173\r
174/**\r
175 Disables and enables the execution of TPM2_Clear().\r
176\r
177 @param[in] AuthHandle TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP}\r
178 @param[in] AuthSession Auth Session context\r
179 @param[in] Disable YES if the disableOwnerClear flag is to be SET,\r
180 NO if the flag is to be CLEAR.\r
181\r
182 @retval EFI_SUCCESS Operation completed successfully.\r
183 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
184**/\r
185EFI_STATUS\r
186EFIAPI\r
187Tpm2ClearControl (\r
c411b485
MK
188 IN TPMI_RH_CLEAR AuthHandle,\r
189 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL,\r
190 IN TPMI_YES_NO Disable\r
c1d93242
JY
191 );\r
192\r
193/**\r
194 This command allows the authorization secret for a hierarchy or lockout to be changed using the current\r
195 authorization value as the command authorization.\r
196\r
197 @param[in] AuthHandle TPM_RH_LOCKOUT, TPM_RH_ENDORSEMENT, TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}\r
198 @param[in] AuthSession Auth Session context\r
199 @param[in] NewAuth New authorization secret\r
200\r
201 @retval EFI_SUCCESS Operation completed successfully.\r
202 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
203**/\r
204EFI_STATUS\r
205EFIAPI\r
206Tpm2HierarchyChangeAuth (\r
c411b485
MK
207 IN TPMI_RH_HIERARCHY_AUTH AuthHandle,\r
208 IN TPMS_AUTH_COMMAND *AuthSession,\r
209 IN TPM2B_AUTH *NewAuth\r
c1d93242
JY
210 );\r
211\r
212/**\r
213 This replaces the current EPS with a value from the RNG and sets the Endorsement hierarchy controls to\r
214 their default initialization values.\r
215\r
216 @param[in] AuthHandle TPM_RH_PLATFORM+{PP}\r
217 @param[in] AuthSession Auth Session context\r
218\r
219 @retval EFI_SUCCESS Operation completed successfully.\r
220 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
221**/\r
222EFI_STATUS\r
223EFIAPI\r
224Tpm2ChangeEPS (\r
c411b485
MK
225 IN TPMI_RH_PLATFORM AuthHandle,\r
226 IN TPMS_AUTH_COMMAND *AuthSession\r
c1d93242
JY
227 );\r
228\r
229/**\r
230 This replaces the current PPS with a value from the RNG and sets platformPolicy to the default\r
231 initialization value (the Empty Buffer).\r
232\r
233 @param[in] AuthHandle TPM_RH_PLATFORM+{PP}\r
234 @param[in] AuthSession Auth Session context\r
235\r
236 @retval EFI_SUCCESS Operation completed successfully.\r
237 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
238**/\r
239EFI_STATUS\r
240EFIAPI\r
241Tpm2ChangePPS (\r
c411b485
MK
242 IN TPMI_RH_PLATFORM AuthHandle,\r
243 IN TPMS_AUTH_COMMAND *AuthSession\r
c1d93242
JY
244 );\r
245\r
246/**\r
247 This command enables and disables use of a hierarchy.\r
248\r
249 @param[in] AuthHandle TPM_RH_ENDORSEMENT, TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}\r
250 @param[in] AuthSession Auth Session context\r
251 @param[in] Hierarchy Hierarchy of the enable being modified\r
252 @param[in] State YES if the enable should be SET,\r
253 NO if the enable should be CLEAR\r
254\r
255 @retval EFI_SUCCESS Operation completed successfully.\r
256 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
257**/\r
258EFI_STATUS\r
259EFIAPI\r
260Tpm2HierarchyControl (\r
c411b485
MK
261 IN TPMI_RH_HIERARCHY AuthHandle,\r
262 IN TPMS_AUTH_COMMAND *AuthSession,\r
263 IN TPMI_RH_HIERARCHY Hierarchy,\r
264 IN TPMI_YES_NO State\r
c1d93242
JY
265 );\r
266\r
267/**\r
268 This command cancels the effect of a TPM lockout due to a number of successive authorization failures.\r
269 If this command is properly authorized, the lockout counter is set to zero.\r
270\r
271 @param[in] LockHandle LockHandle\r
272 @param[in] AuthSession Auth Session context\r
273\r
274 @retval EFI_SUCCESS Operation completed successfully.\r
275 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
276**/\r
277EFI_STATUS\r
278EFIAPI\r
279Tpm2DictionaryAttackLockReset (\r
c411b485
MK
280 IN TPMI_RH_LOCKOUT LockHandle,\r
281 IN TPMS_AUTH_COMMAND *AuthSession\r
c1d93242
JY
282 );\r
283\r
284/**\r
285 This command cancels the effect of a TPM lockout due to a number of successive authorization failures.\r
286 If this command is properly authorized, the lockout counter is set to zero.\r
287\r
288 @param[in] LockHandle LockHandle\r
289 @param[in] AuthSession Auth Session context\r
290 @param[in] NewMaxTries Count of authorization failures before the lockout is imposed\r
291 @param[in] NewRecoveryTime Time in seconds before the authorization failure count is automatically decremented\r
292 @param[in] LockoutRecovery Time in seconds after a lockoutAuth failure before use of lockoutAuth is allowed\r
293\r
294 @retval EFI_SUCCESS Operation completed successfully.\r
295 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
296**/\r
297EFI_STATUS\r
298EFIAPI\r
299Tpm2DictionaryAttackParameters (\r
c411b485
MK
300 IN TPMI_RH_LOCKOUT LockHandle,\r
301 IN TPMS_AUTH_COMMAND *AuthSession,\r
302 IN UINT32 NewMaxTries,\r
303 IN UINT32 NewRecoveryTime,\r
304 IN UINT32 LockoutRecovery\r
c1d93242
JY
305 );\r
306\r
307/**\r
308 This command is used to read the public area and Name of an NV Index.\r
309\r
310 @param[in] NvIndex The NV Index.\r
311 @param[out] NvPublic The public area of the index.\r
312 @param[out] NvName The Name of the nvIndex.\r
b3548d32 313\r
c1d93242
JY
314 @retval EFI_SUCCESS Operation completed successfully.\r
315 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
316**/\r
317EFI_STATUS\r
318EFIAPI\r
319Tpm2NvReadPublic (\r
c411b485
MK
320 IN TPMI_RH_NV_INDEX NvIndex,\r
321 OUT TPM2B_NV_PUBLIC *NvPublic,\r
322 OUT TPM2B_NAME *NvName\r
c1d93242
JY
323 );\r
324\r
325/**\r
326 This command defines the attributes of an NV Index and causes the TPM to\r
327 reserve space to hold the data associated with the index.\r
328 If a definition already exists at the index, the TPM will return TPM_RC_NV_DEFINED.\r
329\r
330 @param[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.\r
331 @param[in] AuthSession Auth Session context\r
332 @param[in] Auth The authorization data.\r
333 @param[in] NvPublic The public area of the index.\r
b3548d32 334\r
c1d93242
JY
335 @retval EFI_SUCCESS Operation completed successfully.\r
336 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
337 @retval EFI_ALREADY_STARTED The command was returned successfully, but NvIndex is already defined.\r
338**/\r
339EFI_STATUS\r
340EFIAPI\r
341Tpm2NvDefineSpace (\r
c411b485
MK
342 IN TPMI_RH_PROVISION AuthHandle,\r
343 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL,\r
344 IN TPM2B_AUTH *Auth,\r
345 IN TPM2B_NV_PUBLIC *NvPublic\r
c1d93242
JY
346 );\r
347\r
348/**\r
349 This command removes an index from the TPM.\r
350\r
351 @param[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.\r
352 @param[in] NvIndex The NV Index.\r
353 @param[in] AuthSession Auth Session context\r
b3548d32 354\r
c1d93242
JY
355 @retval EFI_SUCCESS Operation completed successfully.\r
356 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
357 @retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.\r
358**/\r
359EFI_STATUS\r
360EFIAPI\r
361Tpm2NvUndefineSpace (\r
c411b485
MK
362 IN TPMI_RH_PROVISION AuthHandle,\r
363 IN TPMI_RH_NV_INDEX NvIndex,\r
364 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL\r
c1d93242
JY
365 );\r
366\r
367/**\r
368 This command reads a value from an area in NV memory previously defined by TPM2_NV_DefineSpace().\r
369\r
370 @param[in] AuthHandle the handle indicating the source of the authorization value.\r
371 @param[in] NvIndex The index to be read.\r
372 @param[in] AuthSession Auth Session context\r
373 @param[in] Size Number of bytes to read.\r
374 @param[in] Offset Byte offset into the area.\r
375 @param[in,out] OutData The data read.\r
b3548d32 376\r
c1d93242
JY
377 @retval EFI_SUCCESS Operation completed successfully.\r
378 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
379 @retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.\r
380**/\r
381EFI_STATUS\r
382EFIAPI\r
383Tpm2NvRead (\r
c411b485
MK
384 IN TPMI_RH_NV_AUTH AuthHandle,\r
385 IN TPMI_RH_NV_INDEX NvIndex,\r
386 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL,\r
387 IN UINT16 Size,\r
388 IN UINT16 Offset,\r
389 IN OUT TPM2B_MAX_BUFFER *OutData\r
c1d93242
JY
390 );\r
391\r
392/**\r
393 This command writes a value to an area in NV memory that was previously defined by TPM2_NV_DefineSpace().\r
394\r
395 @param[in] AuthHandle the handle indicating the source of the authorization value.\r
396 @param[in] NvIndex The NV Index of the area to write.\r
397 @param[in] AuthSession Auth Session context\r
398 @param[in] InData The data to write.\r
399 @param[in] Offset The offset into the NV Area.\r
b3548d32 400\r
c1d93242
JY
401 @retval EFI_SUCCESS Operation completed successfully.\r
402 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
403 @retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.\r
404**/\r
405EFI_STATUS\r
406EFIAPI\r
407Tpm2NvWrite (\r
c411b485
MK
408 IN TPMI_RH_NV_AUTH AuthHandle,\r
409 IN TPMI_RH_NV_INDEX NvIndex,\r
410 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL,\r
411 IN TPM2B_MAX_BUFFER *InData,\r
412 IN UINT16 Offset\r
c1d93242
JY
413 );\r
414\r
415/**\r
416 This command may be used to prevent further reads of the Index until the next TPM2_Startup (TPM_SU_CLEAR).\r
417\r
418 @param[in] AuthHandle the handle indicating the source of the authorization value.\r
419 @param[in] NvIndex The NV Index of the area to lock.\r
420 @param[in] AuthSession Auth Session context\r
421\r
422 @retval EFI_SUCCESS Operation completed successfully.\r
423 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
424 @retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.\r
425**/\r
426EFI_STATUS\r
427EFIAPI\r
428Tpm2NvReadLock (\r
c411b485
MK
429 IN TPMI_RH_NV_AUTH AuthHandle,\r
430 IN TPMI_RH_NV_INDEX NvIndex,\r
431 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL\r
c1d93242
JY
432 );\r
433\r
434/**\r
435 This command may be used to inhibit further writes of the Index.\r
436\r
437 @param[in] AuthHandle the handle indicating the source of the authorization value.\r
438 @param[in] NvIndex The NV Index of the area to lock.\r
439 @param[in] AuthSession Auth Session context\r
440\r
441 @retval EFI_SUCCESS Operation completed successfully.\r
442 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
443 @retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.\r
444**/\r
445EFI_STATUS\r
446EFIAPI\r
447Tpm2NvWriteLock (\r
c411b485
MK
448 IN TPMI_RH_NV_AUTH AuthHandle,\r
449 IN TPMI_RH_NV_INDEX NvIndex,\r
450 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL\r
c1d93242
JY
451 );\r
452\r
453/**\r
454 The command will SET TPMA_NV_WRITELOCKED for all indexes that have their TPMA_NV_GLOBALLOCK attribute SET.\r
455\r
456 @param[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.\r
457 @param[in] AuthSession Auth Session context\r
458\r
459 @retval EFI_SUCCESS Operation completed successfully.\r
460 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
461 @retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.\r
462**/\r
463EFI_STATUS\r
464EFIAPI\r
465Tpm2NvGlobalWriteLock (\r
c411b485
MK
466 IN TPMI_RH_PROVISION AuthHandle,\r
467 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL\r
c1d93242
JY
468 );\r
469\r
470/**\r
471 This command is used to cause an update to the indicated PCR.\r
472 The digests parameter contains one or more tagged digest value identified by an algorithm ID.\r
473 For each digest, the PCR associated with pcrHandle is Extended into the bank identified by the tag (hashAlg).\r
474\r
475 @param[in] PcrHandle Handle of the PCR\r
476 @param[in] Digests List of tagged digest values to be extended\r
477\r
478 @retval EFI_SUCCESS Operation completed successfully.\r
479 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
480**/\r
481EFI_STATUS\r
482EFIAPI\r
483Tpm2PcrExtend (\r
c411b485
MK
484 IN TPMI_DH_PCR PcrHandle,\r
485 IN TPML_DIGEST_VALUES *Digests\r
c1d93242
JY
486 );\r
487\r
488/**\r
489 This command is used to cause an update to the indicated PCR.\r
490 The data in eventData is hashed using the hash algorithm associated with each bank in which the\r
491 indicated PCR has been allocated. After the data is hashed, the digests list is returned. If the pcrHandle\r
492 references an implemented PCR and not TPM_ALG_NULL, digests list is processed as in\r
493 TPM2_PCR_Extend().\r
494 A TPM shall support an Event.size of zero through 1,024 inclusive.\r
495\r
496 @param[in] PcrHandle Handle of the PCR\r
497 @param[in] EventData Event data in sized buffer\r
498 @param[out] Digests List of digest\r
499\r
500 @retval EFI_SUCCESS Operation completed successfully.\r
501 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
502**/\r
503EFI_STATUS\r
504EFIAPI\r
505Tpm2PcrEvent (\r
8ed85689
RGC
506 IN TPMI_DH_PCR PcrHandle,\r
507 IN TPM2B_EVENT *EventData,\r
508 OUT TPML_DIGEST_VALUES *Digests\r
c1d93242
JY
509 );\r
510\r
511/**\r
512 This command returns the values of all PCR specified in pcrSelect.\r
513\r
514 @param[in] PcrSelectionIn The selection of PCR to read.\r
515 @param[out] PcrUpdateCounter The current value of the PCR update counter.\r
516 @param[out] PcrSelectionOut The PCR in the returned list.\r
517 @param[out] PcrValues The contents of the PCR indicated in pcrSelect.\r
b3548d32 518\r
c1d93242
JY
519 @retval EFI_SUCCESS Operation completed successfully.\r
520 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
521**/\r
522EFI_STATUS\r
523EFIAPI\r
524Tpm2PcrRead (\r
8ed85689
RGC
525 IN TPML_PCR_SELECTION *PcrSelectionIn,\r
526 OUT UINT32 *PcrUpdateCounter,\r
527 OUT TPML_PCR_SELECTION *PcrSelectionOut,\r
528 OUT TPML_DIGEST *PcrValues\r
c1d93242
JY
529 );\r
530\r
531/**\r
532 This command is used to set the desired PCR allocation of PCR and algorithms.\r
533\r
534 @param[in] AuthHandle TPM_RH_PLATFORM+{PP}\r
535 @param[in] AuthSession Auth Session context\r
536 @param[in] PcrAllocation The requested allocation\r
537 @param[out] AllocationSuccess YES if the allocation succeeded\r
538 @param[out] MaxPCR maximum number of PCR that may be in a bank\r
539 @param[out] SizeNeeded number of octets required to satisfy the request\r
540 @param[out] SizeAvailable Number of octets available. Computed before the allocation\r
b3548d32 541\r
c1d93242
JY
542 @retval EFI_SUCCESS Operation completed successfully.\r
543 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
544**/\r
545EFI_STATUS\r
546EFIAPI\r
547Tpm2PcrAllocate (\r
c411b485
MK
548 IN TPMI_RH_PLATFORM AuthHandle,\r
549 IN TPMS_AUTH_COMMAND *AuthSession,\r
550 IN TPML_PCR_SELECTION *PcrAllocation,\r
551 OUT TPMI_YES_NO *AllocationSuccess,\r
552 OUT UINT32 *MaxPCR,\r
553 OUT UINT32 *SizeNeeded,\r
554 OUT UINT32 *SizeAvailable\r
c1d93242
JY
555 );\r
556\r
f9c9a140
JY
557/**\r
558 Alloc PCR data.\r
559\r
560 @param[in] PlatformAuth platform auth value. NULL means no platform auth change.\r
561 @param[in] SupportedPCRBanks Supported PCR banks\r
562 @param[in] PCRBanks PCR banks\r
563\r
564 @retval EFI_SUCCESS Operation completed successfully.\r
565**/\r
566EFI_STATUS\r
567EFIAPI\r
568Tpm2PcrAllocateBanks (\r
c411b485
MK
569 IN TPM2B_AUTH *PlatformAuth OPTIONAL,\r
570 IN UINT32 SupportedPCRBanks,\r
571 IN UINT32 PCRBanks\r
f9c9a140
JY
572 );\r
573\r
c1d93242
JY
574/**\r
575 This command returns various information regarding the TPM and its current state.\r
576\r
b3548d32
LG
577 The capability parameter determines the category of data returned. The property parameter\r
578 selects the first value of the selected category to be returned. If there is no property\r
c1d93242 579 that corresponds to the value of property, the next higher value is returned, if it exists.\r
b3548d32 580 The moreData parameter will have a value of YES if there are more values of the requested\r
c1d93242 581 type that were not returned.\r
b3548d32 582 If no next capability exists, the TPM will return a zero-length list and moreData will have\r
c1d93242
JY
583 a value of NO.\r
584\r
b3548d32
LG
585 NOTE:\r
586 To simplify this function, leave returned CapabilityData for caller to unpack since there are\r
c1d93242 587 many capability categories and only few categories will be used in firmware. It means the caller\r
d6b926e7 588 need swap the byte order for the fields in CapabilityData.\r
c1d93242
JY
589\r
590 @param[in] Capability Group selection; determines the format of the response.\r
b3548d32 591 @param[in] Property Further definition of information.\r
c1d93242
JY
592 @param[in] PropertyCount Number of properties of the indicated type to return.\r
593 @param[out] MoreData Flag to indicate if there are more values of this type.\r
594 @param[out] CapabilityData The capability data.\r
b3548d32 595\r
c1d93242
JY
596 @retval EFI_SUCCESS Operation completed successfully.\r
597 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
598**/\r
599EFI_STATUS\r
600EFIAPI\r
601Tpm2GetCapability (\r
c411b485
MK
602 IN TPM_CAP Capability,\r
603 IN UINT32 Property,\r
604 IN UINT32 PropertyCount,\r
605 OUT TPMI_YES_NO *MoreData,\r
606 OUT TPMS_CAPABILITY_DATA *CapabilityData\r
c1d93242
JY
607 );\r
608\r
609/**\r
610 This command returns the information of TPM Family.\r
611\r
612 This function parse the value got from TPM2_GetCapability and return the Family.\r
613\r
614 @param[out] Family The Family of TPM. (a 4-octet character string)\r
b3548d32 615\r
c1d93242
JY
616 @retval EFI_SUCCESS Operation completed successfully.\r
617 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
618**/\r
619EFI_STATUS\r
620EFIAPI\r
621Tpm2GetCapabilityFamily (\r
c411b485 622 OUT CHAR8 *Family\r
c1d93242
JY
623 );\r
624\r
625/**\r
626 This command returns the information of TPM manufacture ID.\r
627\r
628 This function parse the value got from TPM2_GetCapability and return the TPM manufacture ID.\r
629\r
630 @param[out] ManufactureId The manufacture ID of TPM.\r
b3548d32 631\r
c1d93242
JY
632 @retval EFI_SUCCESS Operation completed successfully.\r
633 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
634**/\r
635EFI_STATUS\r
636EFIAPI\r
637Tpm2GetCapabilityManufactureID (\r
c411b485 638 OUT UINT32 *ManufactureId\r
c1d93242
JY
639 );\r
640\r
641/**\r
642 This command returns the information of TPM FirmwareVersion.\r
643\r
644 This function parse the value got from TPM2_GetCapability and return the TPM FirmwareVersion.\r
645\r
646 @param[out] FirmwareVersion1 The FirmwareVersion1.\r
647 @param[out] FirmwareVersion2 The FirmwareVersion2.\r
b3548d32 648\r
c1d93242
JY
649 @retval EFI_SUCCESS Operation completed successfully.\r
650 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
651**/\r
652EFI_STATUS\r
653EFIAPI\r
654Tpm2GetCapabilityFirmwareVersion (\r
c411b485
MK
655 OUT UINT32 *FirmwareVersion1,\r
656 OUT UINT32 *FirmwareVersion2\r
c1d93242
JY
657 );\r
658\r
659/**\r
660 This command returns the information of the maximum value for commandSize and responseSize in a command.\r
661\r
662 This function parse the value got from TPM2_GetCapability and return the max command size and response size\r
663\r
664 @param[out] MaxCommandSize The maximum value for commandSize in a command.\r
665 @param[out] MaxResponseSize The maximum value for responseSize in a command.\r
b3548d32 666\r
c1d93242
JY
667 @retval EFI_SUCCESS Operation completed successfully.\r
668 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
669**/\r
670EFI_STATUS\r
671EFIAPI\r
672Tpm2GetCapabilityMaxCommandResponseSize (\r
c411b485
MK
673 OUT UINT32 *MaxCommandSize,\r
674 OUT UINT32 *MaxResponseSize\r
c1d93242
JY
675 );\r
676\r
677/**\r
678 This command returns Returns a list of TPMS_ALG_PROPERTIES. Each entry is an\r
b3548d32 679 algorithm ID and a set of properties of the algorithm.\r
c1d93242
JY
680\r
681 This function parse the value got from TPM2_GetCapability and return the list.\r
682\r
683 @param[out] AlgList List of algorithm.\r
b3548d32 684\r
c1d93242
JY
685 @retval EFI_SUCCESS Operation completed successfully.\r
686 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
687**/\r
688EFI_STATUS\r
689EFIAPI\r
690Tpm2GetCapabilitySupportedAlg (\r
c411b485 691 OUT TPML_ALG_PROPERTY *AlgList\r
c1d93242
JY
692 );\r
693\r
694/**\r
695 This command returns the information of TPM LockoutCounter.\r
696\r
697 This function parse the value got from TPM2_GetCapability and return the LockoutCounter.\r
698\r
699 @param[out] LockoutCounter The LockoutCounter of TPM.\r
b3548d32 700\r
c1d93242
JY
701 @retval EFI_SUCCESS Operation completed successfully.\r
702 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
703**/\r
704EFI_STATUS\r
705EFIAPI\r
706Tpm2GetCapabilityLockoutCounter (\r
c411b485 707 OUT UINT32 *LockoutCounter\r
c1d93242
JY
708 );\r
709\r
710/**\r
711 This command returns the information of TPM LockoutInterval.\r
712\r
713 This function parse the value got from TPM2_GetCapability and return the LockoutInterval.\r
714\r
715 @param[out] LockoutInterval The LockoutInterval of TPM.\r
b3548d32 716\r
c1d93242
JY
717 @retval EFI_SUCCESS Operation completed successfully.\r
718 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
719**/\r
720EFI_STATUS\r
721EFIAPI\r
722Tpm2GetCapabilityLockoutInterval (\r
c411b485 723 OUT UINT32 *LockoutInterval\r
c1d93242
JY
724 );\r
725\r
726/**\r
727 This command returns the information of TPM InputBufferSize.\r
728\r
729 This function parse the value got from TPM2_GetCapability and return the InputBufferSize.\r
730\r
731 @param[out] InputBufferSize The InputBufferSize of TPM.\r
732 the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER)\r
b3548d32 733\r
c1d93242
JY
734 @retval EFI_SUCCESS Operation completed successfully.\r
735 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
736**/\r
737EFI_STATUS\r
738EFIAPI\r
739Tpm2GetCapabilityInputBufferSize (\r
c411b485 740 OUT UINT32 *InputBufferSize\r
c1d93242
JY
741 );\r
742\r
743/**\r
744 This command returns the information of TPM PCRs.\r
745\r
746 This function parse the value got from TPM2_GetCapability and return the PcrSelection.\r
747\r
748 @param[out] Pcrs The Pcr Selection\r
b3548d32 749\r
c1d93242
JY
750 @retval EFI_SUCCESS Operation completed successfully.\r
751 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
752**/\r
753EFI_STATUS\r
754EFIAPI\r
755Tpm2GetCapabilityPcrs (\r
c411b485 756 OUT TPML_PCR_SELECTION *Pcrs\r
c1d93242
JY
757 );\r
758\r
07cdba18
JY
759/**\r
760 This function will query the TPM to determine which hashing algorithms\r
761 are supported and which PCR banks are currently active.\r
762\r
763 @param[out] TpmHashAlgorithmBitmap A bitmask containing the algorithms supported by the TPM.\r
764 @param[out] ActivePcrBanks A bitmask containing the PCRs currently allocated.\r
765\r
766 @retval EFI_SUCCESS TPM was successfully queried and return values can be trusted.\r
767 @retval Others An error occurred, likely in communication with the TPM.\r
768\r
769**/\r
770EFI_STATUS\r
771EFIAPI\r
c411b485
MK
772Tpm2GetCapabilitySupportedAndActivePcrs (\r
773 OUT UINT32 *TpmHashAlgorithmBitmap,\r
774 OUT UINT32 *ActivePcrBanks\r
07cdba18
JY
775 );\r
776\r
c1d93242
JY
777/**\r
778 This command returns the information of TPM AlgorithmSet.\r
779\r
780 This function parse the value got from TPM2_GetCapability and return the AlgorithmSet.\r
781\r
782 @param[out] AlgorithmSet The AlgorithmSet of TPM.\r
b3548d32 783\r
c1d93242
JY
784 @retval EFI_SUCCESS Operation completed successfully.\r
785 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
786**/\r
787EFI_STATUS\r
788EFIAPI\r
789Tpm2GetCapabilityAlgorithmSet (\r
c411b485 790 OUT UINT32 *AlgorithmSet\r
c1d93242
JY
791 );\r
792\r
1b0d659e
ZQ
793/**\r
794 This function will query if the command is supported.\r
795\r
796 @param[In] Command TPM_CC command starts from TPM_CC_FIRST.\r
797 @param[out] IsCmdImpl The command is supported or not.\r
798\r
799 @retval EFI_SUCCESS Operation completed successfully.\r
800 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
801**/\r
802EFI_STATUS\r
803EFIAPI\r
804Tpm2GetCapabilityIsCommandImplemented (\r
c411b485
MK
805 IN TPM_CC Command,\r
806 OUT BOOLEAN *IsCmdImpl\r
1b0d659e
ZQ
807 );\r
808\r
c1d93242
JY
809/**\r
810 This command is used to check to see if specific combinations of algorithm parameters are supported.\r
811\r
812 @param[in] Parameters Algorithm parameters to be validated\r
813\r
814 @retval EFI_SUCCESS Operation completed successfully.\r
815 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
816**/\r
817EFI_STATUS\r
818EFIAPI\r
819Tpm2TestParms (\r
c411b485 820 IN TPMT_PUBLIC_PARMS *Parameters\r
c1d93242
JY
821 );\r
822\r
823/**\r
824 This command allows the platform to change the set of algorithms that are used by the TPM.\r
825 The algorithmSet setting is a vendor-dependent value.\r
826\r
827 @param[in] AuthHandle TPM_RH_PLATFORM\r
828 @param[in] AuthSession Auth Session context\r
829 @param[in] AlgorithmSet A TPM vendor-dependent value indicating the\r
830 algorithm set selection\r
831\r
832 @retval EFI_SUCCESS Operation completed successfully.\r
833 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
834**/\r
835EFI_STATUS\r
836EFIAPI\r
837Tpm2SetAlgorithmSet (\r
c411b485
MK
838 IN TPMI_RH_PLATFORM AuthHandle,\r
839 IN TPMS_AUTH_COMMAND *AuthSession,\r
840 IN UINT32 AlgorithmSet\r
c1d93242
JY
841 );\r
842\r
967eacca
JY
843/**\r
844 This command is used to start an authorization session using alternative methods of\r
845 establishing the session key (sessionKey) that is used for authorization and encrypting value.\r
846\r
847 @param[in] TpmKey Handle of a loaded decrypt key used to encrypt salt.\r
848 @param[in] Bind Entity providing the authValue.\r
849 @param[in] NonceCaller Initial nonceCaller, sets nonce size for the session.\r
850 @param[in] Salt Value encrypted according to the type of tpmKey.\r
851 @param[in] SessionType Indicates the type of the session.\r
852 @param[in] Symmetric The algorithm and key size for parameter encryption.\r
853 @param[in] AuthHash Hash algorithm to use for the session.\r
854 @param[out] SessionHandle Handle for the newly created session.\r
855 @param[out] NonceTPM The initial nonce from the TPM, used in the computation of the sessionKey.\r
b3548d32 856\r
967eacca
JY
857 @retval EFI_SUCCESS Operation completed successfully.\r
858 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
859**/\r
860EFI_STATUS\r
861EFIAPI\r
862Tpm2StartAuthSession (\r
c411b485
MK
863 IN TPMI_DH_OBJECT TpmKey,\r
864 IN TPMI_DH_ENTITY Bind,\r
865 IN TPM2B_NONCE *NonceCaller,\r
866 IN TPM2B_ENCRYPTED_SECRET *Salt,\r
867 IN TPM_SE SessionType,\r
868 IN TPMT_SYM_DEF *Symmetric,\r
869 IN TPMI_ALG_HASH AuthHash,\r
870 OUT TPMI_SH_AUTH_SESSION *SessionHandle,\r
871 OUT TPM2B_NONCE *NonceTPM\r
967eacca
JY
872 );\r
873\r
874/**\r
875 This command causes all context associated with a loaded object or session to be removed from TPM memory.\r
876\r
877 @param[in] FlushHandle The handle of the item to flush.\r
b3548d32 878\r
967eacca
JY
879 @retval EFI_SUCCESS Operation completed successfully.\r
880 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
881**/\r
882EFI_STATUS\r
883EFIAPI\r
884Tpm2FlushContext (\r
c411b485 885 IN TPMI_DH_CONTEXT FlushHandle\r
967eacca
JY
886 );\r
887\r
888/**\r
889 This command includes a secret-based authorization to a policy.\r
890 The caller proves knowledge of the secret value using an authorization\r
891 session using the authValue associated with authHandle.\r
b3548d32 892\r
967eacca
JY
893 @param[in] AuthHandle Handle for an entity providing the authorization\r
894 @param[in] PolicySession Handle for the policy session being extended.\r
895 @param[in] AuthSession Auth Session context\r
896 @param[in] NonceTPM The policy nonce for the session.\r
897 @param[in] CpHashA Digest of the command parameters to which this authorization is limited.\r
898 @param[in] PolicyRef A reference to a policy relating to the authorization.\r
899 @param[in] Expiration Time when authorization will expire, measured in seconds from the time that nonceTPM was generated.\r
900 @param[out] Timeout Time value used to indicate to the TPM when the ticket expires.\r
901 @param[out] PolicyTicket A ticket that includes a value indicating when the authorization expires.\r
b3548d32 902\r
967eacca
JY
903 @retval EFI_SUCCESS Operation completed successfully.\r
904 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
905**/\r
906EFI_STATUS\r
907EFIAPI\r
908Tpm2PolicySecret (\r
c411b485
MK
909 IN TPMI_DH_ENTITY AuthHandle,\r
910 IN TPMI_SH_POLICY PolicySession,\r
911 IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL,\r
912 IN TPM2B_NONCE *NonceTPM,\r
913 IN TPM2B_DIGEST *CpHashA,\r
914 IN TPM2B_NONCE *PolicyRef,\r
915 IN INT32 Expiration,\r
916 OUT TPM2B_TIMEOUT *Timeout,\r
917 OUT TPMT_TK_AUTH *PolicyTicket\r
967eacca
JY
918 );\r
919\r
a50e58f4
JY
920/**\r
921 This command allows options in authorizations without requiring that the TPM evaluate all of the options.\r
922 If a policy may be satisfied by different sets of conditions, the TPM need only evaluate one set that\r
923 satisfies the policy. This command will indicate that one of the required sets of conditions has been\r
924 satisfied.\r
925\r
926 @param[in] PolicySession Handle for the policy session being extended.\r
927 @param[in] HashList the list of hashes to check for a match.\r
b3548d32 928\r
a50e58f4
JY
929 @retval EFI_SUCCESS Operation completed successfully.\r
930 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
931**/\r
932EFI_STATUS\r
933EFIAPI\r
934Tpm2PolicyOR (\r
c411b485
MK
935 IN TPMI_SH_POLICY PolicySession,\r
936 IN TPML_DIGEST *HashList\r
a50e58f4
JY
937 );\r
938\r
967eacca
JY
939/**\r
940 This command indicates that the authorization will be limited to a specific command code.\r
941\r
942 @param[in] PolicySession Handle for the policy session being extended.\r
943 @param[in] Code The allowed commandCode.\r
b3548d32 944\r
967eacca
JY
945 @retval EFI_SUCCESS Operation completed successfully.\r
946 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
947**/\r
948EFI_STATUS\r
949EFIAPI\r
950Tpm2PolicyCommandCode (\r
c411b485
MK
951 IN TPMI_SH_POLICY PolicySession,\r
952 IN TPM_CC Code\r
967eacca
JY
953 );\r
954\r
955/**\r
956 This command returns the current policyDigest of the session. This command allows the TPM\r
957 to be used to perform the actions required to precompute the authPolicy for an object.\r
958\r
959 @param[in] PolicySession Handle for the policy session.\r
960 @param[out] PolicyHash the current value of the policyHash of policySession.\r
b3548d32 961\r
967eacca
JY
962 @retval EFI_SUCCESS Operation completed successfully.\r
963 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
964**/\r
965EFI_STATUS\r
966EFIAPI\r
967Tpm2PolicyGetDigest (\r
c411b485
MK
968 IN TPMI_SH_POLICY PolicySession,\r
969 OUT TPM2B_DIGEST *PolicyHash\r
967eacca
JY
970 );\r
971\r
087132a8
JY
972/**\r
973 This command allows access to the public area of a loaded object.\r
974\r
975 @param[in] ObjectHandle TPM handle of an object\r
976 @param[out] OutPublic Structure containing the public area of an object\r
977 @param[out] Name Name of the object\r
978 @param[out] QualifiedName The Qualified Name of the object\r
979\r
980 @retval EFI_SUCCESS Operation completed successfully.\r
981 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
982**/\r
983EFI_STATUS\r
984EFIAPI\r
985Tpm2ReadPublic (\r
c411b485
MK
986 IN TPMI_DH_OBJECT ObjectHandle,\r
987 OUT TPM2B_PUBLIC *OutPublic,\r
988 OUT TPM2B_NAME *Name,\r
989 OUT TPM2B_NAME *QualifiedName\r
087132a8
JY
990 );\r
991\r
c1d93242
JY
992//\r
993// Help function\r
994//\r
995\r
996/**\r
997 Copy AuthSessionIn to TPM2 command buffer.\r
998\r
999 @param [in] AuthSessionIn Input AuthSession data\r
1000 @param [out] AuthSessionOut Output AuthSession data in TPM2 command buffer\r
1001\r
1002 @return AuthSession size\r
1003**/\r
1004UINT32\r
1005EFIAPI\r
1006CopyAuthSessionCommand (\r
c411b485
MK
1007 IN TPMS_AUTH_COMMAND *AuthSessionIn OPTIONAL,\r
1008 OUT UINT8 *AuthSessionOut\r
c1d93242
JY
1009 );\r
1010\r
1011/**\r
1012 Copy AuthSessionIn from TPM2 response buffer.\r
1013\r
1014 @param [in] AuthSessionIn Input AuthSession data in TPM2 response buffer\r
1015 @param [out] AuthSessionOut Output AuthSession data\r
1016\r
1017 @return AuthSession size\r
1018**/\r
1019UINT32\r
1020EFIAPI\r
1021CopyAuthSessionResponse (\r
c411b485
MK
1022 IN UINT8 *AuthSessionIn,\r
1023 OUT TPMS_AUTH_RESPONSE *AuthSessionOut OPTIONAL\r
c1d93242
JY
1024 );\r
1025\r
1026/**\r
1027 Return size of digest.\r
1028\r
1029 @param[in] HashAlgo Hash algorithm\r
1030\r
1031 @return size of digest\r
1032**/\r
1033UINT16\r
1034EFIAPI\r
1035GetHashSizeFromAlgo (\r
c411b485 1036 IN TPMI_ALG_HASH HashAlgo\r
c1d93242
JY
1037 );\r
1038\r
b8ae1f4d
SZ
1039/**\r
1040 Get hash mask from algorithm.\r
1041\r
1042 @param[in] HashAlgo Hash algorithm\r
1043\r
1044 @return Hash mask\r
1045**/\r
1046UINT32\r
1047EFIAPI\r
1048GetHashMaskFromAlgo (\r
c411b485 1049 IN TPMI_ALG_HASH HashAlgo\r
b8ae1f4d
SZ
1050 );\r
1051\r
697c30b1
SZ
1052/**\r
1053 Return if hash alg is supported in HashAlgorithmMask.\r
1054\r
1055 @param HashAlg Hash algorithm to be checked.\r
1056 @param HashAlgorithmMask Bitfield of allowed hash algorithms.\r
1057\r
1058 @retval TRUE Hash algorithm is supported.\r
1059 @retval FALSE Hash algorithm is not supported.\r
1060**/\r
1061BOOLEAN\r
1062EFIAPI\r
c411b485 1063IsHashAlgSupportedInHashAlgorithmMask (\r
697c30b1
SZ
1064 IN TPMI_ALG_HASH HashAlg,\r
1065 IN UINT32 HashAlgorithmMask\r
1066 );\r
1067\r
f5e34e37
JY
1068/**\r
1069 Copy TPML_DIGEST_VALUES into a buffer\r
1070\r
ae1a4284 1071 @param[in,out] Buffer Buffer to hold copied TPML_DIGEST_VALUES compact binary.\r
f5e34e37
JY
1072 @param[in] DigestList TPML_DIGEST_VALUES to be copied.\r
1073 @param[in] HashAlgorithmMask HASH bits corresponding to the desired digests to copy.\r
1074\r
1075 @return The end of buffer to hold TPML_DIGEST_VALUES.\r
1076**/\r
1077VOID *\r
1078EFIAPI\r
c411b485
MK
1079CopyDigestListToBuffer (\r
1080 IN OUT VOID *Buffer,\r
1081 IN TPML_DIGEST_VALUES *DigestList,\r
1082 IN UINT32 HashAlgorithmMask\r
f5e34e37
JY
1083 );\r
1084\r
77e55cf4
JY
1085/**\r
1086 Get TPML_DIGEST_VALUES data size.\r
1087\r
1088 @param[in] DigestList TPML_DIGEST_VALUES data.\r
1089\r
1090 @return TPML_DIGEST_VALUES data size.\r
1091**/\r
1092UINT32\r
1093EFIAPI\r
c411b485
MK
1094GetDigestListSize (\r
1095 IN TPML_DIGEST_VALUES *DigestList\r
77e55cf4
JY
1096 );\r
1097\r
d4b9b2c3
JY
1098/**\r
1099 This function get digest from digest list.\r
1100\r
f28ab849
SZ
1101 @param[in] HashAlg Digest algorithm\r
1102 @param[in] DigestList Digest list\r
1103 @param[out] Digest Digest\r
d4b9b2c3 1104\r
f28ab849
SZ
1105 @retval EFI_SUCCESS Digest is found and returned.\r
1106 @retval EFI_NOT_FOUND Digest is not found.\r
d4b9b2c3
JY
1107**/\r
1108EFI_STATUS\r
1109EFIAPI\r
c411b485
MK
1110GetDigestFromDigestList (\r
1111 IN TPMI_ALG_HASH HashAlg,\r
1112 IN TPML_DIGEST_VALUES *DigestList,\r
1113 OUT VOID *Digest\r
d4b9b2c3
JY
1114 );\r
1115\r
8ed85689
RGC
1116/**\r
1117 This function will query the TPM to determine which hashing algorithms and\r
1118 get the digests of all active and supported PCR banks of a specific PCR register.\r
1119\r
1120 @param[in] PcrHandle The index of the PCR register to be read.\r
1121 @param[out] HashList List of digests from PCR register being read.\r
1122\r
1123 @retval EFI_SUCCESS The Pcr was read successfully.\r
1124 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
1125**/\r
1126EFI_STATUS\r
1127EFIAPI\r
1128Tpm2PcrReadForActiveBank (\r
1129 IN TPMI_DH_PCR PcrHandle,\r
1130 OUT TPML_DIGEST *HashList\r
1131 );\r
1132\r
c1d93242 1133#endif\r