diff --git a/crypto-common/src/generate.rs b/crypto-common/src/generate.rs index eb5ddaff..70f1ec0e 100644 --- a/crypto-common/src/generate.rs +++ b/crypto-common/src/generate.rs @@ -1,9 +1,6 @@ use hybrid_array::{Array, ArraySize}; use rand_core::{CryptoRng, TryCryptoRng}; -#[cfg(feature = "getrandom")] -use crate::RngError; - /// Secure random generation. pub trait Generate: Sized { /// Generate random key using the provided [`TryCryptoRng`]. @@ -19,9 +16,10 @@ pub trait Generate: Sized { /// random number generator. /// /// # Errors - /// Returns [`RngError`] in the event the system's ambient RNG experiences an internal failure. + /// Returns [`getrandom::Error`] in the event the system's ambient RNG experiences an internal + /// failure. #[cfg(feature = "getrandom")] - fn try_generate() -> Result { + fn try_generate() -> Result { Self::try_generate_from_rng(&mut getrandom::SysRng) } diff --git a/crypto-common/src/lib.rs b/crypto-common/src/lib.rs index 1cc5bfe1..54a1926a 100644 --- a/crypto-common/src/lib.rs +++ b/crypto-common/src/lib.rs @@ -19,10 +19,10 @@ mod generate; pub use hybrid_array as array; pub use hybrid_array::typenum; +#[cfg(feature = "getrandom")] +pub use getrandom; #[cfg(feature = "rand_core")] pub use {generate::Generate, rand_core}; -#[cfg(feature = "getrandom")] -pub use {getrandom::Error as RngError, getrandom::SysRng}; use core::fmt; use hybrid_array::{ diff --git a/kem/src/lib.rs b/kem/src/lib.rs index c7090f55..089e6dd8 100644 --- a/kem/src/lib.rs +++ b/kem/src/lib.rs @@ -29,7 +29,7 @@ pub trait Encapsulate { /// Encapsulate a fresh shared secret generated using the system's secure RNG. #[cfg(feature = "getrandom")] fn encapsulate(&self) -> Result<(EK, SS), Self::Error> { - self.encapsulate_with_rng(&mut crypto_common::SysRng) + self.encapsulate_with_rng(&mut crypto_common::getrandom::SysRng) } }