You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//! Contrary to its name, `arc4random` doesn't actually use the horribly-broken
4
+
//! RC4 cypher anymore, at least not on modern systems, but rather something
5
+
//! like ChaCha20 with continual reseeding from the OS. That makes it an ideal
6
+
//! source of large quantities of cryptographically secure data, which is exactly
7
+
//! what we need for `DefaultRandomSource`. Unfortunately, it's not available
8
+
//! on all UNIX systems, most notably Linux (until recently, but it's just a
9
+
//! wrapper for `getrandom`. Since we need to hook into `getrandom` directly
10
+
//! for `HashMap` keys anyway, we just keep our version).
11
+
12
+
#[cfg(not(any(
13
+
target_os = "haiku",
14
+
target_os = "illumos",
15
+
target_os = "solaris",
16
+
target_os = "vita",
17
+
)))]
18
+
use libc::arc4random_buf;
19
+
20
+
// FIXME: move these to libc (except Haiku, that one needs to link to libbsd.so).
21
+
#[cfg(any(
22
+
target_os = "haiku",// See https://git.haiku-os.org/haiku/tree/headers/compatibility/bsd/stdlib.h
23
+
target_os = "illumos",// See https://www.illumos.org/man/3C/arc4random
24
+
target_os = "solaris",// See https://docs.oracle.com/cd/E88353_01/html/E37843/arc4random-3c.html
25
+
target_os = "vita",// See https://github.com/vitasdk/newlib/blob/b89e5bc183b516945f9ee07eef483ecb916e45ff/newlib/libc/include/stdlib.h#L74
0 commit comments