Next: getrandom
, Up: Glibc <sys/random.h>
[Contents][Index]
getentropy
Specified in POSIX.1-2024.
Draft specification:
https://www.austingroupbugs.net/view.php?id=1134
Documentation:
Gnulib module: getentropy
Portability problems fixed by Gnulib:
<sys/random.h>
, not in <unistd.h>
,
on some platforms:
macOS 14, Solaris 11.4, Android 9.0.
Portability problems not fixed by Gnulib:
Although this function is intended to produce random data, the data’s security properties may not be appropriate for your application. For example, identical “random” data streams might be produced by rebooted virtual machines. If this is of concern you may need to use additional techniques such as hedging.1
Related modules include getrandom
, which has a more-flexible
but more-complex API, and crypto/gc-random
, which is likely a
better match for code already using the other crypto
APIs.
Ristenpart T, Yilek S. When good randomness goes bad: virtual machine vulnerabilities and hedging deployed cryptography. NDSS 2010.