Skip to content

Commit

Permalink
rename feature
Browse files Browse the repository at this point in the history
and have it apply only when `target_os = "none"`
  • Loading branch information
japaric committed Nov 3, 2023
1 parent 0a1979c commit 2756989
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
//! <th>Description
//! <tr><td><code>alloc (default)</code>
//! <td>Enable features that require use of the heap, RSA in particular.
//! <tr><td><code>less-safe-getrandom-custom</code>
//! <td>Treat a user-provided ("custom") <code>getrandom</code>
//! implementation as a secure random number generator (see
//! <code>SecureRandom</code>). Only has effect on targets
//! <strong>not</strong> supported by <code>getrandom</code>.
//! See <a href="https://docs.rs/getrandom/0.2.10/getrandom/macro.register_custom_getrandom.html">
//! <tr><td><code>less-safe-getrandom-custom-or-rdrand</code>
//! <td>Treat user-provided ("custom") and RDRAND-based <code>getrandom</code>
//! implementations as secure random number generators (see
//! <code>SecureRandom</code>). This feature only works with
//! <code>os = "none"</code> targets. See
//! <a href="https://docs.rs/getrandom/0.2.10/getrandom/macro.register_custom_getrandom.html">
//! <code>register_custom_getrandom</code>
//! </a> for details.
//! </a> and <a href="https://docs.rs/getrandom/0.2.10/getrandom/#rdrand-on-x86">
//! RDRAND on x86
//! </a> for additional details.
//! <tr><td><code>std</code>
//! <td>Enable features that use libstd, in particular
//! <code>std::error::Error</code> integration. Implies `alloc`.
Expand Down
5 changes: 1 addition & 4 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2756989

Please sign in to comment.