Rely on /dev/urandom
authorVolker Lendecke <vl@samba.org>
Thu, 1 Oct 2015 22:27:22 +0000 (00:27 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 13 Oct 2015 02:25:38 +0000 (04:25 +0200)
commite73ccc06efc3b489cac33e99b2cb86e022aabd7f
treef18c65e4950d2c96bbc60fc04ae60802a12185c2
parent5380f7b63648e505d6da25dc75d2487658998fdb
Rely on /dev/urandom

This removes quite a bit of code. All reasonable systems have /dev/urandom
these days. Linux, Solaris and the BSDs do.  In case we find a system
without /dev/urandom, we will have to go hunting in other libraries.

The main reason for this is speed: On Ubuntu 14.04 doing direct reads from
/dev/urandom is 2-3 times faster than our md4 based code. On virtualized
FreeBSD 10 the difference is even larger.

My first approach was to use fopen/fread. It was even faster, but less
than twice as fast. So I thought we could save the additional complexity
when having to deal with throwing away buffers when forking and the
additional memory footprint per process.

With this simple generate_random_buffer it will be easier to adapt new
syscalls to get randomness.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 13 04:25:39 CEST 2015 on sn-devel-104
lib/util/genrand.c
lib/util/genrand.h
lib/util/tests/genrand.c
lib/util/wscript_build
source3/lib/util.c
source3/passdb/secrets.c
source4/param/secrets.c
source4/param/secrets.h
source4/smbd/process_standard.c
source4/smbd/server.c