Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Oct 1995 14:33:55 +0200
From:      Mark Murray <mark@grondar.za>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        hackers@FreeBSD.org
Subject:   Re: Creating a /dev/random 
Message-ID:  <199510161233.OAA26278@grumble.grondar.za>

next in thread | raw e-mail | index | archive | help
> >> >+			poolsize = read_random(rbuf, CLBYTES);
> >> >+			c = min(iov->iov_len, CLBYTES);
> >> >+			c = min(c, poolsize);
> >> >+			error = uiomove(rbuf, (int)c, uio);
> >> 
> >> `c' should be calculated before calling rad_random() to avoid wasting
> >> randomness.
> 
> >Huh? How? :-) Are you suggesting that there should be another call to
> >return the number of bytes in the pool _before_ read_random is called?
> 
> 	intc = imin(iov->iov_len, CLBYTES);
> 	poolsize = read_random(rbuf, intc);
> 	intc = imin(intc, poolsize);
> 
> It the caller reads 1 byte at a time, then the original version throws
> away up to CLBYTES-1 bytes of randomness.

AHA! The undocumented internals of *iov...

Thanks. I just learnt something useful here!

M
--
Mark Murray
46 Harvey Rd, Claremont, Cape Town 7700, South Africa
+27 21 61-3768 GMT+0200
Finger mark@grumble.grondar.za for PGP key



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510161233.OAA26278>