std: switch to faster random sources on macOS and most BSDs · qinheping/verify-rust-std@849258c (original) (raw)

`@@ -24,35 +24,34 @@ use crate::sys::random as sys;

`

24

24

`/// Platform | Source

`

25

25

`/// -----------------------|---------------------------------------------------------------

`

26

26

`` /// Linux | [getrandom] or [/dev/urandom] after polling /dev/random

``

27

``

`` -

/// Windows | [ProcessPrng]

``

28

``

`` -

/// macOS and other UNIXes | [getentropy]

``

29

``

`` -

/// other Apple platforms | CCRandomGenerateBytes

``

30

``

`` -

/// ESP-IDF | [esp_fill_random]

``

31

``

`` -

/// Fuchsia | [cprng_draw]

``

``

27

`` +

/// Windows | ProcessPrng

``

``

28

`` +

/// Apple | CCRandomGenerateBytes

``

``

29

`` +

/// DragonFly | arc4random_buf

``

``

30

`` +

/// ESP-IDF | esp_fill_random

``

``

31

`` +

/// FreeBSD | arc4random_buf

``

``

32

`` +

/// Fuchsia | cprng_draw

``

``

33

`` +

/// Haiku | arc4random_buf

``

``

34

`` +

/// Illumos | arc4random_buf

``

``

35

`` +

/// NetBSD | arc4random_buf

``

``

36

`` +

/// OpenBSD | arc4random_buf

``

``

37

`` +

/// Solaris | arc4random_buf

``

``

38

`` +

/// Vita | arc4random_buf

``

32

39

`` /// Hermit | read_entropy

``

33

40

`` /// Horizon | getrandom shim

``

34

41

`` /// Hurd, L4Re, QNX | /dev/urandom

``

35

``

`` -

/// NetBSD before 10.0 | [kern.arandom]

``

36

42

`` /// Redox | /scheme/rand

``

37

``

`` -

/// SGX | [rdrand]

``

``

43

`` +

/// SGX | rdrand

``

38

44

`` /// SOLID | SOLID_RNG_SampleRandomBytes

``

39

45

`` /// TEEOS | TEE_GenerateRandom

``

40

``

`` -

/// UEFI | [EFI_RNG_PROTOCOL]

``

``

46

`` +

/// UEFI | EFI_RNG_PROTOCOL

``

41

47

`` /// VxWorks | randABytes after waiting for randSecure to become ready

``

42

``

`` -

/// WASI | random_get

``

``

48

`` +

/// WASI | random_get

``

43

49

`` /// ZKVM | sys_rand

``

44

50

`///

`

45

51

`/// Disclaimer: The sources used might change over time.

`

46

52

`///

`

47

53

`` /// [getrandom]: https://www.man7.org/linux/man-pages/man2/getrandom.2.html

``

48

54

`` /// [/dev/urandom]: https://www.man7.org/linux/man-pages/man4/random.4.html

``

49

``

`` -

/// [ProcessPrng]: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng

``

50

``

`` -

/// [getentropy]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/getentropy.html

``

51

``

`` -

/// [esp_fill_random]: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/random.html#_CPPv415esp_fill_randomPv6size_t

``

52

``

`` -

/// [cprng_draw]: https://fuchsia.dev/reference/syscalls/cprng_draw

``

53

``

`` -

/// [kern.arandom]: https://man.netbsd.org/rnd.4

``

54

``

`` -

/// [rdrand]: https://en.wikipedia.org/wiki/RDRAND

``

55

``

`` -

/// [EFI_RNG_PROTOCOL]: https://uefi.org/specs/UEFI/2.10/37_Secure_Technologies.html#random-number-generator-protocol

``

56

55

`#[derive(Default, Debug, Clone, Copy)]

`

57

56

`#[unstable(feature = "random", issue = "none")]

`

58

57

`pub struct DefaultRandomSource;

`