3 ms·
This is all fine and dandy for seeding a CSPRNG, but we still don't actually have a CSPRNG in the C stdlib or glibc. getrandom(2) seems to target exclusively ge
by beefhash 11y ago
This is all fine and dandy for seeding a CSPRNG, but we still don't actually have a CSPRNG in the C stdlib or glibc. getrandom(2) seems to target exclusively getting entropy for seeding, looking at the man page ("These bytes can be used to seed userspace random number generators or for cryptographic purposes."). And of course, the syscall is very recent, introduced in Linux 3.17, coming after the kernels in Debian stable (jessie), which features 3.16, and CentOS/RHEL7, which features 3.10.
OpenBSD and NetBSD feature a ChaCha-based arc4random; FreeBSD and libbsd still seem stuck with RC4-based arc4random[1]. An equivalent for that is sorely missing on Linux. /dev/urandom requires messing with file descriptors, which you may run out of and may require error handling, plus all kinds of security precautions to make sure you're actually looking at the right /dev/urandom[2].
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=182610 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=182610 and https://bugs.freedesktop.org/show_bug.cgi?id=85827 https://bugs.freedesktop.org/show_bug.cgi?id=85827
[2] http://insanecoding.blogspot.ch/2014/05/a-good-idea-with-bad-usage-devurandom.html http://insanecoding.blogspot.ch/2014/05/a-good-idea-with-bad...
- ReidZB 11y agogetrandom(2) uses a CSPRNG under the hood and can be treated as a pre-seeded one. It's unfortunate that it's so recent, though.
- justincormack 11y agoThere is an open request to add a posix_random (basically arc4random) to posix http://austingroupbugs.net/view.php?id=859 http://austingroupbugs.net/view.php?id=859