[edk2-devel] [PATCH 6/9] IntelFsp2WrapperPkg/FspMeasurementLib: Add BaseFspMeasurementLib.

Yao, Jiewen jiewen.yao at intel.com
Sun Aug 2 08:45:40 UTC 2020


Please implement MeasureFspFirmwareBlobWithCfg() directly here. 
MeasureFspFirmwareBlobWithCfg () should be an internal function.
MeasureFspFirmwareBlob() may call MeasureFspFirmwareBlobWithCfg() based upon PCD.

MeasureFirmwareBlobWithCfg() should not be used because it should not exist.

Thank you
Yao Jiewen


> -----Original Message-----
> From: Zhang, Qi1 <qi1.zhang at intel.com>
> Sent: Friday, July 31, 2020 4:55 PM
> To: devel at edk2.groups.io
> Cc: Yao, Jiewen <jiewen.yao at intel.com>; Chiu, Chasel <chasel.chiu at intel.com>;
> Desimone, Nathaniel L <nathaniel.l.desimone at intel.com>; Zeng, Star
> <star.zeng at intel.com>; Zhang, Qi1 <qi1.zhang at intel.com>
> Subject: [PATCH 6/9] IntelFsp2WrapperPkg/FspMeasurementLib: Add
> BaseFspMeasurementLib.
> 
> From: Jiewen Yao <jiewen.yao at intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2376
> 
> Cc: Jiewen Yao <jiewen.yao at intel.com>
> Cc: Chasel Chiu <chasel.chiu at intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
> Cc: Star Zeng <star.zeng at intel.com>
> Cc: Qi Zhang <qi1.zhang at intel.com>
> Signed-off-by: Jiewen Yao <jiewen.yao at intel.com>
> ---
>  .../BaseFspMeasurementLib.inf                 | 37 ++++++++++
>  .../BaseFspMeasurementLib/FspMeasurementLib.c | 70 +++++++++++++++++++
>  2 files changed, 107 insertions(+)
>  create mode 100644
> IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/BaseFspMeasurementLi
> b.inf
>  create mode 100644
> IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
> 
> diff --git
> a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/BaseFspMeasurement
> Lib.inf
> b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/BaseFspMeasurement
> Lib.inf
> new file mode 100644
> index 0000000000..2539164e40
> --- /dev/null
> +++
> b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/BaseFspMeasurement
> Lib.inf
> @@ -0,0 +1,37 @@
> +## @file
> 
> +#  Provides FSP measurement functions.
> 
> +#
> 
> +#  This library provides MeasureFspFirmwareBlob() to measure FSP binary.
> 
> +#
> 
> +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
> 
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +#
> 
> +##
> 
> +
> 
> +[Defines]
> 
> +  INF_VERSION                    = 0x00010005
> 
> +  BASE_NAME                      = FspMeasurementLib
> 
> +  FILE_GUID                      = 9A62C49D-C45A-4322-9F3C-45958DF0056B
> 
> +  MODULE_TYPE                    = BASE
> 
> +  VERSION_STRING                 = 1.0
> 
> +  LIBRARY_CLASS                  = FspMeasurementLib
> 
> +
> 
> +#
> 
> +# The following information is for reference only and not required by the build
> tools.
> 
> +#
> 
> +#  VALID_ARCHITECTURES           = IA32 X64
> 
> +#
> 
> +
> 
> +[Sources]
> 
> +  FspMeasurementLib.c
> 
> +
> 
> +[Packages]
> 
> +  MdePkg/MdePkg.dec
> 
> +  MdeModulePkg/MdeModulePkg.dec
> 
> +  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec
> 
> +
> 
> +[LibraryClasses]
> 
> +  BaseLib
> 
> +  BaseMemoryLib
> 
> +  DebugLib
> 
> +  TpmMeasurementLib
> 
> diff --git
> a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
> b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
> new file mode 100644
> index 0000000000..8a33fe97c0
> --- /dev/null
> +++
> b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
> @@ -0,0 +1,70 @@
> +/** @file
> 
> +  This library is used by FSP modules to measure data to TPM.
> 
> +
> 
> +Copyright (c) 2020, Intel Corporation. All rights reserved. <BR>
> 
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include <Uefi.h>
> 
> +
> 
> +#include <Library/BaseMemoryLib.h>
> 
> +#include <Library/DebugLib.h>
> 
> +#include <Library/TpmMeasurementLib.h>
> 
> +#include <Library/FspMeasurementLib.h>
> 
> +
> 
> +#include <IndustryStandard/UefiTcgPlatform.h>
> 
> +
> 
> +/**
> 
> +  Mesure a FSP FirmwareBlob.
> 
> +
> 
> +  @param[in]  PcrIndex                PCR Index.
> 
> +  @param[in]  Descrption              Description for this FirmwareBlob.
> 
> +  @param[in]  FirmwareBlobBase        Base address of this FirmwareBlob.
> 
> +  @param[in]  FirmwareBlobLength      Size in bytes of this FirmwareBlob.
> 
> +
> 
> +  @retval EFI_SUCCESS           Operation completed successfully.
> 
> +  @retval EFI_UNSUPPORTED       TPM device not available.
> 
> +  @retval EFI_OUT_OF_RESOURCES  Out of memory.
> 
> +  @retval EFI_DEVICE_ERROR      The operation was unsuccessful.
> 
> +*/
> 
> +EFI_STATUS
> 
> +EFIAPI
> 
> +MeasureFspFirmwareBlob (
> 
> +  IN UINT32                         PcrIndex,
> 
> +  IN CHAR8                          *Description OPTIONAL,
> 
> +  IN EFI_PHYSICAL_ADDRESS           FirmwareBlobBase,
> 
> +  IN UINT64                         FirmwareBlobLength
> 
> +  )
> 
> +{
> 
> +  return MeasureFirmwareBlob (PcrIndex, Description, FirmwareBlobBase,
> FirmwareBlobLength);
> 
> +}
> 
> +
> 
> +/**
> 
> +  Mesure a FSP FirmwareBlob.
> 
> +
> 
> +  @param[in]  Descrption              Description for this FirmwareBlob.
> 
> +  @param[in]  FirmwareBlobBase        Base address of this FirmwareBlob.
> 
> +  @param[in]  FirmwareBlobLength      Size in bytes of this FirmwareBlob.
> 
> +  @param[in]  CfgRegionOffset         Configuration region offset in bytes.
> 
> +  @param[in]  CfgRegionSize           Configuration region in bytes.
> 
> +
> 
> +  @retval EFI_SUCCESS           Operation completed successfully.
> 
> +  @retval EFI_UNSUPPORTED       TPM device not available.
> 
> +  @retval EFI_OUT_OF_RESOURCES  Out of memory.
> 
> +  @retval EFI_DEVICE_ERROR      The operation was unsuccessful.
> 
> +*/
> 
> +EFI_STATUS
> 
> +EFIAPI
> 
> +MeasureFspFirmwareBlobWithCfg (
> 
> +  IN CHAR8                          *Description OPTIONAL,
> 
> +  IN EFI_PHYSICAL_ADDRESS           FirmwareBlobBase,
> 
> +  IN UINT64                         FirmwareBlobLength,
> 
> +  IN UINT32                         CfgRegionOffset,
> 
> +  IN UINT32                         CfgRegionSize
> 
> +  )
> 
> +{
> 
> +  return MeasureFirmwareBlobWithCfg (Description, FirmwareBlobBase,
> FirmwareBlobLength, CfgRegionOffset, CfgRegionSize);
> 
> +
> 
> +}
> 
> +
> 
> --
> 2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63635): https://edk2.groups.io/g/devel/message/63635
Mute This Topic: https://groups.io/mt/75903685/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list