Commit graph

432 commits

Author SHA1 Message Date
rdiaz
2c2f74a581 SecurityPkg: Break out the user prompt from Tcg2 PPI
Break out the PromptForUserConfirmation() function into a lib
so it can be abstracted at the platform level.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
2026-08-26 10:54:45 +00:00
rdiaz
f7052e2d02 SecurityPkg: Remove global use pre-memory
Updated Tpm2DeviceLibFfa to no longer use globals. Updated the
SEC version of Tpm2DeviceLibFfaBase to no longer use globals
when including TPM libraries in the SEC phase. Includes various
cleanup regarding the updated files.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-08-03 20:16:00 +00:00
Richard Lyu
b65fd21591 SecurityPkg/DxeTpmMeasureBootLib: Use GptLib parser
TcgMeasureGptTable() reads the primary GPT header directly from LBA 1
and validates it with field checks only: no header CRC32, no
partition-entry-array CRC32 and no backup fallback. This is the same
divergence between the measured and the parsed partition table that
CVE-2024-13745 reports against DxeTpm2MeasureBootLib, and the tracking
issue lists both libraries as affected.

Mirror the DxeTpm2MeasureBootLib fix: select the GPT header to measure
via the shared GptLib parser. Validate the current primary GPT or, when
it is invalid, validate the backup and the header at its AlternateLBA.
Do not extend PCR[5] if no valid header can be selected.

Signed-off-by: Richard Lyu <richard.lyu@suse.com>
2026-07-20 21:50:57 +00:00
Richard Lyu
7c12d4359a SecurityPkg/DxeTpm2MeasureBootLib: Use GptLib parser
The previous commit introduced GptLib by extracting PartitionDxe's GPT
parsing and validation code. It provides a shared implementation for edk2
components that need to parse and validate GPT data consistently.

Update DxeTpm2MeasureBootLib to use GptLib when selecting on-disk GPT
data for measurement. Validate the current primary GPT or, when it is
invalid, validate the backup and the header at its AlternateLBA. Do not
extend PCR[5] if no valid header can be selected. The measurement therefore
uses GPT data read from disk at measurement time and applies the shared
parser and validation logic.

Ref: https://seclists.org/oss-sec/2026/q2/727
Signed-off-by: Richard Lyu <richard.lyu@suse.com>
2026-07-20 21:50:57 +00:00
Kun Qin
2938b830f6 SecurityPkg: Tpm over FFA: FFA_RUN command should use the returned ID
As the FFA function now returns the target ID properly, instead of
hardcoding the FFA_RUN target ID being the TPM SP, we use the parsed
ID to issue the FFA_RUN.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2026-07-20 19:13:15 +00:00
Alexander Gryanko
1dc6b5e3dd SecurityPkg: added image verification tests for signed images
Previous changes introduced tests for unsigned
images verified by hash entries in DB/DBX. This commit adds
tests covering verification of signed images, including
certificate chain validation as well as cases where image
hashes are checked against entries in DB/DBX.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2026-07-16 02:33:17 +00:00
Alexander Gryanko
7668d8854f SecurityPkg: added image verification test using DB hash
The part of DxeImageVerificationHandler responsible for
verifying the image location source has already been
implemented. This commit implements tests for verifying
images in cases where the image has no signature, but
there is a hash record for this file in DB/DBX.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2026-07-16 02:33:17 +00:00
Mingjie Shen
65cacd6fcd SecurityPkg/DxeTpmMeasureBootLib: Check GPT event size sanitization
TcgMeasureGptTable() ignored the return status of
TpmSanitizePrimaryHeaderGptEventSize(). On failure the EventSize output
is unreliable and was passed straight into AllocateZeroPool() and the
subsequent CopyMem() operations, which can result in an incorrectly
sized allocation and out-of-bounds access when parsing an untrusted GPT.

Check the status and, on error, free the already-allocated PrimaryHeader
and EntryPtr buffers and return EFI_DEVICE_ERROR, matching the handling
already used in DxeTpm2MeasureBootLib's TcgMeasureGptTable().

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2026-07-07 19:20:07 +00:00
Sami Mujawar
4ae84e3e87 MdePkg, SecurityPkg, OvmfPkg: Move CCEL table defs to ACPI header
Although Table 5.5 "DESCRIPTION_HEADER Signatures for tables defined
by ACPI" and the "Links to ACPI-Related Documents" still reference the
"Virtual Firmware Confidential Computing Event Log Table," the CCEL
table has now been formally included in the ACPI specification, see
https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#
description-header-signatures-for-tables-defined-by-acpi

