]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/TcgDxe: Replace TpmCommLib with Tpm12DeviceLib
authorMichael Kinney <michael.d.kinney@intel.com>
Thu, 21 Jan 2016 19:29:28 +0000 (19:29 +0000)
committermdkinney <mdkinney@Edk2>
Thu, 21 Jan 2016 19:29:28 +0000 (19:29 +0000)
Update TCG drivers for TPM 1.2 devices to use Tpm12DeviceLib instead
of TpmCommLib.  This is required to support TPM 1.2 hardware devices
that are not on LPC bus.

The current versions of the TCG PEIM and DXE driver contain
MMIO reads/writes to a TPM attached to an LPC bus.  In order
to support TPMs that are connected to other bus types, the
TGC PEIM and DXE drivers must be updated to not perform any
direct register accesses to any TPMs.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19722 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/Tcg/TcgDxe/TcgDxe.c
SecurityPkg/Tcg/TcgDxe/TcgDxe.inf
SecurityPkg/Tcg/TcgDxe/TisDxe.c
SecurityPkg/Tcg/TcgDxe/TpmComm.c
SecurityPkg/Tcg/TcgDxe/TpmComm.h

index 1e52179885c2d59e4f7d40442b93ed12186846b5..39cf38b300428ed46f77958dee333ad6cc4c2e07 100644 (file)
@@ -46,7 +46,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PrintLib.h>\r
-#include <Library/TpmCommLib.h>\r
+#include <Library/Tpm12DeviceLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
@@ -63,7 +63,6 @@ typedef struct _TCG_DXE_DATA {
   EFI_TCG_SERVER_ACPI_TABLE         *TcgServerAcpiTable;\r
   UINTN                             EventLogSize;\r
   UINT8                             *LastEvent;\r
-  TIS_TPM_HANDLE                    TpmHandle;\r
 } TCG_DXE_DATA;\r
 \r
 \r
@@ -114,7 +113,7 @@ EFI_TCG_SERVER_ACPI_TABLE           mTcgServerAcpiTemplate = {
     0,\r
     0,\r
     EFI_ACPI_3_0_BYTE,\r
-    TPM_BASE_ADDRESS          // Base Address\r
+    0                         // Base Address\r
   },\r
   0,                          // Reserved\r
   {0},                        // Configuration Address\r
