From dec796d52f58ea0f1774003b9ee7a69ec88182e7 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Tue, 15 Oct 2024 16:46:20 +0000 Subject: [PATCH] rust/crypto: Export `random_array` The function is useful, therefore export it. Reviewed-by: Steffen Eiden Signed-off-by: Marc Hartmayer Signed-off-by: Steffen Eiden --- rust/pv/src/crypto.rs | 2 +- rust/pv/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/pv/src/crypto.rs b/rust/pv/src/crypto.rs index bf37b650..edd2692d 100644 --- a/rust/pv/src/crypto.rs +++ b/rust/pv/src/crypto.rs @@ -150,7 +150,7 @@ pub fn derive_aes256_gcm_key(k1: &PKeyRef, k2: &PKeyRef) -> Res /// # Errors /// /// This function will return an error if the entropy source fails or is not available. -pub(crate) fn random_array() -> Result<[u8; COUNT]> { +pub fn random_array() -> Result<[u8; COUNT]> { let mut rand = [0; COUNT]; rand_bytes(&mut rand)?; Ok(rand) diff --git a/rust/pv/src/lib.rs b/rust/pv/src/lib.rs index db5593a9..02d797f9 100644 --- a/rust/pv/src/lib.rs +++ b/rust/pv/src/lib.rs @@ -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};