rand/noise.c (noise_devrandom): Use new Linux system call `getrandom'.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 4 Jun 2016 13:55:30 +0000 (14:55 +0100)
commitbaf5b59c8aad82395688f0a96efcfba4e16b8fc2
tree47c043a595d61bb18c5bb944bbc93b67b5a1b1ec
parentecc296ebb74bb17cfb9998972a4bc28b91e82da0
rand/noise.c (noise_devrandom): Use new Linux system call `getrandom'.

The new system call has pretty much the right semantics.  If it's
available, then try to use it.  Annoyingly, the syscall isn't supported
in the libc, so we have to do it the hard way.  On the plus side, this
means that the code will work if built on a system with the syscall
defined, and run on one with the right kernel, without introducing a
dependency on the libc.

If it fails because the kernel entropy pool isn't initialized, then
there's no point in messing with the devices because they won't be any
better.  If it fails because the call isn't there, then it proceeds with
other options.
configure.ac
rand/noise.c