@@ -455,7 +454,6 @@ TcgDxePassThroughToTpm (
   TcgData = TCG_DXE_DATA_FROM_THIS (This);\r
 \r
   return TisPcExecute (\r
-           TcgData->TpmHandle,\r
            "%r%/%r",\r
            TpmInputParameterBlock,\r
            (UINTN) TpmInputParameterBlockSize,\r
@@ -509,7 +507,6 @@ TcgDxeHashLogExtendEventI (
   }\r
 \r
   Status = TpmCommExtend (\r
-             TcgData->TpmHandle,\r
              &NewEventHdr->Digest,\r
              NewEventHdr->PCRIndex,\r
              NULL\r
@@ -623,7 +620,6 @@ TCG_DXE_DATA                 mTcgDxeData = {
   &mTcgClientAcpiTemplate,\r
   &mTcgServerAcpiTemplate,\r
   0,\r
-  NULL,\r
   NULL\r
 };\r
 \r
@@ -1183,6 +1179,7 @@ InstallAcpiTable (
     Checksum = CalculateCheckSum8 ((UINT8 *)&mTcgServerAcpiTemplate, sizeof (mTcgServerAcpiTemplate));\r
     mTcgServerAcpiTemplate.Header.Checksum = Checksum;\r
 \r
+    mTcgServerAcpiTemplate.BaseAddress.Address = PcdGet64 (PcdTpmBaseAddress);\r
     Status = AcpiTable->InstallAcpiTable (\r
                             AcpiTable,\r
                             &mTcgServerAcpiTemplate,\r
@@ -1282,7 +1279,6 @@ GetTpmStatus (
   TPM_STCLEAR_FLAGS                 VFlags;\r
 \r
   Status = TpmCommGetFlags (\r
-             mTcgDxeData.TpmHandle,\r
              TPM_CAP_FLAG_VOLATILE,\r
              &VFlags,\r
              sizeof (VFlags)\r
@@ -1327,8 +1323,7 @@ DriverEntry (
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  mTcgDxeData.TpmHandle = (TIS_TPM_HANDLE)(UINTN)TPM_BASE_ADDRESS;\r
-  Status = TisPcRequestUseTpm (mTcgDxeData.TpmHandle);\r
+  Status = Tpm12RequestUseTpm ();\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((EFI_D_ERROR, "TPM not detected!\n"));\r
     return Status;\r
index e5409dfefd50e5f79298375f35b0431139c07728..03fb5c713c6dee95bc68bf8d406548a30c688e2d 100644 (file)
@@ -36,6 +36,7 @@
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
+  CryptoPkg/CryptoPkg.dec\r
   SecurityPkg/SecurityPkg.dec\r
 \r
 [LibraryClasses]\r
@@ -47,7 +48,8 @@
   UefiRuntimeServicesTableLib\r
   BaseMemoryLib\r
   DebugLib\r
-  TpmCommLib\r
+  Tpm12DeviceLib\r
+  BaseCryptLib\r
   PrintLib\r
   UefiLib\r
   PcdLib\r
@@ -69,6 +71,7 @@
 [Pcd]\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass              ## SOMETIMES_CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid               ## CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress                ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId             ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId        ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision       ## SOMETIMES_CONSUMES\r
index e7e0f9e405577904364151433cba7b092dca5e62..da6d03bd44ff918c6620faa11164c45158fbcf15 100644 (file)
@@ -1,7 +1,7 @@
 /** @file  \r
   TIS (TPM Interface Specification) functions used by TPM Dxe driver.\r
   \r
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\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
@@ -14,152 +14,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <IndustryStandard/Tpm12.h>\r
 #include <Library/TimerLib.h>\r
-#include <Library/TpmCommLib.h>\r
+#include <Library/Tpm12DeviceLib.h>\r
 #include <Library/DebugLib.h>\r
-#include <Library/IoLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 \r
-STATIC UINT8                        TpmCommandBuf[TPMCMDBUFLENGTH];\r
-\r
-/**\r
-  Send command to TPM for execution.\r
-\r
-  @param[in] TisReg     TPM register space base address.  \r
-  @param[in] TpmBuffer  Buffer for TPM command data.  \r
-  @param[in] DataLength TPM command data length.  \r
\r
-  @retval EFI_SUCCESS   Operation completed successfully.\r
-  @retval EFI_TIMEOUT   The register can't run into the expected status in time.\r
+//\r
+// Max TPM command/reponse length\r
+//\r
+#define TPMCMDBUFLENGTH             SIZE_1KB\r
 \r
-**/\r
-EFI_STATUS\r
-TisPcSend (\r
-  IN     TIS_PC_REGISTERS_PTR       TisReg,\r
-  IN     UINT8                      *TpmBuffer,\r
-  IN     UINT32                     DataLength\r
-  )\r
-{\r
-  UINT16                            BurstCount;\r
-  UINT32                            Index;\r
-  EFI_STATUS                        Status;\r
-\r
-  Status = TisPcPrepareCommand (TisReg);\r
-  if (EFI_ERROR (Status)){\r
-    DEBUG ((DEBUG_ERROR, "The Tpm not ready!\n"));\r
-    return Status;\r
-  }\r
-  Index = 0;\r
-  while (Index < DataLength) {\r
-    Status = TisPcReadBurstCount (TisReg, &BurstCount);\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_TIMEOUT;\r
-    }\r
-    for (; BurstCount > 0 && Index < DataLength; BurstCount--) {\r
-      MmioWrite8 ((UINTN) &TisReg->DataFifo, *(TpmBuffer + Index));\r
-      Index++;\r
-    }\r
-  }\r
-  //\r
-  // Ensure the Tpm status STS_EXPECT change from 1 to 0\r
-  //\r
-  Status = TisPcWaitRegisterBits (\r
-             &TisReg->Status,\r
-             (UINT8) TIS_PC_VALID,\r
-             TIS_PC_STS_EXPECT,\r
-             TIS_TIMEOUT_C\r
-             );\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Receive response data of last command from TPM.\r
-\r
-  @param[in]  TisReg            TPM register space base address.  \r
-  @param[out] TpmBuffer         Buffer for response data.  \r
-  @param[out] RespSize          Response data length.  \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_DEVICE_ERROR      Unexpected device status.\r
-  @retval EFI_BUFFER_TOO_SMALL  Response data is too long.\r
-\r
-**/\r
-EFI_STATUS\r
-TisPcReceive (\r
-  IN      TIS_PC_REGISTERS_PTR      TisReg,\r
-     OUT  UINT8                     *TpmBuffer,\r
-     OUT  UINT32                    *RespSize\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  UINT16                            BurstCount;\r
-  UINT32                            Index;\r
-  UINT32                            ResponseSize;\r
-  UINT32                            Data32;\r
-\r
-  //\r
-  // Wait for the command completion\r
-  //\r
-  Status = TisPcWaitRegisterBits (\r
-             &TisReg->Status,\r
-             (UINT8) (TIS_PC_VALID | TIS_PC_STS_DATA),\r
-             0,\r
-             TIS_TIMEOUT_B\r
-             );\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_TIMEOUT;\r
-  }\r
-  //\r
-  // Read the response data header and check it\r
-  //\r
-  Index = 0;\r
-  BurstCount = 0;\r
-  while (Index < sizeof (TPM_RSP_COMMAND_HDR)) {\r
-    Status = TisPcReadBurstCount (TisReg, &BurstCount);\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_TIMEOUT;\r
-    }\r
-    for (; BurstCount > 0 ; BurstCount--) {\r
-      *(TpmBuffer + Index) = MmioRead8 ((UINTN) &TisReg->DataFifo);\r
-      Index++;\r
-      if (Index == sizeof (TPM_RSP_COMMAND_HDR))\r
-        break;\r
-    }\r
-  }\r
-  //\r
-  // Check the reponse data header (tag,parasize and returncode )\r
-  //\r
-  CopyMem (&Data32, (TpmBuffer + 2), sizeof (UINT32));\r
-  ResponseSize = SwapBytes32 (Data32);\r
-  *RespSize =  ResponseSize;\r
-  if (ResponseSize == sizeof (TPM_RSP_COMMAND_HDR)) {\r
-    return EFI_SUCCESS;\r
-  }\r
-  if (ResponseSize < sizeof (TPM_RSP_COMMAND_HDR)) {\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-  if (ResponseSize > TPMCMDBUFLENGTH) {\r
-    return EFI_BUFFER_TOO_SMALL;\r
-  }\r
-  //\r
-  // Continue reading the remaining data\r
-  //\r
-  while (Index < ResponseSize) {\r
-    for (; BurstCount > 0 ; BurstCount--) {\r
-      *(TpmBuffer + Index) = MmioRead8 ((UINTN) &TisReg->DataFifo);\r
-      Index++;\r
-      if (Index == ResponseSize) {\r
-        return EFI_SUCCESS;\r
-      }\r
-    }\r
-    Status = TisPcReadBurstCount (TisReg, &BurstCount);\r
-    if (EFI_ERROR (Status) && (Index < ResponseSize)) {\r
-      return EFI_DEVICE_ERROR;\r
-    }\r
-  }\r
-  return EFI_SUCCESS;\r
-}\r
+STATIC UINT8                        TpmCommandBuf[TPMCMDBUFLENGTH];\r
+STATIC UINT8                        TpmResponseBuf[TPMCMDBUFLENGTH];\r
 \r
 /**\r
   Format TPM command data according to the format control character.\r
@@ -368,7 +234,6 @@ TisPcReceiveV (
 EFI_STATUS\r
 EFIAPI\r
 TisPcExecute (\r
-  IN      TIS_TPM_HANDLE            TisReg,\r
   IN      CONST CHAR8               *Fmt,\r
   ...\r
   )\r
@@ -394,35 +259,20 @@ TisPcExecute (
     }\r
     Fmt++;\r
   }\r
-  //\r
-  // Send the command to TPM\r
-  //\r
-  Status = TisPcSend (TisReg, TpmCommandBuf, BufSize);\r
-  if (EFI_ERROR (Status))  {\r
-    //\r
-    // Ensure the TPM state change from "Reception" to "Idle/Ready"\r
-    //\r
-    MmioWrite8 ((UINTN) &(((TIS_PC_REGISTERS_PTR) TisReg)->Status), TIS_PC_STS_READY);\r
-    goto Error;\r
-  }\r
 \r
-  MmioWrite8 ((UINTN) &(((TIS_PC_REGISTERS_PTR) TisReg)->Status), TIS_PC_STS_GO);\r
-  Fmt++;\r
-  //\r
-  // Receive the response data from TPM\r
-  //\r
-  ZeroMem (TpmCommandBuf, TPMCMDBUFLENGTH);\r
-  Status = TisPcReceive (TisReg, TpmCommandBuf, &ResponseSize);\r
   //\r
-  // Ensure the TPM state change from "Execution" or "Completion" to "Idle/Ready"\r
+  // Send the command to TPM\r
   //\r
-  MmioWrite8 ((UINTN) &(((TIS_PC_REGISTERS_PTR) TisReg)->Status), TIS_PC_STS_READY);\r
+  ZeroMem (TpmResponseBuf, sizeof (TpmResponseBuf));\r
+  ResponseSize = sizeof (TpmResponseBuf);\r
+  Status = Tpm12SubmitCommand (BufSize, TpmCommandBuf, &ResponseSize, TpmResponseBuf);\r
   if (EFI_ERROR (Status)) {\r
     goto Error;\r
   }\r
-  \r
+  Fmt++;\r
+\r
   //\r
-  // Get the formatted data from the TpmCommandBuf.\r
+  // Get the formatted data from the TpmResponseBuf.\r
   //\r
   BufSize =0;\r
   DataFinished = FALSE;\r
@@ -430,7 +280,7 @@ TisPcExecute (
     if (*Fmt == '%') {\r
       Fmt++;\r
     }\r
-    Status = TisPcReceiveV (*Fmt, &Ap, TpmCommandBuf, &BufSize, ResponseSize, &DataFinished);\r
+    Status = TisPcReceiveV (*Fmt, &Ap, TpmResponseBuf, &BufSize, ResponseSize, &DataFinished);\r
     if (EFI_ERROR (Status)) {\r
       goto Error;\r
     }\r
index 96732fad5d895ef1fd4b25345d7e91238d0062a3..28b8acd40f56df91673db7649e2d5b1f33481519 100644 (file)
@@ -1,7 +1,7 @@
 /** @file  \r
   Utility functions used by TPM Dxe driver.\r
 \r
-Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\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
@@ -14,15 +14,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <IndustryStandard/Tpm12.h>\r
 #include <IndustryStandard/UefiTcgPlatform.h>\r
-#include <Library/TpmCommLib.h>\r
+#include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/BaseCryptLib.h>\r
 \r
 #include "TpmComm.h"\r
 \r
 /**\r
   Extend a TPM PCR.\r
 \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
@@ -33,7 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 EFI_STATUS\r
 TpmCommExtend (\r
-  IN      TIS_TPM_HANDLE            TpmHandle,\r
   IN      TPM_DIGEST                *DigestToExtend,\r
   IN      TPM_PCRINDEX              PcrIndex,\r
      OUT  TPM_DIGEST                *NewPcrValue\r
@@ -53,7 +53,6 @@ TpmCommExtend (
     sizeof (CmdHdr) + sizeof (PcrIndex) + sizeof (*DigestToExtend);\r
   CmdHdr.ordinal = TPM_ORD_Extend;\r
   Status = TisPcExecute (\r
-             TpmHandle,\r
              "%h%d%r%/%h%r",\r
              &CmdHdr,\r
              PcrIndex,\r
@@ -75,7 +74,6 @@ TpmCommExtend (
 /**\r
   Get TPM capability flags.\r
 \r
-  @param[in]  TpmHandle    TPM handle.  \r
   @param[in]  FlagSubcap   Flag subcap.  \r
   @param[out] FlagBuffer   Pointer to the buffer for returned flag structure.\r
   @param[in]  FlagSize     Size of the buffer.  \r
@@ -86,7 +84,6 @@ TpmCommExtend (
 **/\r
 EFI_STATUS\r
 TpmCommGetFlags (\r
-  IN      TIS_TPM_HANDLE            TpmHandle,\r
   IN      UINT32                    FlagSubcap,\r
      OUT  VOID                      *FlagBuffer,\r
   IN      UINTN                     FlagSize\r
@@ -102,7 +99,6 @@ TpmCommGetFlags (
   CmdHdr.ordinal = TPM_ORD_GetCapability;\r
 \r
   Status = TisPcExecute (\r
-             TpmHandle,\r
              "%h%d%d%d%/%h%d%r",\r
              &CmdHdr,\r
              TPM_CAP_FLAG,\r
@@ -168,3 +164,37 @@ TpmCommLogEvent (
     );\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
index 763ad76d624dfd94f9b34a55a83da871cedda1c6..a0d0d600f2d727dbc2c5811cbf7577ef5e2a1a2f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file  \r
   Definitions and function prototypes used by TPM DXE driver.\r
 \r
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\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
@@ -40,7 +40,6 @@ TpmCommLogEvent (
 /**\r
   Extend a TPM PCR.\r
 \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
@@ -51,7 +50,6 @@ TpmCommLogEvent (
 **/\r
 EFI_STATUS\r
 TpmCommExtend (\r
-  IN      TIS_TPM_HANDLE            TpmHandle,\r
   IN      TPM_DIGEST                *DigestToExtend,\r
   IN      TPM_PCRINDEX              PcrIndex,\r
      OUT  TPM_DIGEST                *NewPcrValue\r
@@ -60,7 +58,6 @@ TpmCommExtend (
 /**\r
   Get TPM capability flags.\r
 \r
-  @param[in]  TpmHandle    TPM handle.  \r
   @param[in]  FlagSubcap   Flag subcap.  \r
   @param[out] FlagBuffer   Pointer to the buffer for returned flag structure.\r
   @param[in]  FlagSize     Size of the buffer.  \r
@@ -71,7 +68,6 @@ TpmCommExtend (
 **/\r
 EFI_STATUS\r
 TpmCommGetFlags (\r
-  IN      TIS_TPM_HANDLE            TpmHandle,\r
   IN      UINT32                    FlagSubcap,\r
      OUT  VOID                      *Buffer,\r
   IN      UINTN                     Size\r
@@ -83,7 +79,7 @@ TpmCommGetFlags (
   @param[in] TisReg    TPM Handle.  \r
   @param[in] Fmt       Format control string.  \r
   @param[in] ...       The variable argument list.\r
\r
+\r
   @retval EFI_SUCCESS  Operation completed successfully.\r
   @retval EFI_TIMEOUT  The register can't run into the expected status in time.\r
 \r
@@ -91,9 +87,26 @@ TpmCommGetFlags (
 EFI_STATUS\r
 EFIAPI\r
 TisPcExecute (\r
-  IN      TIS_TPM_HANDLE            TisReg,\r
   IN      CONST CHAR8               *Fmt,\r
   ...\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