mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/pv: Format lib.rs and req.rs
Command line used: rustfmt --config group_imports=StdExternalCrate,imports_granularity=Crate Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
4cd7e8fd9a
commit
e480c4738d
@@ -49,8 +49,7 @@ mod verify;
|
||||
#[allow(dead_code)]
|
||||
pub mod test_utils;
|
||||
|
||||
pub use pv_core::assert_size;
|
||||
pub use pv_core::static_assert;
|
||||
pub use pv_core::{assert_size, static_assert};
|
||||
|
||||
const PAGESIZE: usize = 0x1000;
|
||||
|
||||
@@ -61,42 +60,45 @@ pub mod uv {
|
||||
|
||||
/// Functionalities for creating attestation requests
|
||||
pub mod attest {
|
||||
pub use pv_core::attest::*;
|
||||
|
||||
pub use crate::uvattest::{
|
||||
additional::AdditionalData,
|
||||
arcb::{AttestationAuthenticated, AttestationRequest},
|
||||
arcb::{AttestationFlags, AttestationVersion},
|
||||
arcb::{
|
||||
AttestationAuthenticated, AttestationFlags, AttestationRequest, AttestationVersion,
|
||||
},
|
||||
attest::{AttestationItems, AttestationMeasurement},
|
||||
};
|
||||
pub use pv_core::attest::*;
|
||||
}
|
||||
|
||||
/// Miscellaneous functions and definitions
|
||||
pub mod misc {
|
||||
pub use crate::utils::read_certs;
|
||||
pub use pv_core::misc::*;
|
||||
|
||||
pub use crate::utils::read_certs;
|
||||
}
|
||||
|
||||
pub use crate::error::HkdVerifyErrorType;
|
||||
pub use error::{Error, Result};
|
||||
pub use pv_core::Error as PvCoreError;
|
||||
pub use pv_core::{FileAccessErrorType, FileIoErrorType};
|
||||
pub use pv_core::{Error as PvCoreError, FileAccessErrorType, FileIoErrorType};
|
||||
|
||||
pub use crate::error::HkdVerifyErrorType;
|
||||
|
||||
/// Functionalities to build UV requests
|
||||
pub mod request {
|
||||
pub use crate::brcb::BootHdrTags;
|
||||
pub use crate::crypto::{
|
||||
decrypt_aead, derive_aes256_gcm_key, encrypt_aead, gen_ec_key, random_array,
|
||||
AeadDecryptionResult, AeadEncryptionResult, Aes256GcmKey, Aes256XtsKey, SymKey, SymKeyType,
|
||||
pub use crate::{
|
||||
brcb::BootHdrTags,
|
||||
crypto::{
|
||||
decrypt_aead, derive_aes256_gcm_key, encrypt_aead, gen_ec_key, random_array,
|
||||
AeadDecryptionResult, AeadEncryptionResult, Aes256GcmKey, Aes256XtsKey, SymKey,
|
||||
SymKeyType,
|
||||
},
|
||||
req::{EcPubKeyCoord, Encrypt, Keyslot, ReqEncrCtx, Request},
|
||||
verify::{CertVerifier, HkdVerifier, NoVerifyHkd},
|
||||
};
|
||||
pub use crate::req::{EcPubKeyCoord, Encrypt, Keyslot, ReqEncrCtx, Request};
|
||||
pub use crate::verify::{CertVerifier, HkdVerifier, NoVerifyHkd};
|
||||
|
||||
/// Reexports some useful OpenSSL symbols
|
||||
pub mod openssl {
|
||||
pub use openssl::error::ErrorStack;
|
||||
pub use openssl::hash::DigestBytes;
|
||||
pub use openssl::pkey;
|
||||
pub use openssl::x509;
|
||||
pub use openssl::{error::ErrorStack, hash::DigestBytes, pkey, x509};
|
||||
}
|
||||
|
||||
pub use pv_core::request::*;
|
||||
@@ -104,11 +106,12 @@ pub mod request {
|
||||
|
||||
/// Functionalities for creating add-secret requests
|
||||
pub mod secret {
|
||||
pub use pv_core::secret::*;
|
||||
|
||||
pub use crate::uvsecret::{
|
||||
asrcb::{AddSecretFlags, AddSecretRequest, AddSecretVersion},
|
||||
ext_secret::ExtSecret,
|
||||
guest_secret::GuestSecret,
|
||||
user_data::verify_asrcb_and_get_user_data,
|
||||
};
|
||||
pub use pv_core::secret::*;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright IBM Corp. 2023
|
||||
|
||||
use crate::assert_size;
|
||||
use crate::crypto::{
|
||||
decrypt_aead, derive_aes256_gcm_key, encrypt_aead, gen_ec_key, hash, random_array,
|
||||
AeadEncryptionResult, SymKey, SymKeyType,
|
||||
};
|
||||
use crate::misc::to_u32;
|
||||
use crate::request::Confidential;
|
||||
use crate::{Error, Result};
|
||||
use openssl::bn::{BigNum, BigNumContext};
|
||||
use openssl::ec::{EcGroup, EcGroupRef, EcKey, EcPointRef};
|
||||
use openssl::error::ErrorStack;
|
||||
use openssl::hash::{DigestBytes, MessageDigest};
|
||||
use openssl::nid::Nid;
|
||||
use openssl::pkey::{PKey, PKeyRef, Private, Public};
|
||||
use pv_core::request::{RequestMagic, RequestVersion};
|
||||
use std::convert::TryInto;
|
||||
use std::mem::size_of;
|
||||
|
||||
use openssl::{
|
||||
bn::{BigNum, BigNumContext},
|
||||
ec::{EcGroup, EcGroupRef, EcKey, EcPointRef},
|
||||
error::ErrorStack,
|
||||
hash::{DigestBytes, MessageDigest},
|
||||
nid::Nid,
|
||||
pkey::{PKey, PKeyRef, Private, Public},
|
||||
};
|
||||
use pv_core::request::{RequestMagic, RequestVersion};
|
||||
use zerocopy::{AsBytes, BigEndian, FromBytes, FromZeroes, U32};
|
||||
|
||||
use crate::{
|
||||
assert_size,
|
||||
crypto::{
|
||||
decrypt_aead, derive_aes256_gcm_key, encrypt_aead, gen_ec_key, hash, random_array,
|
||||
AeadEncryptionResult, SymKey, SymKeyType,
|
||||
},
|
||||
misc::to_u32,
|
||||
request::Confidential,
|
||||
Error, Result,
|
||||
};
|
||||
/// Encrypt a _secret_ using self and a given private key.
|
||||
pub trait Encrypt {
|
||||
/// Encrypts `secret` using `self` and `priv_key` the encryption.
|
||||
@@ -517,9 +520,7 @@ impl<'a> BinReqValues<'a> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::get_test_asset;
|
||||
use crate::request::SymKey;
|
||||
use crate::test_utils::*;
|
||||
use crate::{get_test_asset, request::SymKey, test_utils::*};
|
||||
|
||||
static TEST_MAGIC: [u8; 8] = 0x12345689abcdef00u64.to_be_bytes();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user