20 TPMI_DH_PCR PcrHandle;
21 UINT32 AuthorizationSize;
34 TPMI_DH_PCR PcrHandle;
35 UINT32 AuthorizationSize;
54 UINT32 PcrUpdateCounter;
61 TPMI_RH_PLATFORM AuthHandle;
62 UINT32 AuthSessionSize;
69 UINT32 AuthSessionSize;
70 TPMI_YES_NO AllocationSuccess;
93 IN TPMI_DH_PCR PcrHandle,
102 UINT32 ResultBufSize;
105 UINT32 SessionInfoSize;
109 Cmd.Header.commandCode =
SwapBytes32 (TPM_CC_PCR_Extend);
115 Buffer = (UINT8 *)&Cmd.AuthSessionPcr;
119 Buffer += SessionInfoSize;
120 Cmd.AuthorizationSize =
SwapBytes32 (SessionInfoSize);
124 Buffer +=
sizeof (UINT32);
127 for (Index = 0; Index < Digests->count; Index++) {
129 Buffer +=
sizeof (UINT16);
131 if (DigestSize == 0) {
132 DEBUG ((DEBUG_ERROR,
"Unknown hash algorithm %d\r\n", Digests->digests[Index].hashAlg));
133 return EFI_DEVICE_ERROR;
138 &Digests->digests[Index].digest,
146 "Tpm2PcrExtend - Hash = 0x%04x, Pcr[%02d], digest = ",
147 Digests->digests[Index].hashAlg,
151 for (Index2 = 0; Index2 < DigestSize; Index2++) {
152 DEBUG ((DEBUG_VERBOSE,
"%02x ", Buffer[Index2]));
155 DEBUG ((DEBUG_VERBOSE,
"\n"));
158 Buffer += DigestSize;
161 CmdSize = (UINT32)((
UINTN)Buffer - (
UINTN)&Cmd);
164 ResultBufSize =
sizeof (Res);
165 Status =
Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
166 if (EFI_ERROR (Status)) {
170 if (ResultBufSize >
sizeof (Res)) {
171 DEBUG ((DEBUG_ERROR,
"Tpm2PcrExtend: Failed ExecuteCommand: Buffer Too Small\r\n"));
172 return EFI_BUFFER_TOO_SMALL;
179 if (RespSize >
sizeof (Res)) {
180 DEBUG ((DEBUG_ERROR,
"Tpm2PcrExtend: Response size too large! %d\r\n", RespSize));
181 return EFI_BUFFER_TOO_SMALL;
187 if (
SwapBytes32 (Res.Header.responseCode) != TPM_RC_SUCCESS) {
188 DEBUG ((DEBUG_ERROR,
"Tpm2PcrExtend: Response Code error! 0x%08x\r\n",
SwapBytes32 (Res.Header.responseCode)));
189 return EFI_DEVICE_ERROR;
193 DEBUG ((DEBUG_VERBOSE,
"Tpm2PcrExtend: PCR read after extend...\n"));
224 IN TPMI_DH_PCR PcrHandle,
234 UINT32 ResultBufSize;
237 UINT32 SessionInfoSize;
241 Cmd.Header.commandCode =
SwapBytes32 (TPM_CC_PCR_Event);
247 Buffer = (UINT8 *)&Cmd.AuthSessionPcr;
251 Buffer += SessionInfoSize;
252 Cmd.AuthorizationSize =
SwapBytes32 (SessionInfoSize);
256 Buffer +=
sizeof (UINT16);
258 CopyMem (Buffer, EventData->buffer, EventData->size);
259 Buffer += EventData->size;
261 CmdSize = (UINT32)((
UINTN)Buffer - (
UINTN)&Cmd);
264 ResultBufSize =
sizeof (Res);
265 Status =
Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
266 if (EFI_ERROR (Status)) {
270 if (ResultBufSize >
sizeof (Res)) {
271 DEBUG ((DEBUG_ERROR,
"Tpm2PcrEvent: Failed ExecuteCommand: Buffer Too Small\r\n"));
272 return EFI_BUFFER_TOO_SMALL;
279 if (RespSize >
sizeof (Res)) {
280 DEBUG ((DEBUG_ERROR,
"Tpm2PcrEvent: Response size too large! %d\r\n", RespSize));
281 return EFI_BUFFER_TOO_SMALL;
287 if (
SwapBytes32 (Res.Header.responseCode) != TPM_RC_SUCCESS) {
288 DEBUG ((DEBUG_ERROR,
"Tpm2PcrEvent: Response Code error! 0x%08x\r\n",
SwapBytes32 (Res.Header.responseCode)));
289 return EFI_DEVICE_ERROR;
295 Buffer = (UINT8 *)&Res.Digests;
298 if (Digests->count > HASH_COUNT) {
299 DEBUG ((DEBUG_ERROR,
"Tpm2PcrEvent - Digests->count error %x\n", Digests->count));
300 return EFI_DEVICE_ERROR;
303 Buffer +=
sizeof (UINT32);
304 for (Index = 0; Index < Digests->count; Index++) {
306 Buffer +=
sizeof (UINT16);
308 if (DigestSize == 0) {
309 DEBUG ((DEBUG_ERROR,
"Unknown hash algorithm %d\r\n", Digests->digests[Index].hashAlg));
310 return EFI_DEVICE_ERROR;
314 &Digests->digests[Index].digest,
318 Buffer += DigestSize;
339 OUT UINT32 *PcrUpdateCounter,
347 UINT32 SendBufferSize;
348 UINT32 RecvBufferSize;
356 SendBuffer.Header.tag =
SwapBytes16 (TPM_ST_NO_SESSIONS);
357 SendBuffer.Header.commandCode =
SwapBytes32 (TPM_CC_PCR_Read);
359 SendBuffer.PcrSelectionIn.count =
SwapBytes32 (PcrSelectionIn->count);
360 for (Index = 0; Index < PcrSelectionIn->count; Index++) {
361 SendBuffer.PcrSelectionIn.pcrSelections[Index].hash =
SwapBytes16 (PcrSelectionIn->pcrSelections[Index].hash);
362 SendBuffer.PcrSelectionIn.pcrSelections[Index].sizeofSelect = PcrSelectionIn->pcrSelections[Index].sizeofSelect;
363 CopyMem (&SendBuffer.PcrSelectionIn.pcrSelections[Index].pcrSelect, &PcrSelectionIn->pcrSelections[Index].pcrSelect, SendBuffer.PcrSelectionIn.pcrSelections[Index].sizeofSelect);
366 SendBufferSize =
sizeof (SendBuffer.Header) +
sizeof (SendBuffer.PcrSelectionIn.count) +
sizeof (SendBuffer.PcrSelectionIn.pcrSelections[0]) * PcrSelectionIn->count;
367 SendBuffer.Header.paramSize =
SwapBytes32 (SendBufferSize);
372 RecvBufferSize =
sizeof (RecvBuffer);
373 Status =
Tpm2SubmitCommand (SendBufferSize, (UINT8 *)&SendBuffer, &RecvBufferSize, (UINT8 *)&RecvBuffer);
374 if (EFI_ERROR (Status)) {
379 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - RecvBufferSize Error - %x\n", RecvBufferSize));
380 return EFI_DEVICE_ERROR;
383 if (
SwapBytes32 (RecvBuffer.Header.responseCode) != TPM_RC_SUCCESS) {
384 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - responseCode - %x\n",
SwapBytes32 (RecvBuffer.Header.responseCode)));
385 return EFI_NOT_FOUND;
396 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - RecvBufferSize Error - %x\n", RecvBufferSize));
397 return EFI_DEVICE_ERROR;
400 *PcrUpdateCounter =
SwapBytes32 (RecvBuffer.PcrUpdateCounter);
405 if (RecvBufferSize <
sizeof (
TPM2_RESPONSE_HEADER) +
sizeof (RecvBuffer.PcrUpdateCounter) + sizeof (RecvBuffer.PcrSelectionOut.count)) {
406 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - RecvBufferSize Error - %x\n", RecvBufferSize));
407 return EFI_DEVICE_ERROR;
410 PcrSelectionOut->count =
SwapBytes32 (RecvBuffer.PcrSelectionOut.count);
411 if (PcrSelectionOut->count > HASH_COUNT) {
412 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - PcrSelectionOut->count error %x\n", PcrSelectionOut->count));
413 return EFI_DEVICE_ERROR;
416 if (RecvBufferSize <
sizeof (
TPM2_RESPONSE_HEADER) +
sizeof (RecvBuffer.PcrUpdateCounter) + sizeof (RecvBuffer.PcrSelectionOut.count) + sizeof (RecvBuffer.PcrSelectionOut.pcrSelections[0]) * PcrSelectionOut->count) {
417 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - RecvBufferSize Error - %x\n", RecvBufferSize));
418 return EFI_DEVICE_ERROR;
421 for (Index = 0; Index < PcrSelectionOut->count; Index++) {
422 PcrSelectionOut->pcrSelections[Index].hash =
SwapBytes16 (RecvBuffer.PcrSelectionOut.pcrSelections[Index].hash);
423 PcrSelectionOut->pcrSelections[Index].sizeofSelect = RecvBuffer.PcrSelectionOut.pcrSelections[Index].sizeofSelect;
424 if (PcrSelectionOut->pcrSelections[Index].sizeofSelect > PCR_SELECT_MAX) {
425 return EFI_DEVICE_ERROR;
428 CopyMem (&PcrSelectionOut->pcrSelections[Index].pcrSelect, &RecvBuffer.PcrSelectionOut.pcrSelections[Index].pcrSelect, PcrSelectionOut->pcrSelections[Index].sizeofSelect);
434 PcrValuesOut = (
TPML_DIGEST *)((UINT8 *)&RecvBuffer +
sizeof (
TPM2_RESPONSE_HEADER) +
sizeof (RecvBuffer.PcrUpdateCounter) +
sizeof (RecvBuffer.PcrSelectionOut.count) +
sizeof (RecvBuffer.PcrSelectionOut.pcrSelections[0]) * PcrSelectionOut->count);
435 PcrValues->count =
SwapBytes32 (PcrValuesOut->count);
439 if (PcrValues->count > 8) {
440 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - PcrValues->count error %x\n", PcrValues->count));
441 return EFI_DEVICE_ERROR;
444 Digests = PcrValuesOut->digests;
445 for (Index = 0; Index < PcrValues->count; Index++) {
446 PcrValues->digests[Index].size =
SwapBytes16 (Digests->size);
447 if (PcrValues->digests[Index].size > sizeof (
TPMU_HA)) {
448 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead - Digest.size error %x\n", PcrValues->digests[Index].size));
449 return EFI_DEVICE_ERROR;
452 CopyMem (&PcrValues->digests[Index].buffer, &Digests->buffer, PcrValues->digests[Index].size);
453 Digests = (
TPM2B_DIGEST *)((UINT8 *)Digests +
sizeof (Digests->size) + PcrValues->digests[Index].size);
476 IN TPMI_RH_PLATFORM AuthHandle,
479 OUT TPMI_YES_NO *AllocationSuccess,
481 OUT UINT32 *SizeNeeded,
482 OUT UINT32 *SizeAvailable
491 UINT32 SessionInfoSize;
493 UINT32 ResultBufSize;
501 Cmd.Header.commandCode =
SwapBytes32 (TPM_CC_PCR_Allocate);
507 Buffer = (UINT8 *)&Cmd.AuthSession;
511 Buffer += SessionInfoSize;
512 Cmd.AuthSessionSize =
SwapBytes32 (SessionInfoSize);
516 Buffer +=
sizeof (UINT32);
517 for (Index = 0; Index < PcrAllocation->count; Index++) {
519 Buffer +=
sizeof (UINT16);
520 *(UINT8 *)Buffer = PcrAllocation->pcrSelections[Index].sizeofSelect;
522 CopyMem (Buffer, PcrAllocation->pcrSelections[Index].pcrSelect, PcrAllocation->pcrSelections[Index].sizeofSelect);
523 Buffer += PcrAllocation->pcrSelections[Index].sizeofSelect;
526 CmdSize = (UINT32)(Buffer - (UINT8 *)&Cmd);
529 ResultBuf = (UINT8 *)&Res;
530 ResultBufSize =
sizeof (Res);
541 if (EFI_ERROR (Status)) {
545 if (ResultBufSize >
sizeof (Res)) {
546 DEBUG ((DEBUG_ERROR,
"Tpm2PcrAllocate: Failed ExecuteCommand: Buffer Too Small\r\n"));
547 Status = EFI_BUFFER_TOO_SMALL;
555 if (RespSize >
sizeof (Res)) {
556 DEBUG ((DEBUG_ERROR,
"Tpm2PcrAllocate: Response size too large! %d\r\n", RespSize));
557 Status = EFI_BUFFER_TOO_SMALL;
564 if (
SwapBytes32 (Res.Header.responseCode) != TPM_RC_SUCCESS) {
565 DEBUG ((DEBUG_ERROR,
"Tpm2PcrAllocate: Response Code error! 0x%08x\r\n",
SwapBytes32 (Res.Header.responseCode)));
566 Status = EFI_DEVICE_ERROR;
573 *AllocationSuccess = Res.AllocationSuccess;
600 IN UINT32 SupportedPCRBanks,
608 TPMI_YES_NO AllocationSuccess;
611 UINT32 SizeAvailable;
613 if (PlatformAuth ==
NULL) {
616 AuthSession = &LocalAuthSession;
617 ZeroMem (&LocalAuthSession,
sizeof (LocalAuthSession));
618 LocalAuthSession.sessionHandle = TPM_RS_PW;
619 LocalAuthSession.hmac.size = PlatformAuth->size;
620 CopyMem (LocalAuthSession.hmac.buffer, PlatformAuth->buffer, PlatformAuth->size);
626 ZeroMem (&PcrAllocation,
sizeof (PcrAllocation));
627 if ((HASH_ALG_SHA1 & SupportedPCRBanks) != 0) {
628 PcrAllocation.pcrSelections[PcrAllocation.count].hash = TPM_ALG_SHA1;
629 PcrAllocation.pcrSelections[PcrAllocation.count].sizeofSelect = PCR_SELECT_MAX;
630 if ((HASH_ALG_SHA1 & PCRBanks) != 0) {
631 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0xFF;
632 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0xFF;
633 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0xFF;
635 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0x00;
636 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0x00;
637 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0x00;
640 PcrAllocation.count++;
643 if ((HASH_ALG_SHA256 & SupportedPCRBanks) != 0) {
644 PcrAllocation.pcrSelections[PcrAllocation.count].hash = TPM_ALG_SHA256;
645 PcrAllocation.pcrSelections[PcrAllocation.count].sizeofSelect = PCR_SELECT_MAX;
646 if ((HASH_ALG_SHA256 & PCRBanks) != 0) {
647 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0xFF;
648 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0xFF;
649 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0xFF;
651 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0x00;
652 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0x00;
653 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0x00;
656 PcrAllocation.count++;
659 if ((HASH_ALG_SHA384 & SupportedPCRBanks) != 0) {
660 PcrAllocation.pcrSelections[PcrAllocation.count].hash = TPM_ALG_SHA384;
661 PcrAllocation.pcrSelections[PcrAllocation.count].sizeofSelect = PCR_SELECT_MAX;
662 if ((HASH_ALG_SHA384 & PCRBanks) != 0) {
663 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0xFF;
664 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0xFF;
665 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0xFF;
667 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0x00;
668 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0x00;
669 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0x00;
672 PcrAllocation.count++;
675 if ((HASH_ALG_SHA512 & SupportedPCRBanks) != 0) {
676 PcrAllocation.pcrSelections[PcrAllocation.count].hash = TPM_ALG_SHA512;
677 PcrAllocation.pcrSelections[PcrAllocation.count].sizeofSelect = PCR_SELECT_MAX;
678 if ((HASH_ALG_SHA512 & PCRBanks) != 0) {
679 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0xFF;
680 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0xFF;
681 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0xFF;
683 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0x00;
684 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0x00;
685 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0x00;
688 PcrAllocation.count++;
691 if ((HASH_ALG_SM3_256 & SupportedPCRBanks) != 0) {
692 PcrAllocation.pcrSelections[PcrAllocation.count].hash = TPM_ALG_SM3_256;
693 PcrAllocation.pcrSelections[PcrAllocation.count].sizeofSelect = PCR_SELECT_MAX;
694 if ((HASH_ALG_SM3_256 & PCRBanks) != 0) {
695 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0xFF;
696 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0xFF;
697 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0xFF;
699 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[0] = 0x00;
700 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[1] = 0x00;
701 PcrAllocation.pcrSelections[PcrAllocation.count].pcrSelect[2] = 0x00;
704 PcrAllocation.count++;
716 DEBUG ((DEBUG_INFO,
"Tpm2PcrAllocateBanks call Tpm2PcrAllocate - %r\n", Status));
717 if (EFI_ERROR (Status)) {
721 DEBUG ((DEBUG_INFO,
"AllocationSuccess - %02x\n", AllocationSuccess));
722 DEBUG ((DEBUG_INFO,
"MaxPCR - %08x\n", MaxPCR));
723 DEBUG ((DEBUG_INFO,
"SizeNeeded - %08x\n", SizeNeeded));
724 DEBUG ((DEBUG_INFO,
"SizeAvailable - %08x\n", SizeAvailable));
727 ZeroMem (&LocalAuthSession.hmac, sizeof (LocalAuthSession.hmac));
744 IN TPMI_DH_PCR PcrHandle,
753 UINT32 PcrUpdateCounter;
755 UINT32 TpmHashAlgorithmBitmap;
756 TPMI_ALG_HASH CurrentPcrBankHash;
757 UINT32 ActivePcrBanks;
758 UINT32 TcgRegistryHashAlg;
762 PcrIndex = (UINT8)PcrHandle;
764 if ((PcrIndex < 0) ||
765 (PcrIndex >= IMPLEMENTATION_PCR))
767 return EFI_INVALID_PARAMETER;
770 ZeroMem (&PcrSelectionIn,
sizeof (PcrSelectionIn));
771 ZeroMem (&PcrUpdateCounter,
sizeof (UINT32));
772 ZeroMem (&PcrSelectionOut,
sizeof (PcrSelectionOut));
773 ZeroMem (&PcrValues,
sizeof (PcrValues));
776 DEBUG ((DEBUG_INFO,
"ReadPcr - %02d\n", PcrIndex));
783 if (EFI_ERROR (Status)) {
784 DEBUG ((DEBUG_ERROR,
"ReadPcr: Unable to read TPM capabilities\n"));
785 return EFI_DEVICE_ERROR;
792 &TpmHashAlgorithmBitmap,
796 if (EFI_ERROR (Status)) {
797 DEBUG ((DEBUG_ERROR,
"ReadPcr: Unable to read TPM capabilities and active PCRs\n"));
798 return EFI_DEVICE_ERROR;
804 for (Index = 0; Index < Pcrs.count; Index++) {
805 CurrentPcrBankHash = Pcrs.pcrSelections[Index].hash;
807 switch (CurrentPcrBankHash) {
809 DEBUG ((DEBUG_VERBOSE,
"HASH_ALG_SHA1 Present\n"));
810 TcgRegistryHashAlg = HASH_ALG_SHA1;
813 DEBUG ((DEBUG_VERBOSE,
"HASH_ALG_SHA256 Present\n"));
814 TcgRegistryHashAlg = HASH_ALG_SHA256;
817 DEBUG ((DEBUG_VERBOSE,
"HASH_ALG_SHA384 Present\n"));
818 TcgRegistryHashAlg = HASH_ALG_SHA384;
821 DEBUG ((DEBUG_VERBOSE,
"HASH_ALG_SHA512 Present\n"));
822 TcgRegistryHashAlg = HASH_ALG_SHA512;
824 case TPM_ALG_SM3_256:
825 DEBUG ((DEBUG_VERBOSE,
"HASH_ALG_SM3 Present\n"));
826 TcgRegistryHashAlg = HASH_ALG_SM3_256;
832 DEBUG ((DEBUG_VERBOSE,
"Unknown algorithm present\n"));
833 TcgRegistryHashAlg = 0;
840 if ((TcgRegistryHashAlg & ActivePcrBanks) == 0) {
841 DEBUG ((DEBUG_VERBOSE,
"Skipping unsupported or inactive bank: 0x%04x\n", CurrentPcrBankHash));
848 PcrSelectionIn.pcrSelections[PcrSelectionIn.count].hash = Pcrs.pcrSelections[Index].hash;
849 PcrSelectionIn.pcrSelections[PcrSelectionIn.count].sizeofSelect = PCR_SELECT_MAX;
850 PcrSelectionIn.pcrSelections[PcrSelectionIn.count].pcrSelect[0] = (PcrIndex < 8) ? 1 << PcrIndex : 0;
851 PcrSelectionIn.pcrSelections[PcrSelectionIn.count].pcrSelect[1] = (PcrIndex > 7) && (PcrIndex < 16) ? 1 << (PcrIndex - 8) : 0;
852 PcrSelectionIn.pcrSelections[PcrSelectionIn.count].pcrSelect[2] = (PcrIndex > 15) ? 1 << (PcrIndex - 16) : 0;
853 PcrSelectionIn.count++;
866 if (EFI_ERROR (Status)) {
867 DEBUG ((DEBUG_ERROR,
"Tpm2PcrRead failed Status = %r \n", Status));
868 return EFI_DEVICE_ERROR;
871 for (Index = 0; Index < PcrValues.count; Index++) {
874 "ReadPcr - HashAlg = 0x%04x, Pcr[%02d], digest = ",
875 PcrSelectionOut.pcrSelections[Index].hash,
879 for (Index2 = 0; Index2 < PcrValues.digests[Index].size; Index2++) {
880 DEBUG ((DEBUG_INFO,
"%02x ", PcrValues.digests[Index].buffer[Index2]));
883 DEBUG ((DEBUG_INFO,
"\n"));
886 if (HashList !=
NULL) {
UINT16 EFIAPI SwapBytes16(IN UINT16 Value)
UINT16 EFIAPI ReadUnaligned16(IN CONST UINT16 *Buffer)
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
UINT32 EFIAPI WriteUnaligned32(OUT UINT32 *Buffer, IN UINT32 Value)
UINT16 EFIAPI WriteUnaligned16(OUT UINT16 *Buffer, IN UINT16 Value)
UINT32 EFIAPI ReadUnaligned32(IN CONST UINT32 *Buffer)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define DEBUG_CODE_BEGIN()
#define DEBUG(Expression)
UINT16 GetHashSizeFromAlgo(IN TPMI_ALG_HASH HashAlgo)
EFI_STATUS EFIAPI Tpm2GetCapabilitySupportedAndActivePcrs(OUT UINT32 *TpmHashAlgorithmBitmap, OUT UINT32 *ActivePcrBanks)
UINT32 EFIAPI CopyAuthSessionCommand(IN TPMS_AUTH_COMMAND *AuthSessionIn OPTIONAL, OUT UINT8 *AuthSessionOut)
EFI_STATUS EFIAPI Tpm2GetCapabilityPcrs(OUT TPML_PCR_SELECTION *Pcrs)
EFI_STATUS EFIAPI Tpm2SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
EFI_STATUS EFIAPI Tpm2PcrEvent(IN TPMI_DH_PCR PcrHandle, IN TPM2B_EVENT *EventData, OUT TPML_DIGEST_VALUES *Digests)
EFI_STATUS EFIAPI Tpm2PcrAllocate(IN TPMI_RH_PLATFORM AuthHandle, IN TPMS_AUTH_COMMAND *AuthSession, IN TPML_PCR_SELECTION *PcrAllocation, OUT TPMI_YES_NO *AllocationSuccess, OUT UINT32 *MaxPCR, OUT UINT32 *SizeNeeded, OUT UINT32 *SizeAvailable)
EFI_STATUS EFIAPI Tpm2PcrAllocateBanks(IN TPM2B_AUTH *PlatformAuth OPTIONAL, IN UINT32 SupportedPCRBanks, IN UINT32 PCRBanks)
EFI_STATUS EFIAPI Tpm2PcrRead(IN TPML_PCR_SELECTION *PcrSelectionIn, OUT UINT32 *PcrUpdateCounter, OUT TPML_PCR_SELECTION *PcrSelectionOut, OUT TPML_DIGEST *PcrValues)
EFI_STATUS EFIAPI Tpm2PcrExtend(IN TPMI_DH_PCR PcrHandle, IN TPML_DIGEST_VALUES *Digests)
EFI_STATUS EFIAPI Tpm2PcrReadForActiveBank(IN TPMI_DH_PCR PcrHandle, OUT TPML_DIGEST *HashList)