rust/crypto: Export random_array

The function is useful, therefore export it.
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:
Marc Hartmayer
2024-10-15 16:46:20 +00:00
committed by Steffen Eiden
parent 385ba6b51f
commit dec796d52f
2 changed files with 2 additions and 2 deletions

View File

@@ -150,7 +150,7 @@ pub fn derive_aes256_gcm_key(k1: &PKeyRef<Private>, k2: &PKeyRef<Public>) -> Res
/// # Errors
///
/// This function will return an error if the entropy source fails or is not available.
pub(crate) fn random_array<const COUNT: usize>() -> Result<[u8; COUNT]> {
pub fn random_array<const COUNT: usize>() -> Result<[u8; COUNT]> {
let mut rand = [0; COUNT];
rand_bytes(&mut rand)?;
Ok(rand)

View File

@@ -92,7 +92,7 @@ pub use pv_core::{FileAccessErrorType, FileIoErrorType};
/// Functionalities to build UV requests
pub mod request {
pub use crate::brcb::BootHdrTags;
pub use crate::crypto::{derive_aes256_gcm_key, SymKey, SymKeyType};
pub use crate::crypto::{derive_aes256_gcm_key, random_array, SymKey, SymKeyType};
pub use crate::req::{EcPubKeyCoord, Keyslot, ReqEncrCtx, Request};
pub use crate::verify::{CertVerifier, HkdVerifier, NoVerifyHkd};