Skip to content

Commit 39cefcc

Browse files
committed
WORKAROUND: handle unique image combination case
This is an edge case that the compute-pcrs library should be able to handle by itself. A PR with a fix has been opened, but not merged yet trusted-execution-clusters/compute-pcrs#56 Once fixed and merged, I will remove this workaround.
1 parent 7a35ae9 commit 39cefcc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

operator/src/trustee.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use anyhow::{Context, Result};
88
use base64::{Engine as _, engine::general_purpose};
99
use clevis_pin_trustee_lib::Key as ClevisKey;
10+
use compute_pcrs_lib::pcrs::compile_pcrs;
1011
use compute_pcrs_lib::tpmevents::TPMEvent;
1112
use compute_pcrs_lib::tpmevents::combine::combine_images;
1213
use hex;
@@ -76,7 +77,10 @@ fn recompute_reference_values(image_pcrs: ImagePcrs) -> Vec<ReferenceValue> {
7677
.map(|v| v.pcrs.iter().flat_map(|p| p.events.clone()).collect())
7778
.collect();
7879

79-
let pcr_combinations = combine_images(&tpm_events);
80+
let pcr_combinations = match image_pcrs.0.len() {
81+
1 => vec![compile_pcrs(&tpm_events[0])],
82+
_ => combine_images(&tpm_events),
83+
};
8084
for pcr in pcr_combinations.iter().flatten() {
8185
reference_values_in
8286
.entry(format!("pcr{}", pcr.id))

0 commit comments

Comments
 (0)