rust/pv: Move confidential.rs to pv_core

Migrate Confidential to pv_core crate. This has no impact on the public
API of pv as the migrated symbols are reexported.
This enables pv_core to manage confidential data as well.

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Steffen Eiden
2024-06-26 14:07:24 +02:00
parent d1b5f80fe5
commit 516bd8c2cf
4 changed files with 6 additions and 4 deletions

View File

@@ -2,7 +2,6 @@
//
// Copyright IBM Corp. 2023, 2024
use crate::{confidential::Confidential, error::Result, Error};
use openssl::{
derive::Deriver,
ec::{EcGroup, EcKey},
@@ -16,8 +15,11 @@ use openssl::{
sign::{Signer, Verifier},
symm::{decrypt_aead, encrypt_aead, Cipher},
};
use pv_core::request::Confidential;
use std::{convert::TryInto, ops::Range};
use crate::{error::Result, Error};
/// An AES256-GCM key that will purge itself out of the memory when going out of scope
pub type Aes256Key = Confidential<[u8; 32]>;
pub(crate) const AES_256_GCM_TAG_SIZE: usize = 16;

View File

@@ -42,7 +42,6 @@
//! # Verify
//! [`attest::AttestationItems`], [`attest::AttestationMeasurement`]
mod brcb;
mod confidential;
mod crypto;
mod error;
mod openssl_extensions;
@@ -93,7 +92,6 @@ pub use pv_core::{FileAccessErrorType, FileIoErrorType};
/// Functionalities to build UV requests
pub mod request {
pub use crate::brcb::BootHdrTags;
pub use crate::confidential::{Confidential, Zeroize};
pub use crate::crypto::{SymKey, SymKeyType};
pub use crate::req::{Keyslot, ReqEncrCtx, Request};
pub use crate::verify::{CertVerifier, HkdVerifier, NoVerifyHkd};

View File

@@ -48,7 +48,7 @@ impl Zeroize for Vec<u8> {
/// Will never leak its wrapped value during [`Debug`]
///
/// ```rust
/// use s390_pv::request::Confidential;
/// # use s390_pv_core::request::Confidential;
/// fn foo(value: Confidential<[u8; 2]>) {
/// println!("value: {value:?}");
/// }

View File

@@ -10,6 +10,7 @@
unused_qualifications
)]
#![doc = include_str!("../README.md")]
mod confidential;
mod error;
mod macros;
mod utils;
@@ -46,6 +47,7 @@ pub mod uv {
/// Functionalities to verify UV requests
pub mod request {
pub use crate::confidential::{Confidential, Zeroize};
/// Version number of the request in system endianness
pub type RequestVersion = u32;
/// Request magic value