Skip to content

Commit f9840d6

Browse files
committed
Make a separate "less-safe-getrandom-espidf"
1 parent 38686ee commit f9840d6

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ default = ["alloc", "dev_urandom_fallback"]
200200
alloc = []
201201
dev_urandom_fallback = []
202202
less-safe-getrandom-custom-or-rdrand = []
203+
less-safe-getrandom-espidf = []
203204
slow_tests = []
204205
std = ["alloc"]
205206
unstable-testing-arm-no-hw = []

src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
//! </a> and <a href="https://docs.rs/getrandom/0.2.10/getrandom/#rdrand-on-x86">
3333
//! RDRAND on x86
3434
//! </a> for additional details.
35+
//! <tr><td><code>less-safe-getrandom-espidf</code>
36+
//! <td>Treat getrandom as a secure random number generator (see
37+
//! <code>SecureRandom</code>) on the esp-idf target. While the esp-idf
38+
//! target does have hardware RNG, it is beyond the scope of ring to
39+
//! ensure its configuration. This feature allows ring to build
40+
//! on esp-idf despite the liklihood that RNG is not secure.
41+
//! This feature only works with <code>os = espidf</code> targets.
42+
//! See <a href="https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/random.html">
3543
//! <tr><td><code>std</code>
3644
//! <td>Enable features that use libstd, in particular
3745
//! <code>std::error::Error</code> integration. Implies `alloc`.

src/rand.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,8 @@ impl crate::sealed::Sealed for SystemRandom {}
125125
// system's) CSPRNG. Avoid using it on targets where it uses the `rdrand`
126126
// implementation.
127127
#[cfg(any(
128-
all(
129-
feature = "less-safe-getrandom-custom-or-rdrand",
130-
any(target_os = "none", target_os = "espidf")
131-
),
128+
all(feature = "less-safe-getrandom-custom-or-rdrand", target_os = "none"),
129+
all(feature = "less-safe-getrandom-espidf", target_os = "espidf"),
132130
target_os = "aix",
133131
target_os = "android",
134132
target_os = "dragonfly",

0 commit comments

Comments
 (0)