mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 18:40:18 +00:00
fix(tpm): correctly write the log name, and change the sprout configuration event name
This commit is contained in:
@@ -24,7 +24,11 @@ fn load_raw_config(options: &SproutOptions) -> Result<Vec<u8>> {
|
|||||||
.context("unable to read sprout config file")?;
|
.context("unable to read sprout config file")?;
|
||||||
|
|
||||||
// Measure the sprout.toml into the TPM, if needed and possible.
|
// Measure the sprout.toml into the TPM, if needed and possible.
|
||||||
PlatformTpm::log_event(PlatformTpm::PCR_BOOT_LOADER_CONFIG, &content, "sprout.toml")
|
PlatformTpm::log_event(
|
||||||
|
PlatformTpm::PCR_BOOT_LOADER_CONFIG,
|
||||||
|
&content,
|
||||||
|
"sprout: configuration file",
|
||||||
|
)
|
||||||
.context("unable to measure the sprout.toml file into the TPM")?;
|
.context("unable to measure the sprout.toml file into the TPM")?;
|
||||||
|
|
||||||
// Return the contents of the sprout config file.
|
// Return the contents of the sprout config file.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use crate::utils;
|
use crate::utils;
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
use uefi::ResultExt;
|
||||||
use uefi::boot::ScopedProtocol;
|
use uefi::boot::ScopedProtocol;
|
||||||
use uefi::proto::tcg::PcrIndex;
|
use uefi::proto::tcg::PcrIndex;
|
||||||
use uefi::proto::tcg::v2::{PcrEventInputs, Tcg};
|
use uefi::proto::tcg::v2::{PcrEventInputs, Tcg};
|
||||||
@@ -110,13 +111,11 @@ impl PlatformTpm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Encode the description as a UTF-16 little endian string.
|
// Encode the description as a UTF-16 little endian string.
|
||||||
let description = description
|
let description = description.as_bytes().to_vec();
|
||||||
.encode_utf16()
|
|
||||||
.flat_map(|c| c.to_le_bytes())
|
|
||||||
.collect::<Vec<u8>>();
|
|
||||||
|
|
||||||
// Construct an event input for the TPM.
|
// Construct an event input for the TPM.
|
||||||
let event = PcrEventInputs::new_in_box(pcr_index, EventType::IPL, &description)
|
let event = PcrEventInputs::new_in_box(pcr_index, EventType::IPL, &description)
|
||||||
|
.discard_errdata()
|
||||||
.context("unable to construct pcr event inputs")?;
|
.context("unable to construct pcr event inputs")?;
|
||||||
|
|
||||||
// Log the event into the TPM.
|
// Log the event into the TPM.
|
||||||
|
|||||||
Reference in New Issue
Block a user