#include <Library/BaseLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/ReportStatusCodeLib.h>\r
-\r
-#include "TpmComm.h"\r
+#include <Library/Tpm12DeviceLib.h>\r
+#include <Library/Tpm12CommandLib.h>\r
+#include <Library/BaseCryptLib.h>\r
\r
BOOLEAN mImageInMemory = FALSE;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+Single function calculates SHA1 digest value for all raw data. It\r
+combines Sha1Init(), Sha1Update() and Sha1Final().\r
+\r
+@param[in] Data Raw data to be digested.\r
+@param[in] DataLen Size of the raw data.\r
+@param[out] Digest Pointer to a buffer that stores the final digest.\r
+\r
+@retval EFI_SUCCESS Always successfully calculate the final digest.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TpmCommHashAll (\r
+ IN CONST UINT8 *Data,\r
+ IN UINTN DataLen,\r
+ OUT TPM_DIGEST *Digest\r
+ )\r
+{\r
+ VOID *Sha1Ctx;\r
+ UINTN CtxSize;\r
+\r
+ CtxSize = Sha1GetContextSize ();\r
+ Sha1Ctx = AllocatePool (CtxSize);\r
+ ASSERT (Sha1Ctx != NULL);\r
+\r
+ Sha1Init (Sha1Ctx);\r
+ Sha1Update (Sha1Ctx, Data, DataLen);\r
+ Sha1Final (Sha1Ctx, (UINT8 *)Digest);\r
+\r
+ FreePool (Sha1Ctx);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
/**\r
Do a hash operation on a data buffer, extend a specific TPM PCR with the hash result,\r
and build a GUIDed HOB recording the event which will be passed to the DXE phase and\r
}\r
}\r
\r
- Status = TpmCommExtend (\r
- PeiServices,\r
+ Status = Tpm12Extend (\r
&NewEventHdr->Digest,\r
NewEventHdr->PCRIndex,\r
NULL\r
)\r
{\r
EFI_STATUS Status;\r
+ TPM_PERMANENT_FLAGS TpmPermanentFlags;\r
PEI_LOCK_PHYSICAL_PRESENCE_PPI *LockPhysicalPresencePpi;\r
- BOOLEAN LifetimeLock;\r
- BOOLEAN CmdEnable;\r
TPM_PHYSICAL_PRESENCE PhysicalPresenceValue;\r
\r
- Status = TpmCommGetCapability (PeiServices, NULL, &LifetimeLock, &CmdEnable);\r
+ Status = Tpm12GetCapabilityFlagPermanent (&TpmPermanentFlags);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
//\r
// 1. Set physicalPresenceLifetimeLock, physicalPresenceHWEnable and physicalPresenceCMDEnable bit by PCDs.\r
//\r
- if (PcdGetBool (PcdPhysicalPresenceLifetimeLock) && !LifetimeLock) {\r
+ if (PcdGetBool (PcdPhysicalPresenceLifetimeLock) && !TpmPermanentFlags.physicalPresenceLifetimeLock) {\r
//\r
// Lock TPM LifetimeLock is required, and LifetimeLock is not locked yet. \r
//\r
\r
if (PcdGetBool (PcdPhysicalPresenceCmdEnable)) {\r
PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_ENABLE;\r
- CmdEnable = TRUE;\r
+ TpmPermanentFlags.physicalPresenceCMDEnable = TRUE;\r
} else {\r
PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_DISABLE;\r
- CmdEnable = FALSE;\r
+ TpmPermanentFlags.physicalPresenceCMDEnable = FALSE;\r
}\r
\r
if (PcdGetBool (PcdPhysicalPresenceHwEnable)) {\r
PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_HW_DISABLE;\r
} \r
\r
- Status = TpmCommPhysicalPresence (\r
- PeiServices,\r
+ Status = Tpm12PhysicalPresence (\r
PhysicalPresenceValue\r
);\r
if (EFI_ERROR (Status)) {\r
return EFI_SUCCESS;\r
}\r
\r
- if (!CmdEnable) {\r
- if (LifetimeLock) {\r
+ if (!TpmPermanentFlags.physicalPresenceCMDEnable) {\r
+ if (TpmPermanentFlags.physicalPresenceLifetimeLock) {\r
//\r
// physicalPresenceCMDEnable is locked, can't change.\r
//\r
// Enable physical presence command\r
// It is necessary in order to lock physical presence\r
//\r
- Status = TpmCommPhysicalPresence (\r
- PeiServices,\r
+ Status = Tpm12PhysicalPresence (\r
TPM_PHYSICAL_PRESENCE_CMD_ENABLE\r
);\r
if (EFI_ERROR (Status)) {\r
//\r
// Lock physical presence\r
// \r
- Status = TpmCommPhysicalPresence (\r
- PeiServices,\r
+ Status = Tpm12PhysicalPresence (\r
TPM_PHYSICAL_PRESENCE_LOCK\r
);\r
return Status;\r
\r
**/\r
BOOLEAN\r
-EFIAPI\r
IsTpmUsable (\r
- IN EFI_PEI_SERVICES **PeiServices\r
+ VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- BOOLEAN Deactivated;\r
+ EFI_STATUS Status;\r
+ TPM_PERMANENT_FLAGS TpmPermanentFlags;\r
\r
- Status = TpmCommGetCapability (PeiServices, &Deactivated, NULL, NULL);\r
+ Status = Tpm12GetCapabilityFlagPermanent (&TpmPermanentFlags);\r
if (EFI_ERROR (Status)) {\r
return FALSE;\r
}\r
- return (BOOLEAN)(!Deactivated); \r
+ return (BOOLEAN)(!TpmPermanentFlags.deactivated);\r
}\r
\r
/**\r
return Status;\r
}\r
\r
- if (IsTpmUsable (PeiServices)) {\r
+ if (IsTpmUsable ()) {\r
if (PcdGet8 (PcdTpmScrtmPolicy) == 1) {\r
Status = MeasureCRTMVersion (PeiServices);\r
}\r
}\r
\r
if (PcdGet8 (PcdTpmInitializationPolicy) == 1) {\r
- Status = TpmCommStartup ((EFI_PEI_SERVICES**)PeiServices, BootMode);\r
+ if (BootMode == BOOT_ON_S3_RESUME) {\r
+ Status = Tpm12Startup (TPM_ST_STATE);\r
+ } else {\r
+ Status = Tpm12Startup (TPM_ST_CLEAR);\r
+ }\r
if (EFI_ERROR (Status) ) {\r
goto Done;\r
}\r
// TpmSelfTest is optional on S3 path, skip it to save S3 time\r
//\r
if (BootMode != BOOT_ON_S3_RESUME) {\r
- Status = TpmCommContinueSelfTest ((EFI_PEI_SERVICES**)PeiServices);\r
+ Status = Tpm12ContinueSelfTest ();\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
\r
[Sources]\r
TcgPei.c\r
- TpmComm.c\r
- TpmComm.h\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r
PcdLib\r
MemoryAllocationLib\r
ReportStatusCodeLib\r
+ Tpm12CommandLib\r
\r
[Guids]\r
gTcgEventEntryHobGuid ## PRODUCES ## HOB\r
+++ /dev/null
-/** @file\r
- Utility functions used by TPM PEI driver.\r
- \r
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "TpmComm.h"\r
-\r
-/**\r
- Send TPM_Startup command to TPM.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[in] BootMode Boot mode.\r
- \r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommStartup (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_BOOT_MODE BootMode\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TPM_STARTUP_TYPE TpmSt;\r
- UINT32 TpmRecvSize;\r
- UINT32 TpmSendSize;\r
- TPM_CMD_START_UP SendBuffer;\r
- UINT8 RecvBuffer[20];\r
-\r
- TpmSt = TPM_ST_CLEAR;\r
- if (BootMode == BOOT_ON_S3_RESUME) {\r
- TpmSt = TPM_ST_STATE;\r
- }\r
- //\r
- // send Tpm command TPM_ORD_Startup\r
- //\r
- TpmRecvSize = 20;\r
- TpmSendSize = sizeof (TPM_CMD_START_UP);\r
- SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
- SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize);\r
- SendBuffer.Hdr.ordinal = SwapBytes32 (TPM_ORD_Startup);\r
- SendBuffer.TpmSt = SwapBytes16 (TpmSt);\r
- Status = Tpm12SubmitCommand (TpmSendSize, (UINT8 *)&SendBuffer, &TpmRecvSize, RecvBuffer);\r
- return Status;\r
-}\r
-\r
-/**\r
- Send TPM_ContinueSelfTest command to TPM.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
-\r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommContinueSelfTest (\r
- IN EFI_PEI_SERVICES **PeiServices\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINT32 TpmRecvSize;\r
- UINT32 TpmSendSize;\r
- TPM_CMD_SELF_TEST SendBuffer;\r
- UINT8 RecvBuffer[20];\r
-\r
- //\r
- // send Tpm command TPM_ORD_ContinueSelfTest\r
- //\r
- TpmRecvSize = 20;\r
- TpmSendSize = sizeof (TPM_CMD_SELF_TEST);\r
- SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
- SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize); \r
- SendBuffer.Hdr.ordinal = SwapBytes32 (TPM_ORD_ContinueSelfTest);\r
- Status = Tpm12SubmitCommand (TpmSendSize, (UINT8 *)&SendBuffer, &TpmRecvSize, RecvBuffer);\r
- return Status;\r
-}\r
-\r
-/**\r
- Get TPM capability flags.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[out] Deactivated Returns deactivated flag.\r
- @param[out] LifetimeLock Returns physicalPresenceLifetimeLock permanent flag. \r
- @param[out] CmdEnable Returns physicalPresenceCMDEnable permanent flag.\r
-\r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommGetCapability (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- OUT BOOLEAN *Deactivated, OPTIONAL\r
- OUT BOOLEAN *LifetimeLock, OPTIONAL\r
- OUT BOOLEAN *CmdEnable OPTIONAL\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINT32 TpmRecvSize;\r
- UINT32 TpmSendSize;\r
- TPM_CMD_GET_CAPABILITY SendBuffer;\r
- UINT8 RecvBuffer[40];\r
- TPM_PERMANENT_FLAGS *TpmPermanentFlags;\r
-\r
- //\r
- // send Tpm command TPM_ORD_GetCapability\r
- //\r
- TpmRecvSize = 40;\r
- TpmSendSize = sizeof (TPM_CMD_GET_CAPABILITY);\r
- SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
- SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize); \r
- SendBuffer.Hdr.ordinal = SwapBytes32 (TPM_ORD_GetCapability);\r
- SendBuffer.Capability = SwapBytes32 (TPM_CAP_FLAG);\r
- SendBuffer.CapabilityFlagSize = SwapBytes32 (sizeof (TPM_CAP_FLAG_PERMANENT));\r
- SendBuffer.CapabilityFlag = SwapBytes32 (TPM_CAP_FLAG_PERMANENT);\r
- Status = Tpm12SubmitCommand (TpmSendSize, (UINT8 *)&SendBuffer, &TpmRecvSize, RecvBuffer);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- TpmPermanentFlags = (TPM_PERMANENT_FLAGS *)&RecvBuffer[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)];\r
- if (Deactivated != NULL) {\r
- *Deactivated = TpmPermanentFlags->deactivated;\r
- }\r
-\r
- if (LifetimeLock != NULL) {\r
- *LifetimeLock = TpmPermanentFlags->physicalPresenceLifetimeLock;\r
- }\r
-\r
- if (CmdEnable != NULL) {\r
- *CmdEnable = TpmPermanentFlags->physicalPresenceCMDEnable;\r
- }\r
- return Status;\r
-}\r
-\r
-/**\r
- Extend a TPM PCR.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[in] DigestToExtend The 160 bit value representing the event to be recorded. \r
- @param[in] PcrIndex The PCR to be updated.\r
- @param[out] NewPcrValue New PCR value after extend. \r
-\r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommExtend (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN TPM_DIGEST *DigestToExtend,\r
- IN TPM_PCRINDEX PcrIndex,\r
- OUT TPM_DIGEST *NewPcrValue\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINT32 TpmSendSize;\r
- UINT32 TpmRecvSize;\r
- TPM_CMD_EXTEND SendBuffer;\r
- UINT8 RecvBuffer[10 + sizeof(TPM_DIGEST)];\r
-\r
- //\r
- // send Tpm command TPM_ORD_Extend\r
- //\r
- TpmRecvSize = sizeof (TPM_RSP_COMMAND_HDR) + sizeof (TPM_DIGEST);\r
- TpmSendSize = sizeof (TPM_CMD_EXTEND);\r
- SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
- SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize);\r
- SendBuffer.Hdr.ordinal = SwapBytes32 (TPM_ORD_Extend);\r
- SendBuffer.PcrIndex = SwapBytes32 (PcrIndex);\r
- CopyMem (&SendBuffer.TpmDigest, (UINT8 *)DigestToExtend, sizeof (TPM_DIGEST));\r
- Status = Tpm12SubmitCommand (TpmSendSize, (UINT8 *)&SendBuffer, &TpmRecvSize, RecvBuffer);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- if(NewPcrValue != NULL) {\r
- CopyMem ((UINT8*)NewPcrValue, &RecvBuffer[10], sizeof (TPM_DIGEST));\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-\r
-/**\r
- Send TSC_PhysicalPresence command to TPM.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[in] PhysicalPresence The state to set the TPMs Physical Presence flags. \r
-\r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommPhysicalPresence (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN TPM_PHYSICAL_PRESENCE PhysicalPresence\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINT32 TpmSendSize;\r
- UINT32 TpmRecvSize;\r
- TPM_CMD_PHYSICAL_PRESENCE SendBuffer;\r
- UINT8 RecvBuffer[10];\r
-\r
- //\r
- // send Tpm command TSC_ORD_PhysicalPresence\r
- //\r
- TpmRecvSize = 10;\r
- TpmSendSize = sizeof (TPM_CMD_PHYSICAL_PRESENCE);\r
- SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
- SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize);\r
- SendBuffer.Hdr.ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence);\r
- SendBuffer.PhysicalPresence = SwapBytes16 (PhysicalPresence);\r
- Status = Tpm12SubmitCommand (TpmSendSize, (UINT8 *)&SendBuffer, &TpmRecvSize, RecvBuffer);\r
- return Status;\r
-}\r
-\r
-/**\r
- Single function calculates SHA1 digest value for all raw data. It\r
- combines Sha1Init(), Sha1Update() and Sha1Final().\r
-\r
- @param[in] Data Raw data to be digested.\r
- @param[in] DataLen Size of the raw data.\r
- @param[out] Digest Pointer to a buffer that stores the final digest.\r
-\r
- @retval EFI_SUCCESS Always successfully calculate the final digest.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TpmCommHashAll (\r
- IN CONST UINT8 *Data,\r
- IN UINTN DataLen,\r
- OUT TPM_DIGEST *Digest\r
- )\r
-{\r
- VOID *Sha1Ctx;\r
- UINTN CtxSize;\r
-\r
- CtxSize = Sha1GetContextSize ();\r
- Sha1Ctx = AllocatePool (CtxSize);\r
- ASSERT (Sha1Ctx != NULL);\r
-\r
- Sha1Init (Sha1Ctx);\r
- Sha1Update (Sha1Ctx, Data, DataLen);\r
- Sha1Final (Sha1Ctx, (UINT8 *)Digest);\r
-\r
- FreePool (Sha1Ctx);\r
-\r
- return EFI_SUCCESS;\r
-}\r
+++ /dev/null
-/** @file\r
- The header file for TPM PEI driver.\r
- \r
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _TPM_COMM_H_\r
-#define _TPM_COMM_H_\r
-\r
-#include <IndustryStandard/Tpm12.h>\r
-#include <IndustryStandard/UefiTcgPlatform.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/BaseCryptLib.h>\r
-#include <Library/Tpm12DeviceLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-\r
-#pragma pack(1)\r
-\r
-typedef struct {\r
- TPM_RQU_COMMAND_HDR Hdr;\r
- TPM_STARTUP_TYPE TpmSt;\r
-} TPM_CMD_START_UP;\r
-\r
-typedef struct {\r
- TPM_RQU_COMMAND_HDR Hdr;\r
-} TPM_CMD_SELF_TEST;\r
-\r
-typedef struct {\r
- TPM_RQU_COMMAND_HDR Hdr;\r
- UINT32 Capability;\r
- UINT32 CapabilityFlagSize;\r
- UINT32 CapabilityFlag;\r
-} TPM_CMD_GET_CAPABILITY;\r
-\r
-typedef struct {\r
- TPM_RQU_COMMAND_HDR Hdr;\r
- TPM_PCRINDEX PcrIndex;\r
- TPM_DIGEST TpmDigest;\r
-} TPM_CMD_EXTEND;\r
-\r
-typedef struct {\r
- TPM_RQU_COMMAND_HDR Hdr;\r
- TPM_PHYSICAL_PRESENCE PhysicalPresence;\r
-} TPM_CMD_PHYSICAL_PRESENCE;\r
-\r
-#pragma pack()\r
-\r
-/**\r
- Send TPM_Startup command to TPM.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[in] BootMode Boot mode. \r
-\r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommStartup (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_BOOT_MODE BootMode\r
- );\r
-\r
-/**\r
- Send TPM_ContinueSelfTest command to TPM.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
-\r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommContinueSelfTest (\r
- IN EFI_PEI_SERVICES **PeiServices\r
- );\r
-\r
-/**\r
- Get TPM capability flags.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[in] TpmHandle TPM handle. \r
- @param[out] Deactivated Returns deactivated flag.\r
- @param[out] LifetimeLock Returns physicalPresenceLifetimeLock permanent flag. \r
- @param[out] CmdEnable Returns physicalPresenceCMDEnable permanent flag.\r
- \r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommGetCapability (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- OUT BOOLEAN *Deactivated, OPTIONAL\r
- OUT BOOLEAN *LifetimeLock, OPTIONAL\r
- OUT BOOLEAN *CmdEnable OPTIONAL\r
- );\r
-\r
-/**\r
- Extend a TPM PCR.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[in] TpmHandle TPM handle. \r
- @param[in] DigestToExtend The 160 bit value representing the event to be recorded. \r
- @param[in] PcrIndex The PCR to be updated.\r
- @param[out] NewPcrValue New PCR value after extend. \r
- \r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommExtend (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN TPM_DIGEST *DigestToExtend,\r
- IN TPM_PCRINDEX PcrIndex,\r
- OUT TPM_DIGEST *NewPcrValue\r
- );\r
-\r
-\r
-/**\r
- Send TSC_PhysicalPresence command to TPM.\r
-\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
- @param[in] TpmHandle TPM handle. \r
- @param[in] PhysicalPresence The state to set the TPMs Physical Presence flags. \r
- \r
- @retval EFI_SUCCESS Operation completed successfully.\r
- @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
- @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-\r
-**/\r
-EFI_STATUS\r
-TpmCommPhysicalPresence (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN TPM_PHYSICAL_PRESENCE PhysicalPresence\r
- );\r
-\r
-/**\r
- Single function calculates SHA1 digest value for all raw data. It\r
- combines Sha1Init(), Sha1Update() and Sha1Final().\r
-\r
- @param[in] Data Raw data to be digested.\r
- @param[in] DataLen Size of the raw data.\r
- @param[out] Digest Pointer to a buffer that stores the final digest.\r
-\r
- @retval EFI_SUCCESS Always successfully calculate the final digest.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TpmCommHashAll (\r
- IN CONST UINT8 *Data,\r
- IN UINTN DataLen,\r
- OUT TPM_DIGEST *Digest\r
- );\r
-\r
-#endif // _TPM_COMM_H_\r