apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@xbc.nu>
Subject Re: apr_generate_random_bytes() blocks forever
Date Tue, 11 Mar 2003 21:48:05 GMT
Ben Collins-Sussman wrote:

>Joe Orton <joe@manyfish.co.uk> writes:
>>>Sander says there was a long thread about this, about how people
>>>wanted "strong random", but now we're stuck with a situation where
>>>apr_uuid_get() can block indefinitely...   :-(
>>Workarounds are:
>>1. configure --with-devrandom=/dev/urandom
>>2. (while sleep 120; do ls -laR / > /dev/random; done) &
>>A solution is probably to add an apr_generate_quite_random_bytes() or
>>something which prefers /dev/urandom over /dev/random, and/or times out
>>reads from /dev/random and falls back on urandom, etc etc.
>Or gstein has suggested that apr_generate_random_bytes() can grow a
>new flag, indicating urandom is preferred.
That would look weird to APR users on systems that have never heard of
/dev/random and /dev/urandom (several come to mind, all of which use \
for the path separator). Trying to timeout on /dev/random reads won't
work, either -- what's a good timeout value? Milliseconds? Seconds? what
if somebody has to generate UUIDs at 10/sec indefinitely?

Whichever way you look at it, the interface looks broken to me...

Brane ─îibej   <brane@xbc.nu>   http://www.xbc.nu/brane/

View raw message