Navigation Menu

Skip to content

Commit

Permalink
use SecRandomCopyBytes on macOS in Miri
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Apr 21, 2019
1 parent 31a75a1 commit 54aefc6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libstd/sys/unix/rand.rs
Expand Up @@ -13,6 +13,7 @@ pub fn hashmap_random_keys() -> (u64, u64) {

#[cfg(all(unix,
not(target_os = "ios"),
not(all(target_os = "macos", miri)),
not(target_os = "openbsd"),
not(target_os = "freebsd"),
not(target_os = "fuchsia")))]
Expand Down Expand Up @@ -106,7 +107,9 @@ mod imp {
// once per thread in `hashmap_random_keys`. Therefore `SecRandomCopyBytes` is
// only used on iOS where direct access to `/dev/urandom` is blocked by the
// sandbox.
#[cfg(target_os = "ios")]
// HACK: However, we do use this when running in Miri on macOS; intercepting this is much
// easier than intercepting accesses to /dev/urandom.
#[cfg(any(target_os = "ios", all(target_os = "macos", miri)))]
mod imp {
use crate::io;
use crate::ptr;
Expand Down

0 comments on commit 54aefc6

Please sign in to comment.