audk/SecurityPkg
Jian J Wang 3743e71a06 SecurityPkg/FvReportPei: implement a common FV verifier and reporter
https://bugzilla.tianocore.org/show_bug.cgi?id=1617

This driver implements a common checker, verifier and reporter which is
independent of hardware based root-of-trust.

Usually the hardware based root-of-trust will not verify all BIOS but
part of it. For example, Boot Guard will only verify IBB segment. The IBB
needs to verify other part of BIOS, i.e. other FVs to transfer control to
from IBB. This driver plays the role in IBB to verify FVs not covered by
hardware root-of-trust to make sure integrity of the chain of trust.

To be hardware/platform independent, PPI

  gEdkiiPeiFirmwareVolumeInfoStoredHashFvPpiGuid

is introduced for platform to pass digest information to this driver.
This PPI should include all information needed to verify required FVs in
required boot mode.

struct _EDKII_PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_PPI {
  FV_HASH_INFO            HashInfo;
  UINTN                   FvNumber;
  HASHED_FV_INFO          FvInfo[1];
};

To avoid TOCTOU issue, all FVs to be verified will be copied to memory
before hash calculation. That also means this driver has to be run after
permanent memory has been discovered.

For a measured boot, this driver will install

  gEdkiiPeiFirmwareVolumeInfoPrehashedFvPpiGuid

to report digest of each FV to TCG driver.

For a verified boot, this driver will verify the final hash value
(calculated from the concatenation of each FV's hash) for indicated
FVs against the hash got from platform/hardware.

If pass, it will build EFI_HOB_TYPE_FV (consumed by DXE core) and/or
install gEfiPeiFirmwareVolumeInfoPpiGuid (consumed by PEI core), and
then report status code PcdStatusCodeFvVerificationPass.

If fail, it just report status code PcdStatusCodeFvVerificationFail
and go to dead loop if status report returns.

The platform can register customized handler to process pass and fail
cases differently.

Currently, this driver only supports hash (sha256/384/512) verification
for the performance consideration.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: "Hernandez Beltran, Jorge" <jorge.hernandez.beltran@intel.com>
Cc: Harry Han <harry.han@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
2019-06-26 21:18:43 +08:00
..
FvReportPei SecurityPkg/FvReportPei: implement a common FV verifier and reporter 2019-06-26 21:18:43 +08:00
Hash2DxeCrypto SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
HddPassword SecurityPkg/HddPassword: Add a PCD to skip Hdd password prompt 2019-06-12 09:12:05 +08:00
Include SecurityPkg: add definitions for OBB verification 2019-06-26 21:18:43 +08:00
Library SecurityPkg/AuthSeriableLib: Always delete variable in certdb 2019-05-15 13:00:37 +08:00
Pkcs7Verify/Pkcs7VerifyDxe SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
RandomNumberGenerator/RngDxe SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
Tcg SecurityPkg/OpalPassword: Add PCD to skip password prompt 2019-06-10 14:16:07 +08:00
VariableAuthenticated/SecureBootConfigDxe SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
SecurityPkg.dec SecurityPkg: add definitions for OBB verification 2019-06-26 21:18:43 +08:00
SecurityPkg.dsc SecurityPkg: Add missing instances for build only 2019-06-26 16:35:45 +08:00
SecurityPkg.uni SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
SecurityPkgExtra.uni SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00