[Prev][Next][Index][Thread]

Re: random



On Thu, Feb 21, 2002 at 11:10:41PM -0500, Derek L Davies wrote:
> Now I'm looking at adding a random device.  My tenative plan is to
> take the linux 2.2.12 drivers/char/random.c file and try to glue it
> in.  Or would it be better to take from freebsd instead?

BSD seems to have several types of random devices, for different application
need, which is quite neat.

Linux has the problem that it keeps only one entropy pool for both
random and urandom, so readers of urandom drain the entropy pool and DoS
random.

However, as OSKit only provides the primitives, any sort of entropy
pool will do fine for us (as long as the entropy is mixed appropriately, so
that one byte entropy equals one byte from the good random device (random
rather than urandom).  I have never looked at the BSD interface, but the
Linux interface should be wrappable (I did it for GNU Mach a couple of years
ago).

Don't forget that you need a way to commit entropy from various hardware
sources like the TSC (if available), the hardisk and mouse interrupts etc.
I am not sure how it would be done properly in OSKit, as this often produces
dependencies between quite unrelated parts of the kernel.  The Linux kernel
of course doesn't bother and just calls the functions directly, in OSKit
some sane interface might be applicable (So you can tell the harddisk driver
to write entropy to the random device, and the writable entropy device takes
the entropy and adds it to the pool).  This is a question for OSKit
designers to answer ;)

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de

References: