* [PATCH 1/1] SecurityPkg/TpmCommLib: Remove TpmCommLib
@ 2019-08-05 5:55 Zhang, Shenglei
2019-08-05 6:17 ` Yao, Jiewen
2019-08-05 9:01 ` [edk2-devel] " Wang, Jian J
0 siblings, 2 replies; 3+ messages in thread
From: Zhang, Shenglei @ 2019-08-05 5:55 UTC (permalink / raw)
To: devel; +Cc: shenglei, Jiewen Yao, Jian Wang, Chao Zhang
From: shenglei <shenglei.zhang@intel.com>
TpmCommonLib is no longer used by TcgPei/TcgDxe/Tcg2ConfigPei
modules. So TpmCommLib can be removed.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
SecurityPkg/Library/TpmCommLib/TisPc.c | 177 -----------
SecurityPkg/Library/TpmCommLib/TpmComm.c | 44 ---
SecurityPkg/Include/Library/TpmCommLib.h | 281 ------------------
| 23 --
SecurityPkg/Library/TpmCommLib/TpmCommLib.inf | 45 ---
SecurityPkg/Library/TpmCommLib/TpmCommLib.uni | 17 --
SecurityPkg/SecurityPkg.dec | 4 -
SecurityPkg/SecurityPkg.dsc | 2 -
8 files changed, 593 deletions(-)
delete mode 100644 SecurityPkg/Library/TpmCommLib/TisPc.c
delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmComm.c
delete mode 100644 SecurityPkg/Include/Library/TpmCommLib.h
delete mode 100644 SecurityPkg/Library/TpmCommLib/CommonHeader.h
delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
diff --git a/SecurityPkg/Library/TpmCommLib/TisPc.c b/SecurityPkg/Library/TpmCommLib/TisPc.c
deleted file mode 100644
index 162e883d2170..000000000000
--- a/SecurityPkg/Library/TpmCommLib/TisPc.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/** @file
- Basic TIS (TPM Interface Specification) functions.
-
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "CommonHeader.h"
-
-/**
- Check whether TPM chip exist.
-
- @param[in] TisReg Pointer to TIS register.
-
- @retval TRUE TPM chip exists.
- @retval FALSE TPM chip is not found.
-**/
-BOOLEAN
-TisPcPresenceCheck (
- IN TIS_PC_REGISTERS_PTR TisReg
- )
-{
- UINT8 RegRead;
-
- RegRead = MmioRead8 ((UINTN)&TisReg->Access);
- return (BOOLEAN)(RegRead != (UINT8)-1);
-}
-
-/**
- Check whether the value of a TPM chip register satisfies the input BIT setting.
-
- @param[in] Register Address port of register to be checked.
- @param[in] BitSet Check these data bits are set.
- @param[in] BitClear Check these data bits are clear.
- @param[in] TimeOut The max wait time (unit MicroSecond) when checking register.
-
- @retval EFI_SUCCESS The register satisfies the check bit.
- @retval EFI_TIMEOUT The register can't run into the expected status in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcWaitRegisterBits (
- IN UINT8 *Register,
- IN UINT8 BitSet,
- IN UINT8 BitClear,
- IN UINT32 TimeOut
- )
-{
- UINT8 RegRead;
- UINT32 WaitTime;
-
- for (WaitTime = 0; WaitTime < TimeOut; WaitTime += 30){
- RegRead = MmioRead8 ((UINTN)Register);
- if ((RegRead & BitSet) == BitSet && (RegRead & BitClear) == 0)
- return EFI_SUCCESS;
- MicroSecondDelay (30);
- }
- return EFI_TIMEOUT;
-}
-
-/**
- Get BurstCount by reading the burstCount field of a TIS regiger
- in the time of default TIS_TIMEOUT_D.
-
- @param[in] TisReg Pointer to TIS register.
- @param[out] BurstCount Pointer to a buffer to store the got BurstConut.
-
- @retval EFI_SUCCESS Get BurstCount.
- @retval EFI_INVALID_PARAMETER TisReg is NULL or BurstCount is NULL.
- @retval EFI_TIMEOUT BurstCount can't be got in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcReadBurstCount (
- IN TIS_PC_REGISTERS_PTR TisReg,
- OUT UINT16 *BurstCount
- )
-{
- UINT32 WaitTime;
- UINT8 DataByte0;
- UINT8 DataByte1;
-
- if (BurstCount == NULL || TisReg == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- WaitTime = 0;
- do {
- //
- // TIS_PC_REGISTERS_PTR->burstCount is UINT16, but it is not 2bytes aligned,
- // so it needs to use MmioRead8 to read two times
- //
- DataByte0 = MmioRead8 ((UINTN)&TisReg->BurstCount);
- DataByte1 = MmioRead8 ((UINTN)&TisReg->BurstCount + 1);
- *BurstCount = (UINT16)((DataByte1 << 8) + DataByte0);
- if (*BurstCount != 0) {
- return EFI_SUCCESS;
- }
- MicroSecondDelay (30);
- WaitTime += 30;
- } while (WaitTime < TIS_TIMEOUT_D);
-
- return EFI_TIMEOUT;
-}
-
-/**
- Set TPM chip to ready state by sending ready command TIS_PC_STS_READY
- to Status Register in time.
-
- @param[in] TisReg Pointer to TIS register.
-
- @retval EFI_SUCCESS TPM chip enters into ready state.
- @retval EFI_INVALID_PARAMETER TisReg is NULL.
- @retval EFI_TIMEOUT TPM chip can't be set to ready state in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcPrepareCommand (
- IN TIS_PC_REGISTERS_PTR TisReg
- )
-{
- EFI_STATUS Status;
-
- if (TisReg == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY);
- Status = TisPcWaitRegisterBits (
- &TisReg->Status,
- TIS_PC_STS_READY,
- 0,
- TIS_TIMEOUT_B
- );
- return Status;
-}
-
-/**
- Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE
- to ACCESS Register in the time of default TIS_TIMEOUT_A.
-
- @param[in] TisReg Pointer to TIS register.
-
- @retval EFI_SUCCESS Get the control of TPM chip.
- @retval EFI_INVALID_PARAMETER TisReg is NULL.
- @retval EFI_NOT_FOUND TPM chip doesn't exit.
- @retval EFI_TIMEOUT Can't get the TPM control in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcRequestUseTpm (
- IN TIS_PC_REGISTERS_PTR TisReg
- )
-{
- EFI_STATUS Status;
-
- if (TisReg == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!TisPcPresenceCheck (TisReg)) {
- return EFI_NOT_FOUND;
- }
-
- MmioWrite8((UINTN)&TisReg->Access, TIS_PC_ACC_RQUUSE);
- //
- // No locality set before, ACCESS_X.activeLocality MUST be valid within TIMEOUT_A
- //
- Status = TisPcWaitRegisterBits (
- &TisReg->Access,
- (UINT8)(TIS_PC_ACC_ACTIVE |TIS_PC_VALID),
- 0,
- TIS_TIMEOUT_A
- );
- return Status;
-}
diff --git a/SecurityPkg/Library/TpmCommLib/TpmComm.c b/SecurityPkg/Library/TpmCommLib/TpmComm.c
deleted file mode 100644
index dee64b24ffef..000000000000
--- a/SecurityPkg/Library/TpmCommLib/TpmComm.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/** @file
- Basic TPM command functions.
-
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "CommonHeader.h"
-
-/**
- Single function calculates SHA1 digest value for all raw data. It
- combines Sha1Init(), Sha1Update() and Sha1Final().
-
- @param[in] Data Raw data to be digested.
- @param[in] DataLen Size of the raw data.
- @param[out] Digest Pointer to a buffer that stores the final digest.
-
- @retval EFI_SUCCESS Always successfully calculate the final digest.
-**/
-EFI_STATUS
-EFIAPI
-TpmCommHashAll (
- IN CONST UINT8 *Data,
- IN UINTN DataLen,
- OUT TPM_DIGEST *Digest
- )
-{
- VOID *Sha1Ctx;
- UINTN CtxSize;
-
- CtxSize = Sha1GetContextSize ();
- Sha1Ctx = AllocatePool (CtxSize);
- ASSERT (Sha1Ctx != NULL);
-
- Sha1Init (Sha1Ctx);
- Sha1Update (Sha1Ctx, Data, DataLen);
- Sha1Final (Sha1Ctx, (UINT8 *)Digest);
-
- FreePool (Sha1Ctx);
-
- return EFI_SUCCESS;
-}
-
diff --git a/SecurityPkg/Include/Library/TpmCommLib.h b/SecurityPkg/Include/Library/TpmCommLib.h
deleted file mode 100644
index b9aca60b82a0..000000000000
--- a/SecurityPkg/Include/Library/TpmCommLib.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/** @file
- This library is only intended to be used by TPM modules.
- It provides basic TPM Interface Specification (TIS) and Command functions.
-
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _TPM_COMM_LIB_H_
-#define _TPM_COMM_LIB_H_
-
-#include <IndustryStandard/Tpm12.h>
-
-typedef EFI_HANDLE TIS_TPM_HANDLE;
-
-///
-/// TPM register base address.
-///
-#define TPM_BASE_ADDRESS 0xfed40000
-
-//
-// Set structure alignment to 1-byte
-//
-#pragma pack (1)
-
-//
-// Register set map as specified in TIS specification Chapter 10
-//
-typedef struct {
- ///
- /// Used to gain ownership for this particular port.
- ///
- UINT8 Access; // 0
- UINT8 Reserved1[7]; // 1
- ///
- /// Controls interrupts.
- ///
- UINT32 IntEnable; // 8
- ///
- /// SIRQ vector to be used by the TPM.
- ///
- UINT8 IntVector; // 0ch
- UINT8 Reserved2[3]; // 0dh
- ///
- /// What caused interrupt.
- ///
- UINT32 IntSts; // 10h
- ///
- /// Shows which interrupts are supported by that particular TPM.
- ///
- UINT32 IntfCapability; // 14h
- ///
- /// Status Register. Provides status of the TPM.
- ///
- UINT8 Status; // 18h
- ///
- /// Number of consecutive writes that can be done to the TPM.
- ///
- UINT16 BurstCount; // 19h
- UINT8 Reserved3[9];
- ///
- /// Read or write FIFO, depending on transaction.
- ///
- UINT32 DataFifo; // 24
- UINT8 Reserved4[0xed8]; // 28h
- ///
- /// Vendor ID
- ///
- UINT16 Vid; // 0f00h
- ///
- /// Device ID
- ///
- UINT16 Did; // 0f02h
- ///
- /// Revision ID
- ///
- UINT8 Rid; // 0f04h
- ///
- /// TCG defined configuration registers.
- ///
- UINT8 TcgDefined[0x7b]; // 0f05h
- ///
- /// Alias to I/O legacy space.
- ///
- UINT32 LegacyAddress1; // 0f80h
- ///
- /// Additional 8 bits for I/O legacy space extension.
- ///
- UINT32 LegacyAddress1Ex; // 0f84h
- ///
- /// Alias to second I/O legacy space.
- ///
- UINT32 LegacyAddress2; // 0f88h
- ///
- /// Additional 8 bits for second I/O legacy space extension.
- ///
- UINT32 LegacyAddress2Ex; // 0f8ch
- ///
- /// Vendor-defined configuration registers.
- ///
- UINT8 VendorDefined[0x70];// 0f90h
-} TIS_PC_REGISTERS;
-
-//
-// Restore original structure alignment
-//
-#pragma pack ()
-
-//
-// Define pointer types used to access TIS registers on PC
-//
-typedef TIS_PC_REGISTERS *TIS_PC_REGISTERS_PTR;
-
-//
-// TCG Platform Type based on TCG ACPI Specification Version 1.00
-//
-#define TCG_PLATFORM_TYPE_CLIENT 0
-#define TCG_PLATFORM_TYPE_SERVER 1
-
-//
-// Define bits of ACCESS and STATUS registers
-//
-
-///
-/// This bit is a 1 to indicate that the other bits in this register are valid.
-///
-#define TIS_PC_VALID BIT7
-///
-/// Indicate that this locality is active.
-///
-#define TIS_PC_ACC_ACTIVE BIT5
-///
-/// Set to 1 to indicate that this locality had the TPM taken away while
-/// this locality had the TIS_PC_ACC_ACTIVE bit set.
-///
-#define TIS_PC_ACC_SEIZED BIT4
-///
-/// Set to 1 to indicate that TPM MUST reset the
-/// TIS_PC_ACC_ACTIVE bit and remove ownership for localities less than the
-/// locality that is writing this bit.
-///
-#define TIS_PC_ACC_SEIZE BIT3
-///
-/// When this bit is 1, another locality is requesting usage of the TPM.
-///
-#define TIS_PC_ACC_PENDIND BIT2
-///
-/// Set to 1 to indicate that this locality is requesting to use TPM.
-///
-#define TIS_PC_ACC_RQUUSE BIT1
-///
-/// A value of 1 indicates that a T/OS has not been established on the platform
-///
-#define TIS_PC_ACC_ESTABLISH BIT0
-
-///
-/// When this bit is 1, TPM is in the Ready state,
-/// indicating it is ready to receive a new command.
-///
-#define TIS_PC_STS_READY BIT6
-///
-/// Write a 1 to this bit to cause the TPM to execute that command.
-///
-#define TIS_PC_STS_GO BIT5
-///
-/// This bit indicates that the TPM has data available as a response.
-///
-#define TIS_PC_STS_DATA BIT4
-///
-/// The TPM sets this bit to a value of 1 when it expects another byte of data for a command.
-///
-#define TIS_PC_STS_EXPECT BIT3
-///
-/// Writes a 1 to this bit to force the TPM to re-send the response.
-///
-#define TIS_PC_STS_RETRY BIT1
-
-//
-// Default TimeOut value
-//
-#define TIS_TIMEOUT_A 750 * 1000 // 750ms
-#define TIS_TIMEOUT_B 2000 * 1000 // 2s
-#define TIS_TIMEOUT_C 750 * 1000 // 750ms
-#define TIS_TIMEOUT_D 750 * 1000 // 750ms
-
-//
-// Max TPM command/reponse length
-//
-#define TPMCMDBUFLENGTH 1024
-
-/**
- Check whether the value of a TPM chip register satisfies the input BIT setting.
-
- @param[in] Register Address port of register to be checked.
- @param[in] BitSet Check these data bits are set.
- @param[in] BitClear Check these data bits are clear.
- @param[in] TimeOut The max wait time (unit MicroSecond) when checking register.
-
- @retval EFI_SUCCESS The register satisfies the check bit.
- @retval EFI_TIMEOUT The register can't run into the expected status in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcWaitRegisterBits (
- IN UINT8 *Register,
- IN UINT8 BitSet,
- IN UINT8 BitClear,
- IN UINT32 TimeOut
- );
-
-/**
- Get BurstCount by reading the burstCount field of a TIS regiger
- in the time of default TIS_TIMEOUT_D.
-
- @param[in] TisReg Pointer to TIS register.
- @param[out] BurstCount Pointer to a buffer to store the got BurstConut.
-
- @retval EFI_SUCCESS Get BurstCount.
- @retval EFI_INVALID_PARAMETER TisReg is NULL or BurstCount is NULL.
- @retval EFI_TIMEOUT BurstCount can't be got in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcReadBurstCount (
- IN TIS_PC_REGISTERS_PTR TisReg,
- OUT UINT16 *BurstCount
- );
-
-/**
- Set TPM chip to ready state by sending ready command TIS_PC_STS_READY
- to Status Register in time.
-
- @param[in] TisReg Pointer to TIS register.
-
- @retval EFI_SUCCESS TPM chip enters into ready state.
- @retval EFI_INVALID_PARAMETER TisReg is NULL.
- @retval EFI_TIMEOUT TPM chip can't be set to ready state in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcPrepareCommand (
- IN TIS_PC_REGISTERS_PTR TisReg
- );
-
-/**
- Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE
- to ACCESS Register in the time of default TIS_TIMEOUT_D.
-
- @param[in] TisReg Pointer to TIS register.
-
- @retval EFI_SUCCESS Get the control of TPM chip.
- @retval EFI_INVALID_PARAMETER TisReg is NULL.
- @retval EFI_NOT_FOUND TPM chip doesn't exit.
- @retval EFI_TIMEOUT Can't get the TPM control in time.
-**/
-EFI_STATUS
-EFIAPI
-TisPcRequestUseTpm (
- IN TIS_PC_REGISTERS_PTR TisReg
- );
-
-/**
- Single function calculates SHA1 digest value for all raw data. It
- combines Sha1Init(), Sha1Update() and Sha1Final().
-
- @param[in] Data Raw data to be digested.
- @param[in] DataLen Size of the raw data.
- @param[out] Digest Pointer to a buffer that stores the final digest.
-
- @retval EFI_SUCCESS Always successfully calculate the final digest.
-**/
-EFI_STATUS
-EFIAPI
-TpmCommHashAll (
- IN CONST UINT8 *Data,
- IN UINTN DataLen,
- OUT TPM_DIGEST *Digest
- );
-
-#endif
diff --git a/SecurityPkg/Library/TpmCommLib/CommonHeader.h b/SecurityPkg/Library/TpmCommLib/CommonHeader.h
deleted file mode 100644
index 386c9fab44d9..000000000000
--- a/SecurityPkg/Library/TpmCommLib/CommonHeader.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/** @file
- The intenal header file for TpmCommLib.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _TPMCOMMLIB_COMMON_HEADER_H_
-#define _TPMCOMMLIB_COMMON_HEADER_H_
-
-#include <PiPei.h>
-#include <IndustryStandard/Tpm12.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/IoLib.h>
-#include <Library/TimerLib.h>
-#include <Library/TpmCommLib.h>
-#include <Library/BaseCryptLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-
-#endif
diff --git a/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf b/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
deleted file mode 100644
index 4caabd496f59..000000000000
--- a/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
+++ /dev/null
@@ -1,45 +0,0 @@
-## @file
-# Provides some common functions for the TCG feature
-#
-# This instance provides basic TPM Interface Specification (TIS) functions
-# and TPM hashall function.
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = TpmCommLib
- MODULE_UNI_FILE = TpmCommLib.uni
- FILE_GUID = 7d9fe32e-a6a9-4cdf-abff-10cc7f22e1c9
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = TpmCommLib|DXE_DRIVER UEFI_DRIVER PEIM DXE_SMM_DRIVER
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- TisPc.c
- TpmComm.c
- CommonHeader.h
-
-[Packages]
- MdePkg/MdePkg.dec
- SecurityPkg/SecurityPkg.dec
- CryptoPkg/CryptoPkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- IoLib
- TimerLib
- BaseCryptLib
- MemoryAllocationLib
- DebugLib
-
diff --git a/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni b/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
deleted file mode 100644
index 96194551be88..000000000000
--- a/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
+++ /dev/null
@@ -1,17 +0,0 @@
-// /** @file
-// Provides some common functions for the TCG feature
-//
-// This instance provides basic TPM Interface Specification (TIS) functions
-// and TPM hashall function.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Provides some common functions for the TCG feature"
-
-#string STR_MODULE_DESCRIPTION #language en-US "This instance provides basic TPM Interface Specification (TIS) functions and TPM hashall function."
-
diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec
index ce2a9d33a4f2..3511cfb2cb85 100644
--- a/SecurityPkg/SecurityPkg.dec
+++ b/SecurityPkg/SecurityPkg.dec
@@ -55,10 +55,6 @@ [LibraryClasses]
#
Tpm12DeviceLib|Include/Library/Tpm12DeviceLib.h
- ## @libraryclass Provides TPM Interface Specification (TIS) interfaces for TPM command.
- #
- TpmCommLib|Include/Library/TpmCommLib.h
-
## @libraryclass Provides support for TCG Physical Presence Interface (PPI) specification
# >= 128 Vendor Specific PPI Operation.
#
diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index aef2ac3a208d..e2ac1e4a9e1c 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -47,7 +47,6 @@ [LibraryClasses]
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- TpmCommLib|SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
TcgPhysicalPresenceLib|SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.inf
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
@@ -155,7 +154,6 @@ [Components]
# TPM
#
SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf
- SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.inf
SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] SecurityPkg/TpmCommLib: Remove TpmCommLib
2019-08-05 5:55 [PATCH 1/1] SecurityPkg/TpmCommLib: Remove TpmCommLib Zhang, Shenglei
@ 2019-08-05 6:17 ` Yao, Jiewen
2019-08-05 9:01 ` [edk2-devel] " Wang, Jian J
1 sibling, 0 replies; 3+ messages in thread
From: Yao, Jiewen @ 2019-08-05 6:17 UTC (permalink / raw)
To: Zhang, Shenglei, devel@edk2.groups.io; +Cc: Wang, Jian J, Zhang, Chao B
Good. Reviewed-by: Jiewen.Yao@intel.com
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, August 5, 2019 1:55 PM
> To: devel@edk2.groups.io
> Cc: Zhang, Shenglei <shenglei.zhang@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Zhang,
> Chao B <chao.b.zhang@intel.com>
> Subject: [PATCH 1/1] SecurityPkg/TpmCommLib: Remove TpmCommLib
>
> From: shenglei <shenglei.zhang@intel.com>
>
> TpmCommonLib is no longer used by TcgPei/TcgDxe/Tcg2ConfigPei
> modules. So TpmCommLib can be removed.
>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian Wang <jian.j.wang@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> SecurityPkg/Library/TpmCommLib/TisPc.c | 177 -----------
> SecurityPkg/Library/TpmCommLib/TpmComm.c | 44 ---
> SecurityPkg/Include/Library/TpmCommLib.h | 281 ------------------
> SecurityPkg/Library/TpmCommLib/CommonHeader.h | 23 --
> SecurityPkg/Library/TpmCommLib/TpmCommLib.inf | 45 ---
> SecurityPkg/Library/TpmCommLib/TpmCommLib.uni | 17 --
> SecurityPkg/SecurityPkg.dec | 4 -
> SecurityPkg/SecurityPkg.dsc | 2 -
> 8 files changed, 593 deletions(-)
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TisPc.c
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmComm.c
> delete mode 100644 SecurityPkg/Include/Library/TpmCommLib.h
> delete mode 100644 SecurityPkg/Library/TpmCommLib/CommonHeader.h
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
>
> diff --git a/SecurityPkg/Library/TpmCommLib/TisPc.c
> b/SecurityPkg/Library/TpmCommLib/TisPc.c
> deleted file mode 100644
> index 162e883d2170..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TisPc.c
> +++ /dev/null
> @@ -1,177 +0,0 @@
> -/** @file
> - Basic TIS (TPM Interface Specification) functions.
> -
> -Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#include "CommonHeader.h"
> -
> -/**
> - Check whether TPM chip exist.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval TRUE TPM chip exists.
> - @retval FALSE TPM chip is not found.
> -**/
> -BOOLEAN
> -TisPcPresenceCheck (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - )
> -{
> - UINT8 RegRead;
> -
> - RegRead = MmioRead8 ((UINTN)&TisReg->Access);
> - return (BOOLEAN)(RegRead != (UINT8)-1);
> -}
> -
> -/**
> - Check whether the value of a TPM chip register satisfies the input BIT
> setting.
> -
> - @param[in] Register Address port of register to be checked.
> - @param[in] BitSet Check these data bits are set.
> - @param[in] BitClear Check these data bits are clear.
> - @param[in] TimeOut The max wait time (unit MicroSecond)
> when checking register.
> -
> - @retval EFI_SUCCESS The register satisfies the check bit.
> - @retval EFI_TIMEOUT The register can't run into the expected
> status in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcWaitRegisterBits (
> - IN UINT8 *Register,
> - IN UINT8 BitSet,
> - IN UINT8 BitClear,
> - IN UINT32 TimeOut
> - )
> -{
> - UINT8 RegRead;
> - UINT32 WaitTime;
> -
> - for (WaitTime = 0; WaitTime < TimeOut; WaitTime += 30){
> - RegRead = MmioRead8 ((UINTN)Register);
> - if ((RegRead & BitSet) == BitSet && (RegRead & BitClear) == 0)
> - return EFI_SUCCESS;
> - MicroSecondDelay (30);
> - }
> - return EFI_TIMEOUT;
> -}
> -
> -/**
> - Get BurstCount by reading the burstCount field of a TIS regiger
> - in the time of default TIS_TIMEOUT_D.
> -
> - @param[in] TisReg Pointer to TIS register.
> - @param[out] BurstCount Pointer to a buffer to store the
> got BurstConut.
> -
> - @retval EFI_SUCCESS Get BurstCount.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL or BurstCount is
> NULL.
> - @retval EFI_TIMEOUT BurstCount can't be got in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcReadBurstCount (
> - IN TIS_PC_REGISTERS_PTR TisReg,
> - OUT UINT16 *BurstCount
> - )
> -{
> - UINT32 WaitTime;
> - UINT8 DataByte0;
> - UINT8 DataByte1;
> -
> - if (BurstCount == NULL || TisReg == NULL) {
> - return EFI_INVALID_PARAMETER;
> - }
> -
> - WaitTime = 0;
> - do {
> - //
> - // TIS_PC_REGISTERS_PTR->burstCount is UINT16, but it is not 2bytes
> aligned,
> - // so it needs to use MmioRead8 to read two times
> - //
> - DataByte0 = MmioRead8 ((UINTN)&TisReg->BurstCount);
> - DataByte1 = MmioRead8 ((UINTN)&TisReg->BurstCount + 1);
> - *BurstCount = (UINT16)((DataByte1 << 8) + DataByte0);
> - if (*BurstCount != 0) {
> - return EFI_SUCCESS;
> - }
> - MicroSecondDelay (30);
> - WaitTime += 30;
> - } while (WaitTime < TIS_TIMEOUT_D);
> -
> - return EFI_TIMEOUT;
> -}
> -
> -/**
> - Set TPM chip to ready state by sending ready command
> TIS_PC_STS_READY
> - to Status Register in time.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS TPM chip enters into ready state.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_TIMEOUT TPM chip can't be set to ready
> state in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcPrepareCommand (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - )
> -{
> - EFI_STATUS Status;
> -
> - if (TisReg == NULL) {
> - return EFI_INVALID_PARAMETER;
> - }
> -
> - MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY);
> - Status = TisPcWaitRegisterBits (
> - &TisReg->Status,
> - TIS_PC_STS_READY,
> - 0,
> - TIS_TIMEOUT_B
> - );
> - return Status;
> -}
> -
> -/**
> - Get the control of TPM chip by sending requestUse command
> TIS_PC_ACC_RQUUSE
> - to ACCESS Register in the time of default TIS_TIMEOUT_A.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS Get the control of TPM chip.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_NOT_FOUND TPM chip doesn't exit.
> - @retval EFI_TIMEOUT Can't get the TPM control in
> time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcRequestUseTpm (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - )
> -{
> - EFI_STATUS Status;
> -
> - if (TisReg == NULL) {
> - return EFI_INVALID_PARAMETER;
> - }
> -
> - if (!TisPcPresenceCheck (TisReg)) {
> - return EFI_NOT_FOUND;
> - }
> -
> - MmioWrite8((UINTN)&TisReg->Access, TIS_PC_ACC_RQUUSE);
> - //
> - // No locality set before, ACCESS_X.activeLocality MUST be valid within
> TIMEOUT_A
> - //
> - Status = TisPcWaitRegisterBits (
> - &TisReg->Access,
> - (UINT8)(TIS_PC_ACC_ACTIVE |TIS_PC_VALID),
> - 0,
> - TIS_TIMEOUT_A
> - );
> - return Status;
> -}
> diff --git a/SecurityPkg/Library/TpmCommLib/TpmComm.c
> b/SecurityPkg/Library/TpmCommLib/TpmComm.c
> deleted file mode 100644
> index dee64b24ffef..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TpmComm.c
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/** @file
> - Basic TPM command functions.
> -
> -Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#include "CommonHeader.h"
> -
> -/**
> - Single function calculates SHA1 digest value for all raw data. It
> - combines Sha1Init(), Sha1Update() and Sha1Final().
> -
> - @param[in] Data Raw data to be digested.
> - @param[in] DataLen Size of the raw data.
> - @param[out] Digest Pointer to a buffer that stores the final
> digest.
> -
> - @retval EFI_SUCCESS Always successfully calculate the final
> digest.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TpmCommHashAll (
> - IN CONST UINT8 *Data,
> - IN UINTN DataLen,
> - OUT TPM_DIGEST *Digest
> - )
> -{
> - VOID *Sha1Ctx;
> - UINTN CtxSize;
> -
> - CtxSize = Sha1GetContextSize ();
> - Sha1Ctx = AllocatePool (CtxSize);
> - ASSERT (Sha1Ctx != NULL);
> -
> - Sha1Init (Sha1Ctx);
> - Sha1Update (Sha1Ctx, Data, DataLen);
> - Sha1Final (Sha1Ctx, (UINT8 *)Digest);
> -
> - FreePool (Sha1Ctx);
> -
> - return EFI_SUCCESS;
> -}
> -
> diff --git a/SecurityPkg/Include/Library/TpmCommLib.h
> b/SecurityPkg/Include/Library/TpmCommLib.h
> deleted file mode 100644
> index b9aca60b82a0..000000000000
> --- a/SecurityPkg/Include/Library/TpmCommLib.h
> +++ /dev/null
> @@ -1,281 +0,0 @@
> -/** @file
> - This library is only intended to be used by TPM modules.
> - It provides basic TPM Interface Specification (TIS) and Command
> functions.
> -
> -Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#ifndef _TPM_COMM_LIB_H_
> -#define _TPM_COMM_LIB_H_
> -
> -#include <IndustryStandard/Tpm12.h>
> -
> -typedef EFI_HANDLE TIS_TPM_HANDLE;
> -
> -///
> -/// TPM register base address.
> -///
> -#define TPM_BASE_ADDRESS 0xfed40000
> -
> -//
> -// Set structure alignment to 1-byte
> -//
> -#pragma pack (1)
> -
> -//
> -// Register set map as specified in TIS specification Chapter 10
> -//
> -typedef struct {
> - ///
> - /// Used to gain ownership for this particular port.
> - ///
> - UINT8 Access; // 0
> - UINT8 Reserved1[7]; // 1
> - ///
> - /// Controls interrupts.
> - ///
> - UINT32 IntEnable; // 8
> - ///
> - /// SIRQ vector to be used by the TPM.
> - ///
> - UINT8 IntVector; // 0ch
> - UINT8 Reserved2[3]; // 0dh
> - ///
> - /// What caused interrupt.
> - ///
> - UINT32 IntSts; // 10h
> - ///
> - /// Shows which interrupts are supported by that particular TPM.
> - ///
> - UINT32 IntfCapability; // 14h
> - ///
> - /// Status Register. Provides status of the TPM.
> - ///
> - UINT8 Status; // 18h
> - ///
> - /// Number of consecutive writes that can be done to the TPM.
> - ///
> - UINT16 BurstCount; // 19h
> - UINT8 Reserved3[9];
> - ///
> - /// Read or write FIFO, depending on transaction.
> - ///
> - UINT32 DataFifo; // 24
> - UINT8 Reserved4[0xed8]; // 28h
> - ///
> - /// Vendor ID
> - ///
> - UINT16 Vid; //
> 0f00h
> - ///
> - /// Device ID
> - ///
> - UINT16 Did; //
> 0f02h
> - ///
> - /// Revision ID
> - ///
> - UINT8 Rid; //
> 0f04h
> - ///
> - /// TCG defined configuration registers.
> - ///
> - UINT8 TcgDefined[0x7b]; // 0f05h
> - ///
> - /// Alias to I/O legacy space.
> - ///
> - UINT32 LegacyAddress1; // 0f80h
> - ///
> - /// Additional 8 bits for I/O legacy space extension.
> - ///
> - UINT32 LegacyAddress1Ex; // 0f84h
> - ///
> - /// Alias to second I/O legacy space.
> - ///
> - UINT32 LegacyAddress2; // 0f88h
> - ///
> - /// Additional 8 bits for second I/O legacy space extension.
> - ///
> - UINT32 LegacyAddress2Ex; // 0f8ch
> - ///
> - /// Vendor-defined configuration registers.
> - ///
> - UINT8 VendorDefined[0x70];// 0f90h
> -} TIS_PC_REGISTERS;
> -
> -//
> -// Restore original structure alignment
> -//
> -#pragma pack ()
> -
> -//
> -// Define pointer types used to access TIS registers on PC
> -//
> -typedef TIS_PC_REGISTERS *TIS_PC_REGISTERS_PTR;
> -
> -//
> -// TCG Platform Type based on TCG ACPI Specification Version 1.00
> -//
> -#define TCG_PLATFORM_TYPE_CLIENT 0
> -#define TCG_PLATFORM_TYPE_SERVER 1
> -
> -//
> -// Define bits of ACCESS and STATUS registers
> -//
> -
> -///
> -/// This bit is a 1 to indicate that the other bits in this register are valid.
> -///
> -#define TIS_PC_VALID BIT7
> -///
> -/// Indicate that this locality is active.
> -///
> -#define TIS_PC_ACC_ACTIVE BIT5
> -///
> -/// Set to 1 to indicate that this locality had the TPM taken away while
> -/// this locality had the TIS_PC_ACC_ACTIVE bit set.
> -///
> -#define TIS_PC_ACC_SEIZED BIT4
> -///
> -/// Set to 1 to indicate that TPM MUST reset the
> -/// TIS_PC_ACC_ACTIVE bit and remove ownership for localities less than
> the
> -/// locality that is writing this bit.
> -///
> -#define TIS_PC_ACC_SEIZE BIT3
> -///
> -/// When this bit is 1, another locality is requesting usage of the TPM.
> -///
> -#define TIS_PC_ACC_PENDIND BIT2
> -///
> -/// Set to 1 to indicate that this locality is requesting to use TPM.
> -///
> -#define TIS_PC_ACC_RQUUSE BIT1
> -///
> -/// A value of 1 indicates that a T/OS has not been established on the
> platform
> -///
> -#define TIS_PC_ACC_ESTABLISH BIT0
> -
> -///
> -/// When this bit is 1, TPM is in the Ready state,
> -/// indicating it is ready to receive a new command.
> -///
> -#define TIS_PC_STS_READY BIT6
> -///
> -/// Write a 1 to this bit to cause the TPM to execute that command.
> -///
> -#define TIS_PC_STS_GO BIT5
> -///
> -/// This bit indicates that the TPM has data available as a response.
> -///
> -#define TIS_PC_STS_DATA BIT4
> -///
> -/// The TPM sets this bit to a value of 1 when it expects another byte of
> data for a command.
> -///
> -#define TIS_PC_STS_EXPECT BIT3
> -///
> -/// Writes a 1 to this bit to force the TPM to re-send the response.
> -///
> -#define TIS_PC_STS_RETRY BIT1
> -
> -//
> -// Default TimeOut value
> -//
> -#define TIS_TIMEOUT_A 750 * 1000 // 750ms
> -#define TIS_TIMEOUT_B 2000 * 1000 // 2s
> -#define TIS_TIMEOUT_C 750 * 1000 // 750ms
> -#define TIS_TIMEOUT_D 750 * 1000 // 750ms
> -
> -//
> -// Max TPM command/reponse length
> -//
> -#define TPMCMDBUFLENGTH 1024
> -
> -/**
> - Check whether the value of a TPM chip register satisfies the input BIT
> setting.
> -
> - @param[in] Register Address port of register to be checked.
> - @param[in] BitSet Check these data bits are set.
> - @param[in] BitClear Check these data bits are clear.
> - @param[in] TimeOut The max wait time (unit MicroSecond)
> when checking register.
> -
> - @retval EFI_SUCCESS The register satisfies the check bit.
> - @retval EFI_TIMEOUT The register can't run into the expected
> status in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcWaitRegisterBits (
> - IN UINT8 *Register,
> - IN UINT8 BitSet,
> - IN UINT8 BitClear,
> - IN UINT32 TimeOut
> - );
> -
> -/**
> - Get BurstCount by reading the burstCount field of a TIS regiger
> - in the time of default TIS_TIMEOUT_D.
> -
> - @param[in] TisReg Pointer to TIS register.
> - @param[out] BurstCount Pointer to a buffer to store the
> got BurstConut.
> -
> - @retval EFI_SUCCESS Get BurstCount.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL or BurstCount is
> NULL.
> - @retval EFI_TIMEOUT BurstCount can't be got in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcReadBurstCount (
> - IN TIS_PC_REGISTERS_PTR TisReg,
> - OUT UINT16 *BurstCount
> - );
> -
> -/**
> - Set TPM chip to ready state by sending ready command
> TIS_PC_STS_READY
> - to Status Register in time.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS TPM chip enters into ready state.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_TIMEOUT TPM chip can't be set to ready
> state in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcPrepareCommand (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - );
> -
> -/**
> - Get the control of TPM chip by sending requestUse command
> TIS_PC_ACC_RQUUSE
> - to ACCESS Register in the time of default TIS_TIMEOUT_D.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS Get the control of TPM chip.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_NOT_FOUND TPM chip doesn't exit.
> - @retval EFI_TIMEOUT Can't get the TPM control in
> time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcRequestUseTpm (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - );
> -
> -/**
> - Single function calculates SHA1 digest value for all raw data. It
> - combines Sha1Init(), Sha1Update() and Sha1Final().
> -
> - @param[in] Data Raw data to be digested.
> - @param[in] DataLen Size of the raw data.
> - @param[out] Digest Pointer to a buffer that stores the final
> digest.
> -
> - @retval EFI_SUCCESS Always successfully calculate the final
> digest.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TpmCommHashAll (
> - IN CONST UINT8 *Data,
> - IN UINTN DataLen,
> - OUT TPM_DIGEST *Digest
> - );
> -
> -#endif
> diff --git a/SecurityPkg/Library/TpmCommLib/CommonHeader.h
> b/SecurityPkg/Library/TpmCommLib/CommonHeader.h
> deleted file mode 100644
> index 386c9fab44d9..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/CommonHeader.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/** @file
> - The intenal header file for TpmCommLib.
> -
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#ifndef _TPMCOMMLIB_COMMON_HEADER_H_
> -#define _TPMCOMMLIB_COMMON_HEADER_H_
> -
> -#include <PiPei.h>
> -#include <IndustryStandard/Tpm12.h>
> -#include <Library/BaseLib.h>
> -#include <Library/BaseMemoryLib.h>
> -#include <Library/IoLib.h>
> -#include <Library/TimerLib.h>
> -#include <Library/TpmCommLib.h>
> -#include <Library/BaseCryptLib.h>
> -#include <Library/MemoryAllocationLib.h>
> -#include <Library/DebugLib.h>
> -
> -#endif
> diff --git a/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> b/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> deleted file mode 100644
> index 4caabd496f59..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -## @file
> -# Provides some common functions for the TCG feature
> -#
> -# This instance provides basic TPM Interface Specification (TIS) functions
> -# and TPM hashall function.
> -#
> -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> -# SPDX-License-Identifier: BSD-2-Clause-Patent
> -#
> -##
> -
> -[Defines]
> - INF_VERSION = 0x00010005
> - BASE_NAME = TpmCommLib
> - MODULE_UNI_FILE = TpmCommLib.uni
> - FILE_GUID =
> 7d9fe32e-a6a9-4cdf-abff-10cc7f22e1c9
> - MODULE_TYPE = PEIM
> - VERSION_STRING = 1.0
> - LIBRARY_CLASS = TpmCommLib|DXE_DRIVER
> UEFI_DRIVER PEIM DXE_SMM_DRIVER
> -
> -#
> -# The following information is for reference only and not required by the
> build tools.
> -#
> -# VALID_ARCHITECTURES = IA32 X64
> -#
> -
> -[Sources]
> - TisPc.c
> - TpmComm.c
> - CommonHeader.h
> -
> -[Packages]
> - MdePkg/MdePkg.dec
> - SecurityPkg/SecurityPkg.dec
> - CryptoPkg/CryptoPkg.dec
> -
> -[LibraryClasses]
> - BaseLib
> - BaseMemoryLib
> - IoLib
> - TimerLib
> - BaseCryptLib
> - MemoryAllocationLib
> - DebugLib
> -
> diff --git a/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
> b/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
> deleted file mode 100644
> index 96194551be88..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -// /** @file
> -// Provides some common functions for the TCG feature
> -//
> -// This instance provides basic TPM Interface Specification (TIS) functions
> -// and TPM hashall function.
> -//
> -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
> -//
> -// SPDX-License-Identifier: BSD-2-Clause-Patent
> -//
> -// **/
> -
> -
> -#string STR_MODULE_ABSTRACT #language en-US
> "Provides some common functions for the TCG feature"
> -
> -#string STR_MODULE_DESCRIPTION #language en-US "This
> instance provides basic TPM Interface Specification (TIS) functions and TPM
> hashall function."
> -
> diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec
> index ce2a9d33a4f2..3511cfb2cb85 100644
> --- a/SecurityPkg/SecurityPkg.dec
> +++ b/SecurityPkg/SecurityPkg.dec
> @@ -55,10 +55,6 @@ [LibraryClasses]
> #
> Tpm12DeviceLib|Include/Library/Tpm12DeviceLib.h
>
> - ## @libraryclass Provides TPM Interface Specification (TIS) interfaces
> for TPM command.
> - #
> - TpmCommLib|Include/Library/TpmCommLib.h
> -
> ## @libraryclass Provides support for TCG Physical Presence
> Interface (PPI) specification
> # >= 128 Vendor Specific PPI Operation.
> #
> diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
> index aef2ac3a208d..e2ac1e4a9e1c 100644
> --- a/SecurityPkg/SecurityPkg.dsc
> +++ b/SecurityPkg/SecurityPkg.dsc
> @@ -47,7 +47,6 @@ [LibraryClasses]
> IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
> - TpmCommLib|SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
>
> PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecu
> reLibNull.inf
>
> TcgPhysicalPresenceLib|SecurityPkg/Library/DxeTcgPhysicalPresenceLib/Dxe
> TcgPhysicalPresenceLib.inf
>
> TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpm
> MeasurementLib.inf
> @@ -155,7 +154,6 @@ [Components]
> # TPM
> #
>
> SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf
> - SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
>
> SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.
> inf
> SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
> SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] SecurityPkg/TpmCommLib: Remove TpmCommLib
2019-08-05 5:55 [PATCH 1/1] SecurityPkg/TpmCommLib: Remove TpmCommLib Zhang, Shenglei
2019-08-05 6:17 ` Yao, Jiewen
@ 2019-08-05 9:01 ` Wang, Jian J
1 sibling, 0 replies; 3+ messages in thread
From: Wang, Jian J @ 2019-08-05 9:01 UTC (permalink / raw)
To: devel@edk2.groups.io, Zhang, Shenglei; +Cc: Yao, Jiewen, Zhang, Chao B
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Monday, August 05, 2019 1:55 PM
> To: devel@edk2.groups.io
> Cc: Zhang, Shenglei <shenglei.zhang@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Zhang,
> Chao B <chao.b.zhang@intel.com>
> Subject: [edk2-devel] [PATCH 1/1] SecurityPkg/TpmCommLib: Remove
> TpmCommLib
>
> From: shenglei <shenglei.zhang@intel.com>
>
> TpmCommonLib is no longer used by TcgPei/TcgDxe/Tcg2ConfigPei
> modules. So TpmCommLib can be removed.
>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian Wang <jian.j.wang@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> SecurityPkg/Library/TpmCommLib/TisPc.c | 177 -----------
> SecurityPkg/Library/TpmCommLib/TpmComm.c | 44 ---
> SecurityPkg/Include/Library/TpmCommLib.h | 281 ------------------
> SecurityPkg/Library/TpmCommLib/CommonHeader.h | 23 --
> SecurityPkg/Library/TpmCommLib/TpmCommLib.inf | 45 ---
> SecurityPkg/Library/TpmCommLib/TpmCommLib.uni | 17 --
> SecurityPkg/SecurityPkg.dec | 4 -
> SecurityPkg/SecurityPkg.dsc | 2 -
> 8 files changed, 593 deletions(-)
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TisPc.c
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmComm.c
> delete mode 100644 SecurityPkg/Include/Library/TpmCommLib.h
> delete mode 100644 SecurityPkg/Library/TpmCommLib/CommonHeader.h
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
>
> diff --git a/SecurityPkg/Library/TpmCommLib/TisPc.c
> b/SecurityPkg/Library/TpmCommLib/TisPc.c
> deleted file mode 100644
> index 162e883d2170..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TisPc.c
> +++ /dev/null
> @@ -1,177 +0,0 @@
> -/** @file
> - Basic TIS (TPM Interface Specification) functions.
> -
> -Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#include "CommonHeader.h"
> -
> -/**
> - Check whether TPM chip exist.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval TRUE TPM chip exists.
> - @retval FALSE TPM chip is not found.
> -**/
> -BOOLEAN
> -TisPcPresenceCheck (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - )
> -{
> - UINT8 RegRead;
> -
> - RegRead = MmioRead8 ((UINTN)&TisReg->Access);
> - return (BOOLEAN)(RegRead != (UINT8)-1);
> -}
> -
> -/**
> - Check whether the value of a TPM chip register satisfies the input BIT
> setting.
> -
> - @param[in] Register Address port of register to be checked.
> - @param[in] BitSet Check these data bits are set.
> - @param[in] BitClear Check these data bits are clear.
> - @param[in] TimeOut The max wait time (unit MicroSecond) when
> checking register.
> -
> - @retval EFI_SUCCESS The register satisfies the check bit.
> - @retval EFI_TIMEOUT The register can't run into the expected status in
> time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcWaitRegisterBits (
> - IN UINT8 *Register,
> - IN UINT8 BitSet,
> - IN UINT8 BitClear,
> - IN UINT32 TimeOut
> - )
> -{
> - UINT8 RegRead;
> - UINT32 WaitTime;
> -
> - for (WaitTime = 0; WaitTime < TimeOut; WaitTime += 30){
> - RegRead = MmioRead8 ((UINTN)Register);
> - if ((RegRead & BitSet) == BitSet && (RegRead & BitClear) == 0)
> - return EFI_SUCCESS;
> - MicroSecondDelay (30);
> - }
> - return EFI_TIMEOUT;
> -}
> -
> -/**
> - Get BurstCount by reading the burstCount field of a TIS regiger
> - in the time of default TIS_TIMEOUT_D.
> -
> - @param[in] TisReg Pointer to TIS register.
> - @param[out] BurstCount Pointer to a buffer to store the got
> BurstConut.
> -
> - @retval EFI_SUCCESS Get BurstCount.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL or BurstCount is NULL.
> - @retval EFI_TIMEOUT BurstCount can't be got in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcReadBurstCount (
> - IN TIS_PC_REGISTERS_PTR TisReg,
> - OUT UINT16 *BurstCount
> - )
> -{
> - UINT32 WaitTime;
> - UINT8 DataByte0;
> - UINT8 DataByte1;
> -
> - if (BurstCount == NULL || TisReg == NULL) {
> - return EFI_INVALID_PARAMETER;
> - }
> -
> - WaitTime = 0;
> - do {
> - //
> - // TIS_PC_REGISTERS_PTR->burstCount is UINT16, but it is not 2bytes
> aligned,
> - // so it needs to use MmioRead8 to read two times
> - //
> - DataByte0 = MmioRead8 ((UINTN)&TisReg->BurstCount);
> - DataByte1 = MmioRead8 ((UINTN)&TisReg->BurstCount + 1);
> - *BurstCount = (UINT16)((DataByte1 << 8) + DataByte0);
> - if (*BurstCount != 0) {
> - return EFI_SUCCESS;
> - }
> - MicroSecondDelay (30);
> - WaitTime += 30;
> - } while (WaitTime < TIS_TIMEOUT_D);
> -
> - return EFI_TIMEOUT;
> -}
> -
> -/**
> - Set TPM chip to ready state by sending ready command
> TIS_PC_STS_READY
> - to Status Register in time.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS TPM chip enters into ready state.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_TIMEOUT TPM chip can't be set to ready state in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcPrepareCommand (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - )
> -{
> - EFI_STATUS Status;
> -
> - if (TisReg == NULL) {
> - return EFI_INVALID_PARAMETER;
> - }
> -
> - MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY);
> - Status = TisPcWaitRegisterBits (
> - &TisReg->Status,
> - TIS_PC_STS_READY,
> - 0,
> - TIS_TIMEOUT_B
> - );
> - return Status;
> -}
> -
> -/**
> - Get the control of TPM chip by sending requestUse command
> TIS_PC_ACC_RQUUSE
> - to ACCESS Register in the time of default TIS_TIMEOUT_A.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS Get the control of TPM chip.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_NOT_FOUND TPM chip doesn't exit.
> - @retval EFI_TIMEOUT Can't get the TPM control in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcRequestUseTpm (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - )
> -{
> - EFI_STATUS Status;
> -
> - if (TisReg == NULL) {
> - return EFI_INVALID_PARAMETER;
> - }
> -
> - if (!TisPcPresenceCheck (TisReg)) {
> - return EFI_NOT_FOUND;
> - }
> -
> - MmioWrite8((UINTN)&TisReg->Access, TIS_PC_ACC_RQUUSE);
> - //
> - // No locality set before, ACCESS_X.activeLocality MUST be valid within
> TIMEOUT_A
> - //
> - Status = TisPcWaitRegisterBits (
> - &TisReg->Access,
> - (UINT8)(TIS_PC_ACC_ACTIVE |TIS_PC_VALID),
> - 0,
> - TIS_TIMEOUT_A
> - );
> - return Status;
> -}
> diff --git a/SecurityPkg/Library/TpmCommLib/TpmComm.c
> b/SecurityPkg/Library/TpmCommLib/TpmComm.c
> deleted file mode 100644
> index dee64b24ffef..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TpmComm.c
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/** @file
> - Basic TPM command functions.
> -
> -Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#include "CommonHeader.h"
> -
> -/**
> - Single function calculates SHA1 digest value for all raw data. It
> - combines Sha1Init(), Sha1Update() and Sha1Final().
> -
> - @param[in] Data Raw data to be digested.
> - @param[in] DataLen Size of the raw data.
> - @param[out] Digest Pointer to a buffer that stores the final digest.
> -
> - @retval EFI_SUCCESS Always successfully calculate the final digest.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TpmCommHashAll (
> - IN CONST UINT8 *Data,
> - IN UINTN DataLen,
> - OUT TPM_DIGEST *Digest
> - )
> -{
> - VOID *Sha1Ctx;
> - UINTN CtxSize;
> -
> - CtxSize = Sha1GetContextSize ();
> - Sha1Ctx = AllocatePool (CtxSize);
> - ASSERT (Sha1Ctx != NULL);
> -
> - Sha1Init (Sha1Ctx);
> - Sha1Update (Sha1Ctx, Data, DataLen);
> - Sha1Final (Sha1Ctx, (UINT8 *)Digest);
> -
> - FreePool (Sha1Ctx);
> -
> - return EFI_SUCCESS;
> -}
> -
> diff --git a/SecurityPkg/Include/Library/TpmCommLib.h
> b/SecurityPkg/Include/Library/TpmCommLib.h
> deleted file mode 100644
> index b9aca60b82a0..000000000000
> --- a/SecurityPkg/Include/Library/TpmCommLib.h
> +++ /dev/null
> @@ -1,281 +0,0 @@
> -/** @file
> - This library is only intended to be used by TPM modules.
> - It provides basic TPM Interface Specification (TIS) and Command functions.
> -
> -Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#ifndef _TPM_COMM_LIB_H_
> -#define _TPM_COMM_LIB_H_
> -
> -#include <IndustryStandard/Tpm12.h>
> -
> -typedef EFI_HANDLE TIS_TPM_HANDLE;
> -
> -///
> -/// TPM register base address.
> -///
> -#define TPM_BASE_ADDRESS 0xfed40000
> -
> -//
> -// Set structure alignment to 1-byte
> -//
> -#pragma pack (1)
> -
> -//
> -// Register set map as specified in TIS specification Chapter 10
> -//
> -typedef struct {
> - ///
> - /// Used to gain ownership for this particular port.
> - ///
> - UINT8 Access; // 0
> - UINT8 Reserved1[7]; // 1
> - ///
> - /// Controls interrupts.
> - ///
> - UINT32 IntEnable; // 8
> - ///
> - /// SIRQ vector to be used by the TPM.
> - ///
> - UINT8 IntVector; // 0ch
> - UINT8 Reserved2[3]; // 0dh
> - ///
> - /// What caused interrupt.
> - ///
> - UINT32 IntSts; // 10h
> - ///
> - /// Shows which interrupts are supported by that particular TPM.
> - ///
> - UINT32 IntfCapability; // 14h
> - ///
> - /// Status Register. Provides status of the TPM.
> - ///
> - UINT8 Status; // 18h
> - ///
> - /// Number of consecutive writes that can be done to the TPM.
> - ///
> - UINT16 BurstCount; // 19h
> - UINT8 Reserved3[9];
> - ///
> - /// Read or write FIFO, depending on transaction.
> - ///
> - UINT32 DataFifo; // 24
> - UINT8 Reserved4[0xed8]; // 28h
> - ///
> - /// Vendor ID
> - ///
> - UINT16 Vid; // 0f00h
> - ///
> - /// Device ID
> - ///
> - UINT16 Did; // 0f02h
> - ///
> - /// Revision ID
> - ///
> - UINT8 Rid; // 0f04h
> - ///
> - /// TCG defined configuration registers.
> - ///
> - UINT8 TcgDefined[0x7b]; // 0f05h
> - ///
> - /// Alias to I/O legacy space.
> - ///
> - UINT32 LegacyAddress1; // 0f80h
> - ///
> - /// Additional 8 bits for I/O legacy space extension.
> - ///
> - UINT32 LegacyAddress1Ex; // 0f84h
> - ///
> - /// Alias to second I/O legacy space.
> - ///
> - UINT32 LegacyAddress2; // 0f88h
> - ///
> - /// Additional 8 bits for second I/O legacy space extension.
> - ///
> - UINT32 LegacyAddress2Ex; // 0f8ch
> - ///
> - /// Vendor-defined configuration registers.
> - ///
> - UINT8 VendorDefined[0x70];// 0f90h
> -} TIS_PC_REGISTERS;
> -
> -//
> -// Restore original structure alignment
> -//
> -#pragma pack ()
> -
> -//
> -// Define pointer types used to access TIS registers on PC
> -//
> -typedef TIS_PC_REGISTERS *TIS_PC_REGISTERS_PTR;
> -
> -//
> -// TCG Platform Type based on TCG ACPI Specification Version 1.00
> -//
> -#define TCG_PLATFORM_TYPE_CLIENT 0
> -#define TCG_PLATFORM_TYPE_SERVER 1
> -
> -//
> -// Define bits of ACCESS and STATUS registers
> -//
> -
> -///
> -/// This bit is a 1 to indicate that the other bits in this register are valid.
> -///
> -#define TIS_PC_VALID BIT7
> -///
> -/// Indicate that this locality is active.
> -///
> -#define TIS_PC_ACC_ACTIVE BIT5
> -///
> -/// Set to 1 to indicate that this locality had the TPM taken away while
> -/// this locality had the TIS_PC_ACC_ACTIVE bit set.
> -///
> -#define TIS_PC_ACC_SEIZED BIT4
> -///
> -/// Set to 1 to indicate that TPM MUST reset the
> -/// TIS_PC_ACC_ACTIVE bit and remove ownership for localities less than
> the
> -/// locality that is writing this bit.
> -///
> -#define TIS_PC_ACC_SEIZE BIT3
> -///
> -/// When this bit is 1, another locality is requesting usage of the TPM.
> -///
> -#define TIS_PC_ACC_PENDIND BIT2
> -///
> -/// Set to 1 to indicate that this locality is requesting to use TPM.
> -///
> -#define TIS_PC_ACC_RQUUSE BIT1
> -///
> -/// A value of 1 indicates that a T/OS has not been established on the
> platform
> -///
> -#define TIS_PC_ACC_ESTABLISH BIT0
> -
> -///
> -/// When this bit is 1, TPM is in the Ready state,
> -/// indicating it is ready to receive a new command.
> -///
> -#define TIS_PC_STS_READY BIT6
> -///
> -/// Write a 1 to this bit to cause the TPM to execute that command.
> -///
> -#define TIS_PC_STS_GO BIT5
> -///
> -/// This bit indicates that the TPM has data available as a response.
> -///
> -#define TIS_PC_STS_DATA BIT4
> -///
> -/// The TPM sets this bit to a value of 1 when it expects another byte of
> data for a command.
> -///
> -#define TIS_PC_STS_EXPECT BIT3
> -///
> -/// Writes a 1 to this bit to force the TPM to re-send the response.
> -///
> -#define TIS_PC_STS_RETRY BIT1
> -
> -//
> -// Default TimeOut value
> -//
> -#define TIS_TIMEOUT_A 750 * 1000 // 750ms
> -#define TIS_TIMEOUT_B 2000 * 1000 // 2s
> -#define TIS_TIMEOUT_C 750 * 1000 // 750ms
> -#define TIS_TIMEOUT_D 750 * 1000 // 750ms
> -
> -//
> -// Max TPM command/reponse length
> -//
> -#define TPMCMDBUFLENGTH 1024
> -
> -/**
> - Check whether the value of a TPM chip register satisfies the input BIT
> setting.
> -
> - @param[in] Register Address port of register to be checked.
> - @param[in] BitSet Check these data bits are set.
> - @param[in] BitClear Check these data bits are clear.
> - @param[in] TimeOut The max wait time (unit MicroSecond) when
> checking register.
> -
> - @retval EFI_SUCCESS The register satisfies the check bit.
> - @retval EFI_TIMEOUT The register can't run into the expected status in
> time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcWaitRegisterBits (
> - IN UINT8 *Register,
> - IN UINT8 BitSet,
> - IN UINT8 BitClear,
> - IN UINT32 TimeOut
> - );
> -
> -/**
> - Get BurstCount by reading the burstCount field of a TIS regiger
> - in the time of default TIS_TIMEOUT_D.
> -
> - @param[in] TisReg Pointer to TIS register.
> - @param[out] BurstCount Pointer to a buffer to store the got
> BurstConut.
> -
> - @retval EFI_SUCCESS Get BurstCount.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL or BurstCount is NULL.
> - @retval EFI_TIMEOUT BurstCount can't be got in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcReadBurstCount (
> - IN TIS_PC_REGISTERS_PTR TisReg,
> - OUT UINT16 *BurstCount
> - );
> -
> -/**
> - Set TPM chip to ready state by sending ready command
> TIS_PC_STS_READY
> - to Status Register in time.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS TPM chip enters into ready state.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_TIMEOUT TPM chip can't be set to ready state in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcPrepareCommand (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - );
> -
> -/**
> - Get the control of TPM chip by sending requestUse command
> TIS_PC_ACC_RQUUSE
> - to ACCESS Register in the time of default TIS_TIMEOUT_D.
> -
> - @param[in] TisReg Pointer to TIS register.
> -
> - @retval EFI_SUCCESS Get the control of TPM chip.
> - @retval EFI_INVALID_PARAMETER TisReg is NULL.
> - @retval EFI_NOT_FOUND TPM chip doesn't exit.
> - @retval EFI_TIMEOUT Can't get the TPM control in time.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TisPcRequestUseTpm (
> - IN TIS_PC_REGISTERS_PTR TisReg
> - );
> -
> -/**
> - Single function calculates SHA1 digest value for all raw data. It
> - combines Sha1Init(), Sha1Update() and Sha1Final().
> -
> - @param[in] Data Raw data to be digested.
> - @param[in] DataLen Size of the raw data.
> - @param[out] Digest Pointer to a buffer that stores the final digest.
> -
> - @retval EFI_SUCCESS Always successfully calculate the final digest.
> -**/
> -EFI_STATUS
> -EFIAPI
> -TpmCommHashAll (
> - IN CONST UINT8 *Data,
> - IN UINTN DataLen,
> - OUT TPM_DIGEST *Digest
> - );
> -
> -#endif
> diff --git a/SecurityPkg/Library/TpmCommLib/CommonHeader.h
> b/SecurityPkg/Library/TpmCommLib/CommonHeader.h
> deleted file mode 100644
> index 386c9fab44d9..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/CommonHeader.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/** @file
> - The intenal header file for TpmCommLib.
> -
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#ifndef _TPMCOMMLIB_COMMON_HEADER_H_
> -#define _TPMCOMMLIB_COMMON_HEADER_H_
> -
> -#include <PiPei.h>
> -#include <IndustryStandard/Tpm12.h>
> -#include <Library/BaseLib.h>
> -#include <Library/BaseMemoryLib.h>
> -#include <Library/IoLib.h>
> -#include <Library/TimerLib.h>
> -#include <Library/TpmCommLib.h>
> -#include <Library/BaseCryptLib.h>
> -#include <Library/MemoryAllocationLib.h>
> -#include <Library/DebugLib.h>
> -
> -#endif
> diff --git a/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> b/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> deleted file mode 100644
> index 4caabd496f59..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -## @file
> -# Provides some common functions for the TCG feature
> -#
> -# This instance provides basic TPM Interface Specification (TIS) functions
> -# and TPM hashall function.
> -#
> -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> -# SPDX-License-Identifier: BSD-2-Clause-Patent
> -#
> -##
> -
> -[Defines]
> - INF_VERSION = 0x00010005
> - BASE_NAME = TpmCommLib
> - MODULE_UNI_FILE = TpmCommLib.uni
> - FILE_GUID = 7d9fe32e-a6a9-4cdf-abff-10cc7f22e1c9
> - MODULE_TYPE = PEIM
> - VERSION_STRING = 1.0
> - LIBRARY_CLASS = TpmCommLib|DXE_DRIVER UEFI_DRIVER
> PEIM DXE_SMM_DRIVER
> -
> -#
> -# The following information is for reference only and not required by the
> build tools.
> -#
> -# VALID_ARCHITECTURES = IA32 X64
> -#
> -
> -[Sources]
> - TisPc.c
> - TpmComm.c
> - CommonHeader.h
> -
> -[Packages]
> - MdePkg/MdePkg.dec
> - SecurityPkg/SecurityPkg.dec
> - CryptoPkg/CryptoPkg.dec
> -
> -[LibraryClasses]
> - BaseLib
> - BaseMemoryLib
> - IoLib
> - TimerLib
> - BaseCryptLib
> - MemoryAllocationLib
> - DebugLib
> -
> diff --git a/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
> b/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
> deleted file mode 100644
> index 96194551be88..000000000000
> --- a/SecurityPkg/Library/TpmCommLib/TpmCommLib.uni
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -// /** @file
> -// Provides some common functions for the TCG feature
> -//
> -// This instance provides basic TPM Interface Specification (TIS) functions
> -// and TPM hashall function.
> -//
> -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
> -//
> -// SPDX-License-Identifier: BSD-2-Clause-Patent
> -//
> -// **/
> -
> -
> -#string STR_MODULE_ABSTRACT #language en-US "Provides some
> common functions for the TCG feature"
> -
> -#string STR_MODULE_DESCRIPTION #language en-US "This instance
> provides basic TPM Interface Specification (TIS) functions and TPM hashall
> function."
> -
> diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec
> index ce2a9d33a4f2..3511cfb2cb85 100644
> --- a/SecurityPkg/SecurityPkg.dec
> +++ b/SecurityPkg/SecurityPkg.dec
> @@ -55,10 +55,6 @@ [LibraryClasses]
> #
> Tpm12DeviceLib|Include/Library/Tpm12DeviceLib.h
>
> - ## @libraryclass Provides TPM Interface Specification (TIS) interfaces for
> TPM command.
> - #
> - TpmCommLib|Include/Library/TpmCommLib.h
> -
> ## @libraryclass Provides support for TCG Physical Presence Interface
> (PPI) specification
> # >= 128 Vendor Specific PPI Operation.
> #
> diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
> index aef2ac3a208d..e2ac1e4a9e1c 100644
> --- a/SecurityPkg/SecurityPkg.dsc
> +++ b/SecurityPkg/SecurityPkg.dsc
> @@ -47,7 +47,6 @@ [LibraryClasses]
> IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
> - TpmCommLib|SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
>
> PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSec
> ureLibNull.inf
>
> TcgPhysicalPresenceLib|SecurityPkg/Library/DxeTcgPhysicalPresenceLib/Dx
> eTcgPhysicalPresenceLib.inf
>
> TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTp
> mMeasurementLib.inf
> @@ -155,7 +154,6 @@ [Components]
> # TPM
> #
> SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf
> - SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
>
> SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.
> inf
> SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
> SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
> --
> 2.18.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-05 9:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-05 5:55 [PATCH 1/1] SecurityPkg/TpmCommLib: Remove TpmCommLib Zhang, Shenglei
2019-08-05 6:17 ` Yao, Jiewen
2019-08-05 9:01 ` [edk2-devel] " Wang, Jian J
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox