mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
pv + tools: Introduce versioned HostKey and Keyslot enums
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>
This commit is contained in:
committed by
Jan Höppner
parent
d82beef937
commit
e4e455630b
@@ -11,8 +11,8 @@ use openssl::nid::Nid;
|
||||
use openssl::pkey::{PKeyRef, Public};
|
||||
use pv::request::openssl::pkey::{PKey, Private};
|
||||
use pv::request::{
|
||||
gen_ec_key, random_array, Aes256XtsKey, Confidential, EcPubKeyCoord, Encrypt, Keyslot, SymKey,
|
||||
SymKeyType, Zeroize, SHA_512_HASH_LEN,
|
||||
gen_ec_key, random_array, Aes256XtsKey, Confidential, EcPubKeyCoord, Encrypt, HostKey, Keyslot,
|
||||
SymKey, SymKeyType, Zeroize, SHA_512_HASH_LEN,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utils::HexSlice;
|
||||
@@ -419,7 +419,7 @@ impl KeyExchangeBuilderTrait for SeHdrDataV1 {
|
||||
aead_key: &SymKey,
|
||||
priv_key: &PKeyRef<Private>,
|
||||
) -> Result<()> {
|
||||
let keyslot = Keyslot::new(hostkey.to_owned());
|
||||
let keyslot = Keyslot::new(HostKey::V1(hostkey.to_owned()));
|
||||
let keyslot_bin = keyslot.encrypt(aead_key.value(), priv_key)?.try_into()?;
|
||||
let keyslot_bin_size = u32::try_from(size_of_val(&keyslot_bin)).unwrap();
|
||||
self.aad.keyslots.push(keyslot_bin);
|
||||
|
||||
Reference in New Issue
Block a user