diff --git a/Cargo.toml b/Cargo.toml index 65f85386ae..2b9cf6b0de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -199,6 +199,7 @@ default = ["alloc", "dev_urandom_fallback"] alloc = [] dev_urandom_fallback = [] less-safe-getrandom-custom-or-rdrand = [] +less-safe-getrandom-espidf = [] slow_tests = [] std = ["alloc"] unstable-testing-arm-no-hw = [] diff --git a/src/lib.rs b/src/lib.rs index 2c5624db5e..6797d8b7c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,6 +32,14 @@ //! and //! RDRAND on x86 //! for additional details. +//! less-safe-getrandom-espidf +//! Treat getrandom as a secure random number generator (see +//! SecureRandom) on the esp-idf target. While the esp-idf +//! target does have hardware RNG, it is beyond the scope of ring to +//! ensure its configuration. This feature allows ring to build +//! on esp-idf despite the liklihood that RNG is not secure. +//! This feature only works with os = espidf targets. +//! See //! std //! Enable features that use libstd, in particular //! std::error::Error integration. Implies `alloc`. diff --git a/src/rand.rs b/src/rand.rs index 9a52d206d0..7ed807b534 100644 --- a/src/rand.rs +++ b/src/rand.rs @@ -125,10 +125,8 @@ impl crate::sealed::Sealed for SystemRandom {} // system's) CSPRNG. Avoid using it on targets where it uses the `rdrand` // implementation. #[cfg(any( - all( - feature = "less-safe-getrandom-custom-or-rdrand", - any(target_os = "none", target_os = "espidf") - ), + all(feature = "less-safe-getrandom-custom-or-rdrand", target_os = "none"), + all(feature = "less-safe-getrandom-espidf", target_os = "espidf"), target_os = "aix", target_os = "android", target_os = "dragonfly",