Skip to content

Commit

Permalink
Do /dev/urandom fallback on Android too.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jun 18, 2019
1 parent ce56ab1 commit d041b73
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,18 @@ impl SecureRandom for SystemRandom {
impl sealed::Sealed for SystemRandom {}

#[cfg(any(
target_os = "android",
all(target_os = "linux", not(feature = "dev_urandom_fallback")),
all(
any(target_os = "android", target_os = "linux"),
not(feature = "dev_urandom_fallback")
),
windows
))]
use self::sysrand::fill as fill_impl;

#[cfg(all(target_os = "linux", feature = "dev_urandom_fallback"))]
#[cfg(all(
any(target_os = "android", target_os = "linux"),
feature = "dev_urandom_fallback"
))]
use self::sysrand_or_urandom::fill as fill_impl;

#[cfg(any(target_os = "macos", target_os = "ios"))]
Expand Down Expand Up @@ -193,7 +198,10 @@ mod sysrand {
}

// Keep the `cfg` conditions in sync with the conditions in lib.rs.
#[cfg(all(target_os = "linux", feature = "dev_urandom_fallback"))]
#[cfg(all(
any(target_os = "android", target_os = "linux"),
feature = "dev_urandom_fallback"
))]
mod sysrand_or_urandom {
use crate::error;

Expand Down

0 comments on commit d041b73

Please sign in to comment.