Skip to content

Commit beda3f7

Browse files
author
Jian J Wang
committed
SecurityPkg: add definitions for OBB verification
https://bugzilla.tianocore.org/show_bug.cgi?id=1617 gEdkiiPeiFirmwareVolumeInfoStoredHashFvPpiGuid should be installed by platform to pass FV hash information to the common FV verify/report driver, in which the hash value will be calculated again based on the information fed in and then verified. The information passed in this PPI include: - FVs location in flash and length - Hash values for different boot mode The hash value must be calculated in following way (if 3 FVs to calc): FV1 -> Hash1 FV2 -> Hash2 FV3 -> Hash3 Hash1 + Hash2 + Hash3 -> HashAll Only HashAll is stored in this PPI. The purposes for this algorithm are two: 1. To report each FV's hash to TCG driver and verify HashAll at the same time without the burden to calculate the hash twice; 2. To save hash value storage due to potential hardware limitation Different boot mode may have its own hash value so that each mode can decide which FV will be verified. For example, for the sake of performance, S3 may choose to skip some FVs verification and normal boot will verify all FVs it concerns. So in this PPI, each FV information has flag to indicate which boot mode it will be taken into hash calculation. And if multiple hash values passed in this PPI, each has a flag to indicate which boot mode it's used for. Note one hash value supports more than one boot modes if they're just the same. PcdStatusCodeFvVerificationPass and PcdStatusCodeFvVerificationFail are introduced to report status back to platform, and platform can choose how to act upon verification success and failure. 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>
1 parent c734187 commit beda3f7

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/** @file
2+
PPI to describe stored hash digest for FVs.
3+
4+
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5+
SPDX-License-Identifier: BSD-2-Clause-Patent
6+
7+
**/
8+
9+
#ifndef __PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_H__
10+
#define __PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_H__
11+
12+
#include <Ppi/FirmwareVolumeInfoPrehashedFV.h>
13+
14+
// {7F5E4E31-81B1-47E5-9E21-1E4B5BC2F61D}
15+
#define EDKII_PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_PPI_GUID \
16+
{0x7f5e4e31, 0x81b1, 0x47e5, {0x9e, 0x21, 0x1e, 0x4b, 0x5b, 0xc2, 0xf6, 0x1d}}
17+
18+
//
19+
// Hashed FV flags.
20+
//
21+
#define HASHED_FV_FLAG_REPORT_FV_INFO_PPI 0x0000000000000001
22+
#define HASHED_FV_FLAG_REPORT_FV_HOB 0x0000000000000002
23+
#define HASHED_FV_FLAG_VERIFIED_BOOT 0x0000000000000010
24+
#define HASHED_FV_FLAG_MEASURED_BOOT 0x0000000000000020
25+
#define HASHED_FV_FLAG_SKIP_ALL 0xFFFFFFFFFFFFFF00
26+
#define HASHED_FV_FLAG_SKIP_BOOT_MODE(Mode) LShiftU64 (0x100, (Mode))
27+
28+
//
29+
// FV hash flags
30+
//
31+
#define FV_HASH_FLAG_BOOT_MODE(Mode) LShiftU64 (0x100, (Mode))
32+
33+
typedef struct _EDKII_PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_PPI
34+
EDKII_PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_PPI;
35+
36+
typedef struct _HASHED_FV_INFO {
37+
UINT64 Base;
38+
UINT64 Length;
39+
UINT64 Flag;
40+
} HASHED_FV_INFO;
41+
42+
typedef struct _FV_HASH_INFO {
43+
UINT64 HashFlag;
44+
UINT16 HashAlgoId;
45+
UINT16 HashSize;
46+
UINT8 Hash[64];
47+
} FV_HASH_INFO;
48+
49+
//
50+
// PPI used to convey FVs and hash information of a specific platform. Only one
51+
// instance of this PPI is allowed in the platform.
52+
//
53+
struct _EDKII_PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_PPI {
54+
FV_HASH_INFO HashInfo;
55+
UINTN FvNumber;
56+
HASHED_FV_INFO FvInfo[1];
57+
};
58+
59+
extern EFI_GUID gEdkiiPeiFirmwareVolumeInfoStoredHashFvPpiGuid;
60+
61+
#endif
62+

SecurityPkg/SecurityPkg.dec

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@
187187

188188
## Include/Ppi/FirmwareVolumeInfoPrehashedFV.h
189189
gEdkiiPeiFirmwareVolumeInfoPrehashedFvPpiGuid = { 0x3ce1e631, 0x7008, 0x477c, { 0xad, 0xa7, 0x5d, 0xcf, 0xc7, 0xc1, 0x49, 0x4b } }
190+
191+
## Include/Ppi/FirmwareVolumeInfoStoredHashFv.h
192+
gEdkiiPeiFirmwareVolumeInfoStoredHashFvPpiGuid = {0x7f5e4e31, 0x81b1, 0x47e5, { 0x9e, 0x21, 0x1e, 0x4b, 0x5b, 0xc2, 0xf6, 0x1d } }
190193

191194
#
192195
# [Error.gEfiSecurityPkgTokenSpaceGuid]
@@ -257,6 +260,12 @@
257260
# @ValidList 0x80000003 | 0x010D0000
258261
gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice|0x010D0000|UINT32|0x00000007
259262

263+
## Progress Code for FV verification result.<BR><BR>
264+
# (EFI_SOFTWARE_PEI_MODULE | EFI_SUBCLASS_SPECIFIC | XXX)
265+
# @Prompt Status Code for FV verification result
266+
gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeFvVerificationPass|0x0303100A|UINT32|0x00010030
267+
gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeFvVerificationFail|0x0303100B|UINT32|0x00010031
268+
260269
[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
261270
## Image verification policy for OptionRom. Only following values are valid:<BR><BR>
262271
# NOTE: Do NOT use 0x5 and 0x2 since it violates the UEFI specification and has been removed.<BR>

0 commit comments

Comments
 (0)