feat(tpm): initial tpm support code, we just tell systemd about the pcr banks right now

This commit is contained in:
2025-10-31 01:30:07 -04:00
parent 6602e1d69e
commit 81cf331158
4 changed files with 118 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ use crate::options::SproutOptions;
use crate::options::parser::OptionsRepresentable;
use crate::phases::phase;
use crate::platform::timer::PlatformTimer;
use crate::platform::tpm::PlatformTpm;
use crate::secure::SecureBoot;
use crate::utils::PartitionGuidForm;
use anyhow::{Context, Result, bail};
@@ -92,6 +93,13 @@ fn run() -> Result<()> {
BootloaderInterface::set_loader_info()
.context("unable to set loader info in bootloader interface")?;
// Acquire the number of active PCR banks on the TPM.
// If no TPM is available, this will return zero.
let active_pcr_banks = PlatformTpm::active_pcr_banks()?;
// Tell the bootloader interface what the number of active PCR banks is.
BootloaderInterface::set_tpm2_active_pcr_banks(active_pcr_banks)
.context("unable to set tpm2 active PCR banks in bootloader interface")?;
// Parse the options to the sprout executable.
let options = SproutOptions::parse().context("unable to parse options")?;