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:
Jakob Naucke
2025-04-25 15:49:29 +02:00
committed by Jan Höppner
parent b11bb64732
commit 443652dcd2
6 changed files with 152 additions and 4 deletions
@@ -0,0 +1,35 @@
.\" Copyright 2025 IBM Corp.
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH "PVSECRET-CREATE-UPDATE-CCK" "1" "2025-02-19" "s390-tools" "UV-Secret Manual"
.nh
.ad l
.SH NAME
pvsecret-create-update-cck \- Update customer communication key.
.SH SYNOPSIS
.nf
.fam C
pvsecret create update-cck [OPTIONS] \-\-secret <CCK\-FILE>
.fam C
.fi
.SH DESCRIPTION
Insert a customer communication key into a guest.
.SH OPTIONS
.PP
\-\-secret <CCK\-FILE>
.RS 4
Use CCK\-FILE as new CCK
.RE
.RE
.PP
\-h, \-\-help
.RS 4
Print help (see a summary with \fB\-h\fR).
.RE
.RE
.SH "SEE ALSO"
.sp
\fBpvsecret\fR(1) \fBpvsecret-create\fR(1)
+6 -1
View File
@@ -3,7 +3,7 @@
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH "PVSECRET-CREATE" "1" "2024-12-19" "s390-tools" "UV-Secret Manual"
.TH "PVSECRET-CREATE" "1" "2025-04-25" "s390-tools" "UV-Secret Manual"
.nh
.ad l
.SH NAME
@@ -47,6 +47,11 @@ Create an association secret
Create a retrievable secret
.RE
\fBpvsecret create-update-cck(1)\fR
.RS 4
Update customer communication key
.RE
.SH OPTIONS
.PP
\-k, \-\-host\-key\-document <FILE>
+12
View File
@@ -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);
+3
View File
@@ -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?}");