mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
pv: Change ec_key() to return Option<&PKeyRef<Public>>
Prepare the API for future host keys that might not have an EC key by returning Option instead of a direct reference. Additionally, use &PKeyRef<Public> as the borrowed view on PKey for better API consistency. Signed-off-by: Marc Hartmayer <marc@linux.ibm.com> Reviewed-by: Timo Keller <tkeller@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
91123e5d45
commit
1746d2bb6a
@@ -4,7 +4,7 @@
|
||||
|
||||
//! Host key types for UV requests
|
||||
|
||||
use openssl::pkey::{PKey, Public};
|
||||
use openssl::pkey::{PKey, PKeyRef, Public};
|
||||
|
||||
/// Versioned host keys container
|
||||
#[non_exhaustive]
|
||||
@@ -16,10 +16,10 @@ pub enum HostKey {
|
||||
|
||||
impl HostKey {
|
||||
/// Return the ECDH public key
|
||||
pub fn ec_key(&self) -> &PKey<Public> {
|
||||
match self {
|
||||
pub fn ec_key(&self) -> Option<&PKeyRef<Public>> {
|
||||
Some(match self {
|
||||
HostKey::V1(ec_key) => ec_key,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user