mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/pv*: Add support for CCK update
The ultravisor supports a new secret type in `add-secret` to update the customer communication key (CCK). Support this new secret type (0x16). [seiden@linux.ibm.com: Constify CCK Header struct usage] Acked-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@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
b11bb64732
commit
443652dcd2
@@ -217,6 +217,16 @@ pub enum AddSecretType {
|
||||
#[arg(long = "type", value_name = "TYPE")]
|
||||
kind: RetrieveableSecretInpKind,
|
||||
},
|
||||
|
||||
/// Update customer communication key.
|
||||
///
|
||||
/// Insert a customer communication key into a guest.
|
||||
#[command(visible_alias = "cck")]
|
||||
UpdateCck {
|
||||
/// Use CCK-FILE as new CCK.
|
||||
#[arg(long, value_name = "CCK-FILE", value_hint = ValueHint::FilePath)]
|
||||
secret: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)]
|
||||
@@ -474,6 +484,7 @@ mod test {
|
||||
vec!["pvsecret", "add"],
|
||||
vec!["pvsecret", "create", "-k", "abc", "--hdr", "abc", "-o", "abc", "--no-verify", "meta"],
|
||||
vec!["pvsecret", "create", "-k", "abc", "--hdr", "abc", "-o", "abc", "--no-verify", "association", "name" ],
|
||||
vec!["pvsecret", "create", "-k", "abc", "--hdr", "abc", "-o", "abc", "--no-verify", "update-cck", "--secret", "abc"],
|
||||
// verify that arguments stay backwards compatible
|
||||
vec!["pvsecret", "create", "-k", "abc,cdef", "--hdr", "abc", "-o", "abc", "-C", "uuu,ggg", "--crl", "yyy,hhh", "--root-ca", "tttt",
|
||||
"--extension-secret", "fff", "--cuid", "cuid", "--flags", "disable-dump", "meta"],
|
||||
@@ -501,6 +512,7 @@ mod test {
|
||||
vec!["pvsecret", "create", "-k", "abc", "--hdr", "abc", "-o", "abc", "--no-verify", "--cuid", "abc", "--cuid_hex", "9", "null"],
|
||||
vec!["pvsecret", "create", "-k", "abc", "--hdr", "abc", "-o", "abc", "--no-verify", "association"],
|
||||
vec!["pvsecret", "create", "-k", "abc", "--hdr", "abc", "-o", "abc", "--no-verify", "association", "name", "--output-secret", "secret", "--input-secret", "secret"],
|
||||
vec!["pvsecret", "create", "-k", "abc", "--hdr", "abc", "-o", "abc", "--no-verify", "update-cck"],
|
||||
];
|
||||
for arg in valid_args {
|
||||
let res = CliOptions::try_parse_from(&arg);
|
||||
|
||||
@@ -109,6 +109,9 @@ fn build_asrcb(opt: &CreateSecretOpt) -> Result<AddSecretRequest> {
|
||||
AddSecretType::Retrievable {
|
||||
name, secret, kind, ..
|
||||
} => retrievable(name, secret, kind)?,
|
||||
AddSecretType::UpdateCck { secret } => {
|
||||
GuestSecret::update_cck(read_exact_file(secret, "CCK file")?)
|
||||
}
|
||||
};
|
||||
trace!("AddSecret: {secret:x?}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user