Subject: bug#6658: [PATCH] randread: use /dev/urandom to seed, not just getpid etc

From: Pádraig Brady <[email-masked]>
Date: Wed, 21 Jul 2010 00:18:39 +0100

On 20/07/10 17:59, Paul Eggert wrote:
> OK, I installed part (2) of the patch: it uses /dev/urandom
> rather than the getpid()/gettimeofday() yucky stuff,
> when /dev/urandom is available.

/dev/urandom is very widely available,
so this should work for most systems.

> One downside to this patch is that on hosts where mkstemp
> doesn't work and we're using our substitute, each invocation
> of mkstemp opens /dev/urandom, reads a few bytes, and closes it.
> I don't view this as a big problem, because (a) it's only for
> hosts with broken mkstemp and they should fix their mkstemp and
> (b) creating a temp file is a big-deal operation anyway and
> the extra overhead of opening /dev/urandom doesn't add much.

I agree. Running a million iterations of each seeder:
  orig				3s
  new (1 byte from urandom)	8s
  new (16 bytes from urandom)	11s

The patch looks good.

cheers,
Pádraig.