mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/crypto: Implement Display for SymKeyType
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
cb0e119bed
commit
5a54722848
@@ -2,6 +2,8 @@
|
||||
//
|
||||
// Copyright IBM Corp. 2023, 2024
|
||||
|
||||
use std::{convert::TryInto, fmt::Display, ops::Range};
|
||||
|
||||
use enum_dispatch::enum_dispatch;
|
||||
use openssl::{
|
||||
derive::Deriver,
|
||||
@@ -17,7 +19,6 @@ use openssl::{
|
||||
symm::{decrypt_aead, encrypt_aead, Cipher},
|
||||
};
|
||||
use pv_core::request::Confidential;
|
||||
use std::{convert::TryInto, ops::Range};
|
||||
|
||||
use crate::{error::Result, Error};
|
||||
|
||||
@@ -49,6 +50,16 @@ impl SymKeyType {
|
||||
pub const Aes256: Self = Self::Aes256Gcm;
|
||||
}
|
||||
|
||||
impl Display for SymKeyType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let s = match self {
|
||||
Self::Aes256Gcm => "AES-256-GCM",
|
||||
Self::Aes256Xts => "AES-256-XTS",
|
||||
};
|
||||
write!(f, "{s}")
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SymKeyType> for Nid {
|
||||
fn from(value: SymKeyType) -> Self {
|
||||
match value {
|
||||
|
||||
Reference in New Issue
Block a user