Skip to content

Commit 0c7a05f

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 7588019 commit 0c7a05f

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 k8s_openapi::api::apps::v1::{Deployment, DeploymentSpec};
@@ -75,7 +76,10 @@ fn recompute_reference_values(image_pcrs: ImagePcrs) -> Vec<ReferenceValue> {
7576
.map(|v| v.pcrs.iter().flat_map(|p| p.events.clone()).collect())
7677
.collect();
7778

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

0 commit comments

Comments
 (0)