-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a new package that holds TPM testing functionality. Currently, a feature is present called "TPM Replay" that provides the ability to replay TPM measurements from a custom-made event log. The primary purpose is for testing operating system features dependent on TPM measurements. More details about this feature are available in TpmTestingPkg/TpmReplayPeiDxe/Readme.md. This feature is designed to ease platform integration and can be applied to physical and virtual systems. Signed-off-by: Michael Kubacki <[email protected]>
- Loading branch information
Showing
48 changed files
with
10,655 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** @file | ||
Firmware Volume Measurement Exclusion Library | ||
Provides a simple interface for platforms to have a list of firmware volumes | ||
excluded from measurement by the traditional TCG driver infrastructure. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef FV_MEASUREMENT_EXCLUSION_LIB_H | ||
#define FV_MEASUREMENT_EXCLUSION_LIB_H | ||
|
||
#include <Ppi/FirmwareVolumeInfoMeasurementExcluded.h> | ||
|
||
/** | ||
Gets a list of FVs excluded from measurement. | ||
@param[out] ExcludedFvs A pointer to an array of excluded FV structures. | ||
@param[out] ExcludedFvsCount The number of excluded FV structures. | ||
@retval EFI_SUCCESS The excluded FVs were returned successfully. | ||
@retval Others An error occurred preventing the excluded FVs from being | ||
return successfully. | ||
**/ | ||
EFI_STATUS | ||
EFIAPI | ||
GetPlatformFvExclusions ( | ||
OUT CONST EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_FV **ExcludedFvs, | ||
OUT UINTN *ExcludedFvsCount | ||
); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** @file | ||
TPM Replay Configuration Structure | ||
Defines structures used to configure the TPM Replay feature. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef TPM_REPLAY_CONFIG_H__ | ||
#define TPM_REPLAY_CONFIG_H__ | ||
|
||
#define TPM_REPLAY_CONFIG_SIGNATURE SIGNATURE_64 ('_', 'T', 'R', '_', 'C', 'F', 'G', '_') | ||
#define TPM_REPLAY_CONFIG_STRUCT_VERSION 0x00000001 | ||
|
||
#pragma pack(push, 1) | ||
|
||
typedef union { | ||
UINT32 Data; | ||
struct { | ||
UINT32 Pcr0 : 1; ///< 0 - PCR0 | ||
UINT32 Pcr1 : 1; ///< 1 - PCR1 | ||
UINT32 Pcr2 : 1; ///< 2 - PCR2 | ||
UINT32 Pcr3 : 1; ///< 3 - PCR3 | ||
UINT32 Pcr4 : 1; ///< 4 - PCR4 | ||
UINT32 Pcr5 : 1; ///< 5 - PCR5 | ||
UINT32 Pcr6 : 1; ///< 6 - PCR6 | ||
UINT32 Pcr7 : 1; ///< 7 - PCR7 | ||
UINT32 Reserved : 24; ///< 31:8 - Reserved | ||
} Pcrs; | ||
} ACTIVE_PCRS; | ||
|
||
typedef struct { | ||
UINT64 Signature; // Structure signature - TPM_REPLAY_CONFIG_SIGNATURE | ||
UINT32 StructureVersion; // Structure version - Updates must be backward compatible | ||
UINT32 HeaderLength; // Length of this header in bytes | ||
ACTIVE_PCRS ActivePcrs; // PCRs that are actively used by the TPM Replay feature | ||
// If a PCR is active, it will be cleared except for values | ||
// explicitly defined in a given TPM Replay event log. | ||
} TPM_REPLAY_CONFIG; | ||
|
||
#pragma pack(pop) | ||
|
||
extern EFI_GUID gTpmReplayConfigHobGuid; | ||
|
||
#endif |
42 changes: 42 additions & 0 deletions
42
TpmTestingPkg/Library/BaseFvMeasurementExclusionLibNull/BaseFvMeasurementExclusionLibNull.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** @file | ||
Firmware Volume Measurement Measurement Exclusion Library NULL instance. | ||
This library instance does not exclude any firmware volumes. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <Uefi.h> | ||
#include <Library/FvMeasurementExclusionLib.h> | ||
|
||
/** | ||
Gets a list of FVs excluded from measurement. | ||
@param[out] ExcludedFvs A pointer to an array of excluded FV structures. | ||
@param[out] ExcludedFvsCount The number of excluded FV structures. | ||
@retval EFI_SUCCESS The excluded FVs were returned successfully. | ||
@retval Others An error occurred preventing the excluded FVs from being | ||
return successfully. | ||
**/ | ||
EFI_STATUS | ||
EFIAPI | ||
GetPlatformFvExclusions ( | ||
OUT CONST EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_FV **ExcludedFvs, | ||
OUT UINTN *ExcludedFvsCount | ||
) | ||
{ | ||
if (ExcludedFvs != NULL) { | ||
*ExcludedFvs = NULL; | ||
} | ||
|
||
if (ExcludedFvsCount != NULL) { | ||
*ExcludedFvsCount = 0; | ||
} | ||
|
||
return EFI_SUCCESS; | ||
} |
30 changes: 30 additions & 0 deletions
30
...estingPkg/Library/BaseFvMeasurementExclusionLibNull/BaseFvMeasurementExclusionLibNull.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## @file | ||
# Firmware Volume Measurement NULL library instance. | ||
# | ||
# Copyright (c) Microsoft Corporation. | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = BaseFvMeasurementExclusionLibNull | ||
FILE_GUID = 104D6CF7-B500-44A5-8EC6-4055FE6A0F8F | ||
MODULE_TYPE = BASE | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = FvMeasurementExclusionLib | ||
|
||
# | ||
# The following information is for reference only and not required by the build tools. | ||
# | ||
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 | ||
# | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
SecurityPkg/SecurityPkg.dec | ||
TpmTestingPkg/TpmTestingPkg.dec | ||
|
||
[Sources] | ||
BaseFvMeasurementExclusionLibNull.c |
Oops, something went wrong.