Skip to content

Commit

Permalink
better rng function definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Taowyoo committed Apr 15, 2024
1 parent 64cfa72 commit a2da09c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rustls-mbedcrypto-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ pub mod rng {
#[cfg(not(any(target_env = "sgx", feature = "rdrand")))]
use mbedtls::rng::{CtrDrbg, OsEntropy};

#[cfg(any(target_env = "sgx", feature = "rdrand"))]
use mbedtls::rng::Rdrand;

/// Type alias for the RNG supported by *mbedtls*
#[cfg(not(any(target_env = "sgx", feature = "rdrand")))]
pub type MbedRng = CtrDrbg;
Expand All @@ -132,13 +129,16 @@ pub mod rng {
CtrDrbg::new(entropy, None).ok()
}

#[cfg(any(target_env = "sgx", feature = "rdrand"))]
use mbedtls::rng::Rdrand;

/// Type alias for the RNG supported by *mbedtls*
#[cfg(any(target_env = "sgx", feature = "rdrand"))]
pub type MbedRng = Rdrand;

/// Get a RNG supported by *mbedtls*
#[cfg(any(target_env = "sgx", feature = "rdrand"))]
pub fn rng_new() -> Option<Rdrand> {
pub fn rng_new() -> Option<MbedRng> {
Some(Rdrand)
}
}
Expand Down

0 comments on commit a2da09c

Please sign in to comment.