diff --git a/rust/pv/src/openssl_extensions/crl.rs b/rust/pv/src/openssl_extensions/crl.rs index 1a75dce9..3affd68b 100644 --- a/rust/pv/src/openssl_extensions/crl.rs +++ b/rust/pv/src/openssl_extensions/crl.rs @@ -77,7 +77,7 @@ impl X509StoreContextExtension for X509StoreContextRef { { struct Cleanup<'a>(&'a mut X509StoreContextRef); - impl<'a> Drop for Cleanup<'a> { + impl Drop for Cleanup<'_> { fn drop(&mut self) { unsafe { openssl_sys::X509_STORE_CTX_cleanup(self.0.as_ptr()); diff --git a/rust/pv/src/openssl_extensions/stackable_crl.rs b/rust/pv/src/openssl_extensions/stackable_crl.rs index b13572ca..aef7cf86 100644 --- a/rust/pv/src/openssl_extensions/stackable_crl.rs +++ b/rust/pv/src/openssl_extensions/stackable_crl.rs @@ -63,7 +63,7 @@ impl Stackable for StackableX509Crl { } pub struct MemBioSlice<'a>(*mut openssl_sys::BIO, PhantomData<&'a [u8]>); -impl<'a> Drop for MemBioSlice<'a> { +impl Drop for MemBioSlice<'_> { fn drop(&mut self) { unsafe { openssl_sys::BIO_free_all(self.0); diff --git a/rust/pv/src/req.rs b/rust/pv/src/req.rs index d8e9d7df..af504fd3 100644 --- a/rust/pv/src/req.rs +++ b/rust/pv/src/req.rs @@ -288,7 +288,7 @@ impl EcPubKeyCoord { hash(MessageDigest::sha256(), self.as_ref()) } - /// Construct a [``EcPubKeyCoord] + /// Construct a [`EcPubKeyCoord`] /// /// # Safety /// This function is marked unsafe, because data not representing two EC points violates the diff --git a/rust/pv/src/verify.rs b/rust/pv/src/verify.rs index 161c2e67..05da3d9f 100644 --- a/rust/pv/src/verify.rs +++ b/rust/pv/src/verify.rs @@ -168,7 +168,7 @@ impl CertVerifier { /// * `crl_paths` - Paths to certificate revocation lists for the chain of trust /// * `root_ca_path` - Path to the root of trust /// * `offline` - if set to true the verification process will not try to download CRLs from the - /// internet. + /// internet. /// /// # Errors /// diff --git a/rust/pv/src/verify/helper.rs b/rust/pv/src/verify/helper.rs index f7d009c5..6318bf29 100644 --- a/rust/pv/src/verify/helper.rs +++ b/rust/pv/src/verify/helper.rs @@ -25,7 +25,7 @@ use std::str::from_utf8; use std::{cmp::Ordering, ffi::c_int}; /// Minimum security level for the keys/certificates used to establish a chain of -/// trust (see https://www.openssl.org/docs/man1.1.1/man3/X509_VERIFY_PARAM_set_auth_level.html +/// trust (see /// for details). const SECURITY_LEVEL: usize = 2; const SECURITY_BITS_ARRAY: [u32; 6] = [0, 80, 112, 128, 192, 256]; @@ -213,7 +213,7 @@ fn is_ibm_signing_cert(cert: &X509) -> bool { return false; } - return match subj.entries_by_nid(Nid::ORGANIZATIONALUNITNAME).next() { + match subj.entries_by_nid(Nid::ORGANIZATIONALUNITNAME).next() { None => false, Some(entry) => match entry.data().as_utf8() { Err(_) => false, @@ -221,7 +221,7 @@ fn is_ibm_signing_cert(cert: &X509) -> bool { .as_bytes() .ends_with(IBM_Z_ORGANIZATIONAL_UNIT_NAME_SUFFIX.as_bytes()), }, - }; + } } fn get_ibm_z_sign_key(certs: &[X509]) -> Result { diff --git a/rust/pv_core/src/uvdevice/attest.rs b/rust/pv_core/src/uvdevice/attest.rs index 66be3966..3614928a 100644 --- a/rust/pv_core/src/uvdevice/attest.rs +++ b/rust/pv_core/src/uvdevice/attest.rs @@ -152,9 +152,8 @@ impl AttestationCmd { /// If called before a successful attestation the data in this buffer is undefined. pub fn additional(&mut self) -> Option<&[u8]> { // truncate the add size to the UV reported size - match &mut self.additional { - Some(ref mut a) => a.truncate(self.uvio_attest.add_data_len as usize), - None => (), + if let Some(ref mut a) = &mut self.additional { + a.truncate(self.uvio_attest.add_data_len as usize) } self.additional.as_deref() } diff --git a/rust/pv_core/src/uvdevice/secret.rs b/rust/pv_core/src/uvdevice/secret.rs index 277fe691..6c22b6ed 100644 --- a/rust/pv_core/src/uvdevice/secret.rs +++ b/rust/pv_core/src/uvdevice/secret.rs @@ -53,8 +53,8 @@ impl AddCmd { /// /// # Errors /// - /// This function will return an error if the provided data does not start with the - /// [`crate::AddSecretRequest`] magic Value. + /// This function will return an error if the provided data does not start + /// with the `AddSecretRequest` magic Value. pub fn new(bin_add_secret_req: &mut R) -> Result { let mut data = Vec::with_capacity(PAGESIZE); bin_add_secret_req.read_to_end(&mut data)?; diff --git a/rust/pv_core/src/uvdevice/secret_list.rs b/rust/pv_core/src/uvdevice/secret_list.rs index 8aab4359..d20928b5 100644 --- a/rust/pv_core/src/uvdevice/secret_list.rs +++ b/rust/pv_core/src/uvdevice/secret_list.rs @@ -337,7 +337,7 @@ where { struct FieldVisitor; - impl<'de> serde::de::Visitor<'de> for FieldVisitor { + impl serde::de::Visitor<'_> for FieldVisitor { type Value = [u8; SecretId::ID_SIZE]; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/rust/pv_core/src/uvsecret.rs b/rust/pv_core/src/uvsecret.rs index c0765e8f..41b6eebe 100644 --- a/rust/pv_core/src/uvsecret.rs +++ b/rust/pv_core/src/uvsecret.rs @@ -11,7 +11,7 @@ use byteorder::{BigEndian, ByteOrder}; use std::{fmt::Display, mem::size_of}; use zerocopy::{AsBytes, U16}; -/// The magic value used to identify an [`crate:AddSecretRequest`] +/// The magic value used to identify an `AddSecretRequest`. /// /// The magic value is ASCII: /// ```rust diff --git a/rust/pvattest/src/cli.rs b/rust/pvattest/src/cli.rs index 08b894d3..91f079aa 100644 --- a/rust/pvattest/src/cli.rs +++ b/rust/pvattest/src/cli.rs @@ -122,6 +122,7 @@ pub struct PerformAttOpt { } #[cfg(target_arch = "s390x")] +#[derive(Debug)] pub struct PerformAttOptComb<'a> { pub input: &'a str, pub output: &'a str, diff --git a/rust/pvattest/src/cmd/verify.rs b/rust/pvattest/src/cmd/verify.rs index b1270905..b46669e3 100644 --- a/rust/pvattest/src/cmd/verify.rs +++ b/rust/pvattest/src/cmd/verify.rs @@ -50,7 +50,7 @@ impl<'a> VerifyOutput<'a> { } } -impl<'a> Display for VerifyOutput<'a> { +impl Display for VerifyOutput<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { writeln!(f, "Config UID:")?; writeln!(f, "{:#}", self.cuid)?; diff --git a/rust/pvattest/src/main.rs b/rust/pvattest/src/main.rs index 9e756b9b..daf93614 100644 --- a/rust/pvattest/src/main.rs +++ b/rust/pvattest/src/main.rs @@ -16,7 +16,7 @@ use utils::{print_cli_error, print_error, print_version, PvLogger}; use crate::cmd::*; static LOGGER: PvLogger = PvLogger; -const FEATURES: &[&[&str]] = &[cmd::CMD_FN, cmd::UV_CMD_FN]; +const FEATURES: &[&[&str]] = &[CMD_FN, UV_CMD_FN]; const EXIT_CODE_ATTESTATION_FAIL: u8 = 2; const EXIT_CODE_LOGGER_FAIL: u8 = 3; diff --git a/rust/pvsecret/src/cli.rs b/rust/pvsecret/src/cli.rs index 7387a754..6deaaebd 100644 --- a/rust/pvsecret/src/cli.rs +++ b/rust/pvsecret/src/cli.rs @@ -115,7 +115,7 @@ pub struct CreateSecretOpt { /// Use the content of FILE as user-data. /// - /// Passes user data defined in through the add-secret request to the ultravisor. The + /// Passes user data defined in FILE through the add-secret request to the ultravisor. The /// user data can be up to 512 bytes of arbitrary data, and the maximum size depends on the /// size of the user-signing key: /// - No key: user data can be 512 bytes. @@ -129,7 +129,7 @@ pub struct CreateSecretOpt { /// Use the content of FILE as user signing key. /// - /// Adds a signature calculated from the key in to the add-secret request. The + /// Adds a signature calculated from the key in FILE to the add-secret request. The /// file must be in DER or PEM format containing a private key. Supported are RSA 2048 & /// 3072-bit and EC(secp521r1) keys. The firmware ignores the content, but the request tag /// protects the signature. The user-signing key signs the request. The location of the diff --git a/rust/pvsecret/src/cmd/create.rs b/rust/pvsecret/src/cmd/create.rs index 8e861dd7..ea76a630 100644 --- a/rust/pvsecret/src/cmd/create.rs +++ b/rust/pvsecret/src/cmd/create.rs @@ -141,7 +141,7 @@ fn build_asrcb(opt: &CreateSecretOpt) -> Result { // Try to extract a Config-UId from a yaml structure // The cuid field can be embedded in an abritray amount of Mappings // The function takes the first cuid it founds (width search). -fn try_from_val(val: Value) -> anyhow::Result { +fn try_from_val(val: Value) -> Result { fn get_cuid_from_mapping(val: &Value, depth: u8) -> Option { if depth >= 8 { return None; diff --git a/rust/utils/src/hexslice.rs b/rust/utils/src/hexslice.rs index 04b2b40d..768db3ae 100644 --- a/rust/utils/src/hexslice.rs +++ b/rust/utils/src/hexslice.rs @@ -30,7 +30,7 @@ where } } -impl<'a> Serialize for HexSlice<'a> { +impl Serialize for HexSlice<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer,