Skip to content

Commit

Permalink
Make a separate "less-safe-getrandom-espidf"
Browse files Browse the repository at this point in the history
  • Loading branch information
coder0xff committed Feb 19, 2024
1 parent 2e95a88 commit 3faa13d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
//! </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>less-safe-getrandom-espidf</code>
//! <td>Treat getrandom as a secure random number generator (see
//! <code>SecureRandom</code>) 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 <code>os = espidf</code> targets.
//! See <a href="https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/random.html">
//! <tr><td><code>std</code>
//! <td>Enable features that use libstd, in particular
//! <code>std::error::Error</code> integration. Implies `alloc`.
Expand Down
6 changes: 2 additions & 4 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 3faa13d

Please sign in to comment.