mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Add a HostKey enum (currently V1(PKey<Public>)) and introduce a versioned Keyslot enum (V1(KeyslotV1)). Rename the existing Keyslot type to KeyslotV1 to prepare for future format extensions. Update pv, pvattest, pvimg, and pvsecret to use the new enums. Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Timo Keller <tkeller@linux.ibm.com> Signed-off-by: Marc Hartmayer <marc@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
31 lines
542 B
Rust
31 lines
542 B
Rust
// SPDX-License-Identifier: MIT
|
|
//
|
|
// Copyright IBM Corp.
|
|
|
|
//! Host key types for UV requests
|
|
|
|
use openssl::pkey::{PKey, Public};
|
|
|
|
/// Versioned host keys container
|
|
#[non_exhaustive]
|
|
#[derive(Clone, Debug)]
|
|
pub enum HostKey {
|
|
/// ECDH public key
|
|
V1(PKey<Public>),
|
|
}
|
|
|
|
impl HostKey {
|
|
/// Return the ECDH public key
|
|
pub fn ec_key(&self) -> &PKey<Public> {
|
|
match self {
|
|
HostKey::V1(ec_key) => ec_key,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl AsRef<HostKey> for HostKey {
|
|
fn as_ref(&self) -> &HostKey {
|
|
self
|
|
}
|
|
}
|