From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.369.1587358757380769895 for ; Sun, 19 Apr 2020 21:59:17 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: jiewen.yao@intel.com) IronPort-SDR: H54r48P9vv5nWj0syzSQIMy0NHbyMXWqAJUBVGOC9j3jMMpLieQjC7ThGn+jGCVPW9LSvqjO8g fOYfNer6LEQA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2020 21:59:16 -0700 IronPort-SDR: Lalq+tg3QzTipOHIgaK+DSWnkjZzKsst5xNZdv/iihG7tF5SIzgZ3u8SL55LgUokVnbuiEZQ0D YhN+J5KbgWkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,405,1580803200"; d="scan'208";a="288269492" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga008.jf.intel.com with ESMTP; 19 Apr 2020 21:59:16 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Apr 2020 21:59:15 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.138]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.89]) with mapi id 14.03.0439.000; Mon, 20 Apr 2020 12:59:11 +0800 From: "Yao, Jiewen" To: "Zhang, Shenglei" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Zhang, Chao B" Subject: Re: [PATCH] SecurityPkg/TpmCommLib: Remove TpmCommLib Thread-Topic: [PATCH] SecurityPkg/TpmCommLib: Remove TpmCommLib Thread-Index: AQHWFr80YfCBrRnD30Whauc/plLWd6iBc05g Date: Mon, 20 Apr 2020 04:59:10 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F9F2EF4@shsmsx102.ccr.corp.intel.com> References: <20200420025523.38500-1-shenglei.zhang@intel.com> In-Reply-To: <20200420025523.38500-1-shenglei.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jiewen.yao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: Zhang, Shenglei > Sent: Monday, April 20, 2020 10:55 AM > To: devel@edk2.groups.io > Cc: Yao, Jiewen ; Wang, Jian J ; > Zhang, Chao B > Subject: [PATCH] SecurityPkg/TpmCommLib: Remove TpmCommLib >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1321 > TpmCommLib is no longer used by TcgPei/TcgDxe/Tcg2ConfigPei modules. > So it can be removed from SecurityPkg. >=20 > Cc: Jiewen Yao > Cc: Jian J Wang > Cc: Chao Zhang > Signed-off-by: Shenglei Zhang > --- > SecurityPkg/Library/TpmCommLib/TisPc.c | 177 ------------------ > SecurityPkg/Library/TpmCommLib/TpmComm.c | 44 ----- > SecurityPkg/Library/TpmCommLib/CommonHeader.h | 23 --- > SecurityPkg/Library/TpmCommLib/TpmCommLib.inf | 45 ----- > SecurityPkg/Library/TpmCommLib/TpmCommLib.uni | 17 -- > SecurityPkg/SecurityPkg.dec | 6 +- > SecurityPkg/SecurityPkg.dsc | 4 +- > 7 files changed, 2 insertions(+), 314 deletions(-) > delete mode 100644 SecurityPkg/Library/TpmCommLib/TisPc.c > delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmComm.c > delete mode 100644 SecurityPkg/Library/TpmCommLib/CommonHeader.h > delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.inf > delete mode 100644 SecurityPkg/Library/TpmCommLib/TpmCommLib.uni >=20 > diff --git a/SecurityPkg/Library/TpmCommLib/TisPc.c > b/SecurityPkg/Library/TpmCommLib/TisPc.c > deleted file mode 100644 > index 533a42e53cee..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.
> -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 =3D MmioRead8 ((UINTN)&TisReg->Access); > - return (BOOLEAN)(RegRead !=3D (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 che= cking > register. > - > - @retval EFI_SUCCESS The register satisfies the check bit. > - @retval EFI_TIMEOUT The register can't run into the expected stat= us in > time. > -**/ > -EFI_STATUS > -EFIAPI > -TisPcWaitRegisterBits ( > - IN UINT8 *Register, > - IN UINT8 BitSet, > - IN UINT8 BitClear, > - IN UINT32 TimeOut > - ) > -{ > - UINT8 RegRead; > - UINT32 WaitTime; > - > - for (WaitTime =3D 0; WaitTime < TimeOut; WaitTime +=3D 30){ > - RegRead =3D MmioRead8 ((UINTN)Register); > - if ((RegRead & BitSet) =3D=3D BitSet && (RegRead & BitClear) =3D=3D = 0) > - return EFI_SUCCESS; > - MicroSecondDelay (30); > - } > - return EFI_TIMEOUT; > -} > - > -/** > - Get BurstCount by reading the burstCount field of a TIS register > - 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= BurstCount. > - > - @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 =3D=3D NULL || TisReg =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - WaitTime =3D 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 =3D MmioRead8 ((UINTN)&TisReg->BurstCount); > - DataByte1 =3D MmioRead8 ((UINTN)&TisReg->BurstCount + 1); > - *BurstCount =3D (UINT16)((DataByte1 << 8) + DataByte0); > - if (*BurstCount !=3D 0) { > - return EFI_SUCCESS; > - } > - MicroSecondDelay (30); > - WaitTime +=3D 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 =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY); > - Status =3D 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 =3D=3D 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 withi= n > TIMEOUT_A > - // > - Status =3D 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.
> -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 di= gest. > - > - @retval EFI_SUCCESS Always successfully calculate the final dige= st. > -**/ > -EFI_STATUS > -EFIAPI > -TpmCommHashAll ( > - IN CONST UINT8 *Data, > - IN UINTN DataLen, > - OUT TPM_DIGEST *Digest > - ) > -{ > - VOID *Sha1Ctx; > - UINTN CtxSize; > - > - CtxSize =3D Sha1GetContextSize (); > - Sha1Ctx =3D AllocatePool (CtxSize); > - ASSERT (Sha1Ctx !=3D NULL); > - > - Sha1Init (Sha1Ctx); > - Sha1Update (Sha1Ctx, Data, DataLen); > - Sha1Final (Sha1Ctx, (UINT8 *)Digest); > - > - FreePool (Sha1Ctx); > - > - return EFI_SUCCESS; > -} > - > diff --git a/SecurityPkg/Library/TpmCommLib/CommonHeader.h > b/SecurityPkg/Library/TpmCommLib/CommonHeader.h > deleted file mode 100644 > index aa2e412a116d..000000000000 > --- a/SecurityPkg/Library/TpmCommLib/CommonHeader.h > +++ /dev/null > @@ -1,23 +0,0 @@ > -/** @file > - The internal header file for TpmCommLib. > - > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> -SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef _TPMCOMMLIB_COMMON_HEADER_H_ > -#define _TPMCOMMLIB_COMMON_HEADER_H_ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#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) functi= ons > -# and TPM hashall function. > -# > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> -# SPDX-License-Identifier: BSD-2-Clause-Patent > -# > -## > - > -[Defines] > - INF_VERSION =3D 0x00010005 > - BASE_NAME =3D TpmCommLib > - MODULE_UNI_FILE =3D TpmCommLib.uni > - FILE_GUID =3D 7d9fe32e-a6a9-4cdf-abff-10cc7f22e1c= 9 > - MODULE_TYPE =3D PEIM > - VERSION_STRING =3D 1.0 > - LIBRARY_CLASS =3D TpmCommLib|DXE_DRIVER UEFI_DRIVER P= EIM > DXE_SMM_DRIVER > - > -# > -# The following information is for reference only and not required by th= e build > tools. > -# > -# VALID_ARCHITECTURES =3D 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) functi= ons > -// and TPM hashall function. > -// > -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved. > -// > -// 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 hashal= l > function." > - > diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec > index 2cdfb02cc5a2..240d422405cc 100644 > --- a/SecurityPkg/SecurityPkg.dec > +++ b/SecurityPkg/SecurityPkg.dec > @@ -5,7 +5,7 @@ > # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and l= ibrary > classes) > # and libraries instances, which are used for those features. > # > -# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.
> # (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> # Copyright (c) 2017, Microsoft Corporation. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent > @@ -55,10 +55,6 @@ [LibraryClasses] > # > Tpm12DeviceLib|Include/Library/Tpm12DeviceLib.h >=20 > - ## @libraryclass Provides TPM Interface Specification (TIS) interfac= es for > TPM command. > - # > - TpmCommLib|Include/Library/TpmCommLib.h > - > ## @libraryclass Provides support for TCG Physical Presence Interfac= e (PPI) > specification > # >=3D 128 Vendor Specific PPI Operation. > # > diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc > index 53fce0535316..8ef6c9ee2f4d 100644 > --- a/SecurityPkg/SecurityPkg.dsc > +++ b/SecurityPkg/SecurityPkg.dsc > @@ -1,7 +1,7 @@ > ## @file > # Security Module Package for All Architectures. > # > -# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.
> # (C) Copyright 2015-2020 Hewlett Packard Enterprise Development LP
> # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -45,7 +45,6 @@ [LibraryClasses] >=20 > UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiService= sLib > .inf > PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf > IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > - TpmCommLib|SecurityPkg/Library/TpmCommLib/TpmCommLib.inf >=20 > PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecur= eLi > bNull.inf >=20 > TcgPhysicalPresenceLib|SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeT= cg > PhysicalPresenceLib.inf >=20 > TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMe > asurementLib.inf > @@ -185,7 +184,6 @@ [Components] > # TPM > # > SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf > - SecurityPkg/Library/TpmCommLib/TpmCommLib.inf >=20 > SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.i= nf > SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf > SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf > -- > 2.18.0.windows.1