mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/pvimg: Make PCKMO plaintext control flags a constant
The PCKMO plaintext control flags are used in several places as is and are also to be used in an upcoming unit test. Make them a constant. Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com> Signed-off-by: Jakob Naucke <naucke@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
76bddf9715
commit
ec10654c35
@@ -58,16 +58,10 @@ fn parse_flags(
|
||||
.and(Some(PcfV1::all_enabled([PcfV1::AllowDumping]))),
|
||||
lf.disable_pckmo
|
||||
.filter(|x| *x)
|
||||
.and(Some(PcfV1::all_disabled([
|
||||
PcfV1::PckmoAes,
|
||||
PcfV1::PckmoDeaTdea,
|
||||
PcfV1::PckmoEcc,
|
||||
]))),
|
||||
lf.enable_pckmo.filter(|x| *x).and(Some(PcfV1::all_enabled([
|
||||
PcfV1::PckmoAes,
|
||||
PcfV1::PckmoDeaTdea,
|
||||
PcfV1::PckmoEcc,
|
||||
]))),
|
||||
.and(Some(PcfV1::all_disabled(PlaintextControlFlagsV1::PCKMO))),
|
||||
lf.enable_pckmo
|
||||
.filter(|x| *x)
|
||||
.and(Some(PcfV1::all_enabled(PlaintextControlFlagsV1::PCKMO))),
|
||||
lf.disable_pckmo_hmac
|
||||
.filter(|x| *x)
|
||||
.and(Some(PcfV1::all_disabled([PcfV1::PckmoHmac]))),
|
||||
|
||||
@@ -169,14 +169,13 @@ pub enum PcfV1 {
|
||||
BackupTargetKeys = 62,
|
||||
}
|
||||
pub type PlaintextControlFlagsV1 = ControlFlags<PcfV1>;
|
||||
impl PlaintextControlFlagsV1 {
|
||||
pub const PCKMO: [PcfV1; 3] = [PcfV1::PckmoAes, PcfV1::PckmoDeaTdea, PcfV1::PckmoEcc];
|
||||
}
|
||||
|
||||
impl Default for PlaintextControlFlagsV1 {
|
||||
fn default() -> Self {
|
||||
Self::from_flags(PcfV1::all_enabled([
|
||||
PcfV1::PckmoAes,
|
||||
PcfV1::PckmoDeaTdea,
|
||||
PcfV1::PckmoEcc,
|
||||
]))
|
||||
Self::from_flags(PcfV1::all_enabled(PlaintextControlFlagsV1::PCKMO))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user