Subject: Re: CVS commit: syssrc
To: None <>
From: Michael Graff <>
List: tech-kern
Date: 10/29/2000 09:57:18
Doesn't this method of gathering data force a busy wait every time the
callout happens, at splhigh()?

I thought about a better way to do the entropy gathering, and thought
it might be good to do something like this:

Each hardware device has a buffer, say 64 bytes.  It will do whatever
it needs to try to keep those bytes filled.  It may also stir them
around to keep things changing.

The software side of rnd(4) would have a list of sources of
randomness.  When the pool contains less bits than it wishes, it can
walk the list and get hardware bits to mix into the larger pool.

For instance, the 810 ( chipset driver could use a callout with
a time of 1 when its private 64 byte buffer is empty.  When it is
full, it can set a timeout much larger.  Also, using this method the
busy loop in the kernel isn't needed -- if there is no data available,
just set a timeout again and continue to fill the private buffer.


Jason R Thorpe <> writes:

> Module Name:	syssrc
> Committed By:	thorpej
> Date:		Fri Oct 27 22:49:22 UTC 2000
> Modified Files:
> 	syssrc/sys/arch/i386/conf: files.i386
> 	syssrc/sys/arch/i386/pci: pchb.c
> Added Files:
> 	syssrc/sys/arch/i386/pci: i82802reg.h pchb_rnd.c pchbvar.h
> Log Message:
> Add support for sampling the random number generator on
> the 810, 815, 820, and 840 chipsets.  From OpenBSD, modified
> for NetBSD by me.
> To generate a diff of this commit:
> cvs rdiff -r1.168 -r1.169 syssrc/sys/arch/i386/conf/files.i386
> cvs rdiff -r0 -r1.1 syssrc/sys/arch/i386/pci/i82802reg.h \
>     syssrc/sys/arch/i386/pci/pchb_rnd.c syssrc/sys/arch/i386/pci/pchbvar.h
> cvs rdiff -r1.20 -r1.21 syssrc/sys/arch/i386/pci/pchb.c
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.