Skip to content

Commit

Permalink
Combine the two sss values into one
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Oct 30, 2024
1 parent 905b219 commit c4182ea
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/engine/strat_engine/crypt/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ fn traverse_clevis_config<T>(
recursion_limit: u64,
tang_func: &dyn Fn(&Map<String, Value>) -> StratisResult<T>,
tpm2_func: &dyn Fn(&Map<String, Value>) -> StratisResult<T>,
sss_base: &T,
sss_func: &dyn Fn(T, T) -> StratisResult<T>,
sss: &(&T, &dyn Fn(T, T) -> StratisResult<T>),
) -> StratisResult<T>
where
T: Clone,
Expand All @@ -233,17 +232,16 @@ where
} else if pin == "sss" {
if let Some(obj) = clevis_config.as_object() {
if let Some(obj) = obj.get("pins").and_then(|val| val.as_object()) {
obj.iter().try_fold(sss_base.clone(), |acc, (pin, config)| {
obj.iter().try_fold(sss.0.clone(), |acc, (pin, config)| {
let res = traverse_clevis_config(
pin,
config,
recursion_limit - 1,
tang_func,
tpm2_func,
sss_base,
sss_func,
sss,
)?;
sss_func(acc, res)
sss.1(acc, res)
})
} else {
Err(StratisError::Msg(
Expand Down Expand Up @@ -291,8 +289,7 @@ fn all_tang_configs_have_url_trust_info(
.unwrap_or(false))
},
&|_| Ok(true),
&true,
&|acc, premise| Ok(acc && premise),
&(&true, &|acc, premise| Ok(acc && premise)),
)
}

Expand Down

0 comments on commit c4182ea

Please sign in to comment.