File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,12 @@ fn load_raw_config(options: &SproutOptions) -> Result<Vec<u8>> {
2424 . context ( "unable to read sprout config file" ) ?;
2525
2626 // Measure the sprout.toml into the TPM, if needed and possible.
27- PlatformTpm :: log_event ( PlatformTpm :: PCR_BOOT_LOADER_CONFIG , & content, "sprout.toml" )
28- . context ( "unable to measure the sprout.toml file into the TPM" ) ?;
27+ PlatformTpm :: log_event (
28+ PlatformTpm :: PCR_BOOT_LOADER_CONFIG ,
29+ & content,
30+ "sprout: configuration file" ,
31+ )
32+ . context ( "unable to measure the sprout.toml file into the TPM" ) ?;
2933
3034 // Return the contents of the sprout config file.
3135 Ok ( content)
Original file line number Diff line number Diff line change 11use crate :: utils;
22use anyhow:: { Context , Result } ;
3+ use uefi:: ResultExt ;
34use uefi:: boot:: ScopedProtocol ;
45use uefi:: proto:: tcg:: PcrIndex ;
56use uefi:: proto:: tcg:: v2:: { PcrEventInputs , Tcg } ;
@@ -110,13 +111,11 @@ impl PlatformTpm {
110111 } ;
111112
112113 // Encode the description as a UTF-16 little endian string.
113- let description = description
114- . encode_utf16 ( )
115- . flat_map ( |c| c. to_le_bytes ( ) )
116- . collect :: < Vec < u8 > > ( ) ;
114+ let description = description. as_bytes ( ) . to_vec ( ) ;
117115
118116 // Construct an event input for the TPM.
119117 let event = PcrEventInputs :: new_in_box ( pcr_index, EventType :: IPL , & description)
118+ . discard_errdata ( )
120119 . context ( "unable to construct pcr event inputs" ) ?;
121120
122121 // Log the event into the TPM.
You can’t perform that action at this time.
0 commit comments