diff --git a/rust/pvimg/src/cli.rs b/rust/pvimg/src/cli.rs index 929babd0..8b63be4f 100644 --- a/rust/pvimg/src/cli.rs +++ b/rust/pvimg/src/cli.rs @@ -124,6 +124,22 @@ pub struct CreateBootImageLegacyFlags { /// functions. #[arg(long, action = clap::ArgAction::SetTrue, conflicts_with="enable_pckmo", group="header-flags")] pub disable_pckmo: Option, + + /// Enable the support for the HMAC PCKMO key encryption function. + #[arg(long, action = clap::ArgAction::SetTrue, group="header-flags")] + pub enable_pckmo_hmac: Option, + + /// Disable the support for the HMAC PCKMO key encryption function (default). + #[arg(long, action = clap::ArgAction::SetTrue, conflicts_with="enable_pckmo_hmac", group="header-flags")] + pub disable_pckmo_hmac: Option, + + /// Enable the support for backup target keys. + #[arg(long, action = clap::ArgAction::SetTrue, group="header-flags")] + pub enable_backup_keys: Option, + + /// Disable the support for backup target keys (default). + #[arg(long, action = clap::ArgAction::SetTrue, conflicts_with="enable_backup_keys", group="header-flags")] + pub disable_backup_keys: Option, } #[non_exhaustive] @@ -450,6 +466,8 @@ mod test { flat_map_collect(insert(mvca.clone(), vec![CliOption::new("x-psw", ["--x-psw", "0x0"])])), flat_map_collect(insert(mvca.clone(), vec![CliOption::new("no-component-check", ["--no-component-check"])])), flat_map_collect(insert(mvca.clone(), vec![CliOption::new("enable-pckmo", ["--enable-pckmo"])])), + flat_map_collect(insert(mvca.clone(), vec![CliOption::new("enable-pckmo-hmac", ["--enable-pckmo-hmac"])])), + flat_map_collect(insert(mvca.clone(), vec![CliOption::new("enable-backup-keys", ["--enable-backup-keys"])])), ]; let invalid_create_args = [ flat_map_collect(remove(mvcanv.clone(), "no-verify")), diff --git a/rust/pvimg/src/cmd/create.rs b/rust/pvimg/src/cmd/create.rs index a22f244e..b696d790 100644 --- a/rust/pvimg/src/cmd/create.rs +++ b/rust/pvimg/src/cmd/create.rs @@ -68,6 +68,18 @@ fn parse_flags( PcfV1::PckmoDeaTdea, PcfV1::PckmoEcc, ]))), + lf.disable_pckmo_hmac + .filter(|x| *x) + .and(Some(PcfV1::all_disabled([PcfV1::PckmoHmac]))), + lf.enable_pckmo_hmac + .filter(|x| *x) + .and(Some(PcfV1::all_enabled([PcfV1::PckmoHmac]))), + lf.disable_backup_keys + .filter(|x| *x) + .and(Some(PcfV1::all_disabled([PcfV1::BackupTargetKeys]))), + lf.enable_backup_keys + .filter(|x| *x) + .and(Some(PcfV1::all_enabled([PcfV1::BackupTargetKeys]))), ] .into_iter() .flatten()