diff --git a/Cargo.toml b/Cargo.toml index 1b4a2dd533..32dc5edd0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -197,7 +197,7 @@ cc = { version = "1.0.83", default-features = false } default = ["alloc", "dev_urandom_fallback"] alloc = [] dev_urandom_fallback = [] -less-safe-getrandom-custom = ["getrandom/custom"] +less-safe-getrandom-custom-or-rdrand = [] slow_tests = [] std = ["alloc"] unstable-testing-arm-no-hw = [] diff --git a/src/lib.rs b/src/lib.rs index ba0081160c..8f0b4e49d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,14 +22,16 @@ //!
alloc (default)
//! less-safe-getrandom-custom
-//! getrandom
-//! implementation as a secure random number generator (see
-//! SecureRandom
). Only has effect on targets
-//! not supported by getrandom
.
-//! See
+//! less-safe-getrandom-custom-or-rdrand
+//! getrandom
+//! implementations as secure random number generators (see
+//! SecureRandom
). This feature only works with
+//! os = "none"
targets. See
+//!
//! register_custom_getrandom
-//! for details.
+//! and
+//! RDRAND on x86
+//! for additional details.
//! std
//! std::error::Error
integration. Implies `alloc`.
diff --git a/src/rand.rs b/src/rand.rs
index bd22440729..809791c79c 100644
--- a/src/rand.rs
+++ b/src/rand.rs
@@ -125,10 +125,7 @@ impl crate::sealed::Sealed for SystemRandom {}
// system's) CSPRNG. Avoid using it on targets where it uses the `rdrand`
// implementation.
#[cfg(any(
- // NOTE `getrandom`'s (v0.2.10) docs state that a custom implementation will
- // NOT override the implementation of supported targets, like the ones
- // listed below.
- feature = "less-safe-getrandom-custom",
+ all(feature = "less-safe-getrandom-custom-or-rdrand", target_os = "none"),
target_os = "aix",
target_os = "android",
target_os = "dragonfly",