Skip to content

SecurityPkg: Remove Globals from HashLibTpm2PeilessSec#1752

Merged
Raymond-MS merged 3 commits intomicrosoft:release/202511from
Raymond-MS:personal/rdiaz/Tpm2StartupLibMeasurements
Apr 14, 2026
Merged

SecurityPkg: Remove Globals from HashLibTpm2PeilessSec#1752
Raymond-MS merged 3 commits intomicrosoft:release/202511from
Raymond-MS:personal/rdiaz/Tpm2StartupLibMeasurements

Conversation

@Raymond-MS
Copy link
Copy Markdown
Contributor

@Raymond-MS Raymond-MS commented Apr 7, 2026

Description

Updated the HashLibTpm2PeilessSec library to no longer use globals in SEC. When enabled on SBSA, this was causing a hang as functions attempted to set RO memory. Changed the code to query the relevant information each time it was needed either through the TPM or Transfer List. Added new helper functions to Tpm2Help which removes the need to have a duplicate hash struct.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

Built with the PeilessSecMeasureLib not set to the NULL instance on QEMU SBSA with the TPM enabled. Verified the library measure the FV and CRTM version.

Integration Instructions

It is better for us to continue using the NULL instance of the PeilessSecMeasureLib as the time it took to measure the FV was ~15 mins on QEMU SBSA with TPM support.

@Raymond-MS Raymond-MS requested review from cfernald and kuqin12 April 7, 2026 23:09
@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/Tpm2StartupLibMeasurements branch from a7e57ab to ac9be7f Compare April 7, 2026 23:11
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 0% with 172 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/202511@e7d4837). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...Pkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c 0.00% 117 Missing ⚠️
SecurityPkg/Library/Tpm2HelpLib/Tpm2Help.c 0.00% 55 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             release/202511   #1752   +/-   ##
================================================
  Coverage                  ?   1.61%           
================================================
  Files                     ?     159           
  Lines                     ?   37168           
  Branches                  ?     172           
================================================
  Hits                      ?     601           
  Misses                    ?   36567           
  Partials                  ?       0           
Flag Coverage Δ
SecurityPkg 1.61% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c
Comment thread SecurityPkg/Library/Tpm2HelpLib/Tpm2Help.c Outdated
Comment thread SecurityPkg/Include/Library/Tpm2HelpLib.h Outdated
Comment thread SecurityPkg/Include/Library/Tpm2HelpLib.h Outdated
Comment thread SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c Outdated
Comment thread SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c Outdated
@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/Tpm2StartupLibMeasurements branch from ac9be7f to 34ec97e Compare April 10, 2026 23:02
@mu-automation
Copy link
Copy Markdown
Contributor

mu-automation Bot commented Apr 10, 2026

⏩ QEMU Validation Skipped

The PR was merged before validation completed.

This comment was automatically generated by the Mu QEMU PR Validation workflow.

@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/Tpm2StartupLibMeasurements branch from 34ec97e to 59235a8 Compare April 13, 2026 18:20
@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/Tpm2StartupLibMeasurements branch from 59235a8 to a147905 Compare April 13, 2026 22:24
… incompatible with our QEMU SBSA platform. Adjusted the code to query for the supported hashing algoritms each time they are required. Added new helper functions to the Tpm2Help library which are used by the HashLib. This prevents the need for duplicate information between the files.
…tive PCR banks in the TPM. Added a check that prevents use of the supported hashing algorithms from the transfer list if they do not match the active PCR banks in the TPM.
@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/Tpm2StartupLibMeasurements branch from a147905 to 4adf025 Compare April 14, 2026 01:28
@Raymond-MS Raymond-MS merged commit e667c72 into microsoft:release/202511 Apr 14, 2026
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants