vtpm: fix unseal failure when SHA256 PCR bank is disabled#5975
Conversation
When the SHA256 PCR bank is not available, unseal was failing because UnsealDiskKeyWithRecovery requires it. Now the code checks for the bank first and falls back to FetchVaultKey. Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
|
Claude finished @rene's task in 2m 7s —— View job Code Review
The fix is logically correct — falling back to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5975 +/- ##
==========================================
+ Coverage 20.64% 21.07% +0.42%
==========================================
Files 489 499 +10
Lines 90373 92071 +1698
==========================================
+ Hits 18656 19402 +746
- Misses 70138 70911 +773
- Partials 1579 1758 +179 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
eriknordmark
left a comment
There was a problem hiding this comment.
Run tests while code review comments are reviewed
|
@shjala are there any things to change based on the Claude review comments? Note that the CI upgrade failures are due to a know eden test regression (fix in review) |
Yes, I'll push the changes today. |
Added a SHA256_BANK variable that, when set to N, initializes the swtpm state using swtpm_setup with only the SHA1 PCR bank before starting the emulator. This is useful for testing the vtpm unseal fallback path that activates when the SHA256 bank is not available. Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
Description
When the SHA256 PCR bank is not available in the TPM (e.g. the device was initialized without it),
UnsealDiskKeyWithRecoverywould fail because it requires the SHA256 bank. The vtpm unseal path now checks for the bank's availability first and falls back toFetchVaultKeywhen it is missing.A new
SHA256_BANK=Nmake option was also added to make it easy to reproduce this condition locally. When set, it initializes the swtpm state usingswtpm_setupwith only the SHA1 PCR bank before starting the emulator.How to test and validate this PR
Build and run EVE with a vTPM that has the SHA256 PCR bank disabled:
Confirm that the vault unseals successfully and no error is logged
related to the SHA256 bank.
Deploy and app and make sure vTPM is available.
Changelog notes
No user-facing changes. Internal fix to the vtpm vault unseal path to
handle TPM configurations where the SHA256 PCR bank is not active.
PR Backports
Checklist
check them.