The CCEL (CC Event Log) table is defined in the ACPI 6.5 specification,
section 5.2.34 "CC Event Log ACPI Table":
https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#
cc-event-log-acpi-table

Therefore, move the CCEL table and related definitions to the standard
ACPI header files and update the relevant code to reflect the structure
and macro renaming. Also add the definitions to the ACPI 6.6 headers.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
2026-07-03 09:26:33 +00:00
20000419
4f475ba542 SecurityPkg/AuthVariableLib: harden signature list filtering
Signed-off-by: 20000419 <lzy20000419@outlook.com>
2026-06-30 02:35:17 +00:00
Michael Kubacki
fd7a2a5488 SecurityPkg: Update Tpm2Ptp.h to follow pragma once coding convention
Update Tpm2Ptp.h to follow the latest EDK II C Coding Standards
Specification (5.3) to use '#pragma once' instead of traditional
macro-based include guards in header files.

https://tianocore-docs.github.io/edk2-CCodingStandardsSpecification/draft/5_source_files/53_include_files.html#53-include-files

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-06-25 19:40:31 +00:00
Sami Mujawar
8a6cd66acb SecurityPkg/HashInstanceLibSha256: Remove unused Tpm2CommandLib dependency
The HashInstanceLibSha256 library does not call into Tpm2CommandLib.
Removing it from the [LibraryClasses] section reduces unnecessary
dependencies and avoids potential build issues in non-TPM builds.

Also remove the unnecessary include of Tpm2CommandLib.h

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
2026-06-25 16:53:36 +00:00
Vignesh G
56cad12011 SecurityPkg: Add sanity check for File and FileBuffer inputs
Ensure that either File or FileBuffer is provided before proceeding with
security verification. If both are NULL, return EFI_INVALID_PARAMETER.
This prevents verification from running without a valid input buffer and
aligns with the intended design, where File is optional and FileBuffer
alone is sufficient.

Signed-off-by: Vignesh G <vigneshg@ami.com>
2026-06-24 17:51:16 +00:00
rdiaz
a48fae6611 SecurityPkg: Update HashLibBaseCryptoRouter
HashLibBaseCryptoRouterCommon contained a version of
Tpm2GetHashMaskFromAlgo which was causing conflicts with the
version in Tpm2HelpLib. This version used a GUID to query the
HashMask, updated the name to remove the conflict and be more
inline with the actual function implementation.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-06-17 19:16:45 +00:00
rdiaz
c0208dc79e SecurityPkg: Update Tpm2Help.c Functions
Update the Tpm2Help.c functions to become wrappers for the
functions in Tpm2HelpLib. This prevents platforms from breaking
due to the updated prefix naming but will still allow us to
keep one instance of the function implementations.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-06-17 19:16:45 +00:00
rdiaz
2d49d51722 SecurityPkg: Integrate Tpm2HelpLib
Replace instances of the old Tpm2Help.c functions with the
new Tpm2HelpLib versions. Update files to use Tpm2HelpLib
in place of Tpm2Help.c from Tpm2CommandLib.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-06-17 19:16:45 +00:00
rdiaz
fde05ad8f6 SecurityPkg: Introduce Tpm2HelpLib
Creation of a new Tpm2HelpLib which contains the functions from
Tpm2Help.c. This new library is meant to replace Tpm2Help.c such
that inclusion of Tpm2CommandLib and Tpm2DeviceLib is not required
when only needing access to the Tpm2Help.c functions. Due to
Tpm2HelpLib being a new library, the prefix Tpm2 has been added
to all library functions to indicate where the functions
originate from.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-06-17 19:16:45 +00:00
Oliver Smith-Denny
81b7c2912b MdePkg,SecurityPkg: Fix Spelling Errors in TCG/TPM Definitions
Fix spelling errors in definitions in
TcgPhysicalPresence.h, TcgStorageOpal.h, Tpm12.h,
and Tpm2Acpi.h. Update consumer in SecurityPkg.

Temporary backward-compatible aliases are provided
for the old misspelled macro and enum names.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-05-08 02:15:34 +00:00
Benjamin Doron
441873c2a9 SecurityPkg/SecureBootVariableLib: Cleanup debug print readability
All debug prints should end in a newline character.

Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
2026-05-06 10:43:05 +00:00
Kun Qin
b980aa0719 SecurityPkg: AuthVariableLib: Handle empty signature lists
The current implementation fails to set authenticated variables when the
signature list is empty. This can legitimately occur for dbx when no
signatures are revoked after a certificate rotation.

