[PATCH] rand.c updates from FreeBSD RELENG_5

William M. Grim wgrim at siue.edu
Wed May 12 22:18:22 PDT 2004


Kris Kennaway wrote:
On 2004-05-13, Kris Kennaway <kkenn at xxxxxxxxxxxxxxxxxx> wrote:

On 2004-05-12, Matthew Dillon <dillon at xxxxxxxxxxxxxxxxxxxx> wrote:

:What problems?  I did a grep for /dev/random on 4.x and only came up
:with a couple of uses in contrib/.
:
:>     I think we should simply use /dev/urandom here,
:>     which is guarenteed not to block and will certainly produce a
:>     random enough seed for rand's tiny little seed.
:
:/dev/random is non-blocking in FreeBSD 5.x since it uses a different,
:non-blocking algorithm.
:
:Kris
   Search the FBSD mail archives for the subject line '/dev/random'.  There
   have been several threads.   Most recently, a newfs after booting into
   single user would lock up until enough randomness existed for its
   inode seeding.
That was driver breakage, not a misuse of /dev/random vs. /dev/urandom.


To clarify, /dev/random and /dev/urandom are identical in FreeBSD 5.x,
and the only purpose of keeping both around is for compatibility.
If you're porting code from 5.x to a 4.x-based OS like DF, you need to
take care because of the different semantics of the /dev/random driver
interface.  OTOH it may make sense for you to port the 5.x /dev/random
driver itself, because it has much better properties including better
entropy gathering and better robustness against entropy starvation.
Kris
I'm not very knowledgable of the code base as a whole, yet.  So, I see 
what you're saying, to an extent.

I think what I've done so far would be good enough to go into DFly, 
pending approval from the community.  Also, beyond this, I would be 
happy to port the /dev/random driver over to DFly.  I can start working 
on that once the rand.c/rand.3 patches are applied or denied.

Cheers!
Mike





More information about the Submit mailing list