mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Provide and use a `workspace.lints` table. This makes it easier to maintain and to enforce one coding style. Let's explicitly disable the `missing_docs` linting rule for tests. MSRV for the lints table is 1.74 [1] [1] https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Acked-by: Finn Callies <fcallies@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
73 lines
2.4 KiB
Rust
73 lines
2.4 KiB
Rust
// SPDX-License-Identifier: MIT
|
|
//
|
|
// Copyright IBM Corp. 2023, 2024
|
|
#![doc = include_str!("../README.md")]
|
|
mod confidential;
|
|
mod error;
|
|
mod macros;
|
|
mod utils;
|
|
mod uvattest;
|
|
mod uvdevice;
|
|
mod uvsecret;
|
|
|
|
pub use error::{Error, FileAccessErrorType, FileIoErrorType, Result};
|
|
|
|
/// Functionalities for reading attestation requests
|
|
pub mod attest {
|
|
pub use crate::uvattest::{AttestationMagic, AttestationMeasAlg};
|
|
}
|
|
|
|
/// Miscellaneous functions and definitions
|
|
pub mod misc {
|
|
pub use crate::utils::pv_guest_bit_set;
|
|
pub use crate::utils::{create_file, open_file, read_exact_file, read_file, write_file};
|
|
pub use crate::utils::{decode_hex, parse_hex, to_u16, to_u32, try_parse_u128, try_parse_u64};
|
|
pub use crate::utils::{read, write};
|
|
pub use crate::utils::{Flags, Lsb0Flags64, Msb0Flags64};
|
|
}
|
|
|
|
/// Definitions and functions for interacting with the Ultravisor
|
|
///
|
|
/// For detailed Information on how to send Ultravisor Commands see [`crate::uv::UvDevice`] and
|
|
/// [`crate::uv::UvCmd`]
|
|
pub mod uv {
|
|
pub use crate::uvdevice::attest::AttestationCmd;
|
|
pub use crate::uvdevice::secret::{AddCmd, ListCmd, LockCmd};
|
|
pub use crate::uvdevice::secret_list::{ListableSecretType, SecretEntry, SecretId, SecretList};
|
|
pub use crate::uvdevice::{ConfigUid, UvCmd, UvDevice, UvDeviceInfo, UvFlags, UvcSuccess};
|
|
}
|
|
|
|
/// 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
|
|
///
|
|
/// The first 8 byte of a request providing an identifier of the request type
|
|
/// for programs
|
|
pub type RequestMagic = [u8; 8];
|
|
/// A `MagicValue` is a byte pattern, that indicates if a byte slice contains the specified
|
|
/// (binary) data.
|
|
pub trait MagicValue<const N: usize> {
|
|
/// Magic value as byte array
|
|
const MAGIC: [u8; N];
|
|
/// Test whether the given slice starts with the magic value.
|
|
fn starts_with_magic(v: &[u8]) -> bool {
|
|
if v.len() < Self::MAGIC.len() {
|
|
return false;
|
|
}
|
|
v[..Self::MAGIC.len()] == Self::MAGIC
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Functionalities for reading add-secret requests
|
|
pub mod secret {
|
|
pub use crate::uvsecret::AddSecretMagic;
|
|
pub use crate::uvsecret::UserDataType;
|
|
}
|
|
|
|
// Internal definitions/ imports
|
|
const PAGESIZE: usize = 0x1000;
|