mirror of https://github.com/acidanthera/audk.git
SecurityPkg/FvReportPei: Use FirmwareVolumeShadowPpi
If FirmwareVolumeShadow PPI is available, then use it to shadow FVs to memory. Otherwise fallback to CopyMem(). Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Patel Umang <umang.patel@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
parent
c8e631588b
commit
144028626e
|
@ -119,6 +119,7 @@ VerifyHashedFv (
|
|||
UINT8 *HashValue;
|
||||
UINT8 *FvHashValue;
|
||||
VOID *FvBuffer;
|
||||
EDKII_PEI_FIRMWARE_VOLUME_SHADOW_PPI *FvShadowPpi;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if ((HashInfo == NULL) ||
|
||||
|
@ -191,8 +192,30 @@ VerifyHashedFv (
|
|||
// Copy FV to permanent memory to avoid potential TOC/TOU.
|
||||
//
|
||||
FvBuffer = AllocatePages (EFI_SIZE_TO_PAGES ((UINTN)FvInfo[FvIndex].Length));
|
||||
|
||||
ASSERT (FvBuffer != NULL);
|
||||
CopyMem (FvBuffer, (CONST VOID *)(UINTN)FvInfo[FvIndex].Base, (UINTN)FvInfo[FvIndex].Length);
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gEdkiiPeiFirmwareVolumeShadowPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **)&FvShadowPpi
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = FvShadowPpi->FirmwareVolumeShadow (
|
||||
(EFI_PHYSICAL_ADDRESS)FvInfo[FvIndex].Base,
|
||||
FvBuffer,
|
||||
(UINTN)FvInfo[FvIndex].Length
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
CopyMem (
|
||||
FvBuffer,
|
||||
(CONST VOID *)(UINTN)FvInfo[FvIndex].Base,
|
||||
(UINTN)FvInfo[FvIndex].Length
|
||||
);
|
||||
}
|
||||
|
||||
if (!AlgInfo->HashAll (FvBuffer, (UINTN)FvInfo[FvIndex].Length, FvHashValue)) {
|
||||
Status = EFI_ABORTED;
|
||||
|
|
|
@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||
#include <IndustryStandard/Tpm20.h>
|
||||
|
||||
#include <Ppi/FirmwareVolumeInfoStoredHashFv.h>
|
||||
#include <Ppi/FirmwareVolumeShadowPpi.h>
|
||||
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
[Ppis]
|
||||
gEdkiiPeiFirmwareVolumeInfoPrehashedFvPpiGuid ## PRODUCES
|
||||
gEdkiiPeiFirmwareVolumeInfoStoredHashFvPpiGuid ## CONSUMES
|
||||
gEdkiiPeiFirmwareVolumeShadowPpiGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeFvVerificationPass
|
||||
|
|
Loading…
Reference in New Issue