Update the logic to explicitly handle empty signature lists, avoiding an
implicit dependency on the variable being absent from variable storage.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2026-03-10 06:33:40 +00:00
Alexander Gryanko
201a4fe3ec SecurityPkg: align UNI file headers with UNI Spec standard
The Uni file standard specifies that comments begin with the
characters "//". The following files contained incorrectly
formatted C-style comments and have been updated:

SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/PhysicalPresenceStrings.uni
SecurityPkg/Library/DxeTcgPhysicalPresenceLib/PhysicalPresenceStrings.uni
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigStrings.uni
SecurityPkg/Tcg/TcgConfigDxe/TcgConfigStrings.uni
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni

The problems were identified during testing of the parser
https://github.com/xpahos/edk2-idea.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2026-03-02 19:32:17 +00:00
Michael Kubacki
9326c0eb0a SecurityPkg: Replace include guards with #pragma once
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.

`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.

Compared to macro-based include guards, `#pragma once`:

- Eliminates the risk of macro name collisions or copy/paste errors
  where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
  (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
  file entirely, rather than re-reading it to find the matching
  `#endif` ("multiple-include optimization").
  - Note that some compilers may already optimize traditional include
    guards, by recognzining the idiomatic pattern.

This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.

However, this is considered acceptable given:

1. edk2 already defines a subset of supported compilers in
   BaseTools/Conf/tools_def.template, all of which have supported
   `#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
   include guard naming and potential macro collisions.

Approximate compiler support dates:

- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
  (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-02-23 21:01:28 +00:00
Michael D Kinney
715a8dc067 SecurityPkg/Library/SecureBootVariableLib/UnitTest: Cmocka use issues
Fix mocked versions of GetVariable() and SetVariable().
* VendorGuid parameter use expect_memory() not expect_value()
* MockSetVariable() use check_expected() for Attributes parameter
* MockSetVariable() use check_expected_ptr() for Data parameter
* Calls to MockGetVariable() use (UINTN) cast for will_return()
  of pointer to data buffer returned.

Issues found with Linux GCC NOOPT IA32 builds of unit tests.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-01-21 09:15:06 +00:00
Levi Yun
b80000847a SecurityPkg/Library: use ArmFfaGetPartitionInfo() in Tpm2ServiceFfaLib
Use ArmFfaGetPartitionInfo() in Tpm2ServiceFfaLib.
This simplifies the code line to get partition information.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-01-08 12:07:46 +00:00
Michael D Kinney
8635ea07be SecurityPkg/Library/SecureBootVariableLib/UnitTest: Fix CLANG
Fix uninitialized variable error in unit tests detected by
clang by zeroing local variable structure before use in unit
test cases.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-12-23 01:57:45 +00:00
Mike Beaton
7410754041 SecurityPkg/HashLibTpm2: Fix unused variable usage
There is an unused variable in
SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c
which is spotted by CLANG builds.

The correct fix here is not to just remove the unused assignment,
but rather to fix the line following it, which should have been using
the unused value in the way that it now does.

Fixes: 9c651ef83a

Co-authored-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-11-29 18:21:50 +01:00
Sathya Ravichandran
3dbdfd22c7 SecurityPkg: Replace VariableLock with VariablePolicy
Since VariableLock compromises security in the SMM environment,
it is deprecated. Used VariablePolicy instead for stronger and
more flexible UEFI variable protection.

Ref: [acd66e4]

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Sathya Ravichandran <sathyar@ami.com>
2025-11-24 06:23:55 +00:00
Mike Beaton
3c6960f279 SecurityPkg: Remove unused variable
XCODE5 toolchain finds this, with error:
Tpm2Capability.c:535:23: error: variable 'ActivePcrBankCount' set but not used

Fixes: 1f2adcbba5

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-11-22 01:43:26 +00:00
Sathya Ravichandran
d36680ad13 SecurityPkg: Remove DXE_SAL_DRIVER
The DXE_SAL_DRIVER module type was introduced to support
Itanium (IPF) platforms. Since support for Itanium processors has been
dropped, the instances of DXE_SAL_DRIVER have been removed.

Ref: [3cb0a311cb]

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Sathya Ravichandran <sathyar@ami.com>
2025-10-30 10:00:32 +00:00
Leif Lindholm
baf0ae3b1d SecurityPkg: rename PeilessSecMeasureNullLib
By edk2 convention, a NULL library should be called *LibNull.
This library did not follow this convention, so rename i.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-10-02 15:42:07 +01:00
Levi Yun
9bca0ee3b2 SecurityPkg/Library: introduce PeilessSecMeasureLib
PeilessSecMeasureLib is library to support
measurement and extend PCR in PeilessSec where no PEI phase exist.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-09-30 11:39:04 +00:00
Levi Yun
9c651ef83a SecurityPkg/Library: introduce HashLibTpm2PeilessSec
PeilessSec couldn't use the HasLibTpm2 since:

  - HashLibTpm2 uses memory allocation/free for Hash interface.
    But in PeilessSecPhase doesn't support the free memory since
    the allocation of memory via MemoryAllocation APIs is allocated
    using HOB which couldn't be freed.

  - In SEC phase, it couldn't use DynamicPcd -- PcdHashMasks

  - PeilessSec utilises the algorithm passed in
    the SpecId event log handed off by TF-A

To address theses, introduce HashLibTpm2PeilessSec used for
measurements in the PeilessSec.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-09-30 11:39:04 +00:00
Oliver Smith-Denny
08ae634ccb SecurityPkg: Drop ARM32 Support
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 code in SecurityPkg.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
Phil Noh
21eff866e7 SecurityPkg/Tpm2DeviceLibDTpm: Remove global variable for command code
As a BASE type library, currently the TCG PEI driver, Tcg2Pei.inf links
the library. On edk2-stable202508 version, it is found that the driver
includes and updates the global variable of mLastCommandSent in debug
build. Also found that the previous commit (460f270) for the library adds
and uses the global variable. Updating the global variable in PEI drivers
could affect the following issues. To address these issues, remove the
global variable usage.

PEI ROM Boot : Global variable is not updated
PEI RAM Boot : PEI FV integration/security check is failed

Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2025-09-25 10:24:54 +00:00
Kun Qin
b4e6443f89 SecurityPkg: Tpm2DeviceLibFfa: Recognize CRB Interface Version 2
This change adds the recognition of TPM devices that supports CRB
interface v2.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-09-18 17:30:28 +08:00
Kun Qin
b24663ee58 SecurityPkg: Tpm2DeviceLibDTpm: Recognize CRB Interface Version 2
This change adds the recognition of TPM devices that supports CRB
interface v2.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-09-18 17:30:28 +08:00
Levi Yun
d8e875e625 Global: fix ArmFfaLibRun() caller couldn't get ret-args
When ArmFfaLibDirectMsgReq(2) is preempted, caller of these functions
should resume it works via ArmFfaLibRun() and the secure partition
will be return with FFA_DIRECT_MSG_RESP(2) with return arguments.

However, since ArmFfaLibRun() gets its return in its stack variable,
So caller of ArmFfaLibRun() doesn't get the return arguments from
secure partition.

To resolve this, add output parameter to ArmFfaLibRun() to
receive return arguments.

Continuous-integration-options: PatchCheck.ignore-multi-package
Fixes: 5d1b38dd07 ("ArmPkg: Add ArmFfaLib used in Dxe driver")
Reported-by: Mariam Elshakfy <Mariam.Elshakfy@arm.com>
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-09-08 13:14:00 +00:00
Michael Kubacki
8682d3ea0a SecurityPkg/Tpm2CommandLib: Update not found RC for Public NV Read
Currently a EFI_DEVICE_ERROR is returned if `TPM_RC_HANDLE` is the
return code from a TPM2_NV_ReadPublic command. However, in the TCG
TPM Library Part 3: Commands specification, `TPM_RC_HANDLE` is a
return code if:

  1. An Index does not exist that corresponds to the handle
     (TPM_RC_HANDLE)
  2. The hierarchy associated with the existing NV Index is not
     enabled (TPM_RC_HANDLE)

Therefore, return EFI_NOT_FOUND in this case, since that more
precisely allows a caller to identify this condition and act on
it as opposed to a more generic device error.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-08-23 00:48:06 +00:00
Michael D Kinney
072ab3846c Revert "SecurityPkg: CodeQL Fixes."
This reverts commit ba6a8eb045.

PR https://github.com/tianocore/edk2/pull/11307 introduced a
logic change that caused regressions in FV verification on
some platforms. This PR is being reverted to restore the prior
logic.

The Code QL fixes in https://github.com/tianocore/edk2/pull/11307
can be resubmitted without the logic change along with one
commit for each type of Code QL issue being addressed.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-08-12 03:50:30 +00:00
Alexander Gryanko
057a611ae6 SecurityPkg: Added basic DxeImageVerificationLib tests
Add initial unit test for DxeImageVerificationHandler to
validate signature verification bypass for selected image types.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2025-08-07 01:18:26 +00:00
Levi Yun
f47216f159 SecurityPkg/Library: Tpm2DeviceSecLibFfa for PeilessSec
To support measurement and extend PCR in PeilessSec with
TPM device using FF-A over CRB, add Tpm2DeviceSecLibFfa for PeilessSec.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-24 03:54:43 +00:00
Levi Yun
ee9950d3fb SecurityPkg/Library: separate logics geting TPM2 information with FF-A
This is preparation patch to add Tpm2DeviceSecLibFfa for SEC
used in PeilessSec.
In SEC phase, DynamicPcd used for cacahing TPM2 information
couldn't be used.
To resolve this, writes wrapper functions to get TPM2 information
so that in the wrapper functions used in SEC wouldn't use the
related DyanmicPcd.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-24 03:54:43 +00:00
Michael Kubacki
ba6a8eb045 SecurityPkg: CodeQL Fixes.
Makes changes to comply with alerts raised by CodeQL.

Most of the issues here fall into the following two categories:

1. Potential use of uninitialized pointer.
2. Inconsistent integer width in comparison.

Co-authored-by: Taylor Beebe <31827475+TaylorBeebe@users.noreply.github.com>
Co-authored-by: kenlautner <85201046+kenlautner@users.noreply.github.com>
Co-authored-by: Bret Barkelew <bret@corthon.com>

Signed-off-by: Doug Flick <dougflick@microsoft.com>
2025-07-24 01:58:06 +00:00
Oliver Smith-Denny
690929c458 SecurityPkg: Tpm2DumpLib: Make All Prints at DEBUG_SECURITY
When DEBUG_SECURITY was added, not all prints in
Tpm2DeviceLibDTpmDump.c were updated. This commit updates
the remaining prints.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-07-24 00:46:55 +00:00
Bret Barkelew
460f2705b4 SecurityPkg: Add Additional TPM Logging at DEBUG_SECURITY
This commit adds additional dumping logic to Tpm2DeviceLibDTpm,
print at DEBUG_SECURITY to aid in TPM debugging.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Co-authored-by: Bret Barkelew <brbarkel@microsoft.com>
2025-07-14 07:25:12 +00:00
Oliver Smith-Denny
d5b8630379 SecurityPkg: Move Noisy Logs to DEBUG_SECURITY
The TPM code is currently very noisy (e.g. in a sample platform,
4,000 of the 5,700 lines printed to the serial port at DEBUG_INFO
level were from the TPM code). For TPM debugging, this is very
critical information, but for most builds it simply spams the logs
and slows down the build.

This commit moves the event log and PCR dumping to log at
DEBUG_SECURITY level.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-07-14 07:25:12 +00:00
Oliver Smith-Denny
1f2adcbba5 SecurityPkg: Remove/Downgrade Noisy TCG Prints
The TCG code is very noisy when a TPM is connected. This
commit downgrades some prints to verbose and removes some
others that do not have value (such as function enter and
exit prints).

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-07-14 07:25:12 +00:00
Ceping Sun
7c40bc06a9 SecurityPkg/SecTpmMeasurementLib: Fix OverFlow Coverity issue
CC_MR_INDEX_0_MRTD indicates the MRTD register. This register is NOT
extendable in TDVF. So the return value of TdxMeasurementMapPcrToMrIndex
must be checked.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2025-07-02 07:41:33 +00:00
Michael Kubacki
617e061830 SecurityPkg/Tpm2CommandLib: Add new digest list copy and size functions
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3267

Adds two new helper functions.

Currently, a function exists in Tpm2CommandLib to copy a digest list
to a buffer. A function to perform the inverse operation - copying
from a buffer to a digest list is added.

A function is also added to compute the total digest size for a given
hash algorithm mask.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-13 17:42:43 +00:00
Levi Yun
2e5b357a1f SecurityPkg/Tpm2InstanceLibFfa: Fix constructor wrong name
Fix unmatched constructor name of Tpm2InstanceLibFfa.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-05-16 09:07:39 +08:00