> Start some kind of hardware-managed timer at the earliest possible
> opportunity (perhaps start it in the boot loader!), then when you need to
> pick up your first seed, read the timer's value and seed your random
> generator from that.

I have some much more sophisticated code (written by JHB) that does
effectively this. It does it by hooking interrupt randomness, and by
using the interrupts from your disk controllers (SCSI and IDE/ATA),
a nicely fast reseed is gained.

I'll happily commit it now, but I'd prefer a code review first, and
is suspect that this will be better received once Jake's preemptive
ithread code is committed.

> The idea is to catch that timer at an unknown condition, and certainly the
> computer is not going to boot in the exact same amount of time, every time
> it's restarted.  This would be especially true if the boot sequence gets
> interrupted (to load another kernel perhaps) or the user forces the
> machine into single-user mode while it's booting.

All entropy harvesting uses some kind of harvesting. On i386,
(Pentium and better) it is the TSC register. 80386 and 80486 use
nanotime(9) and other CPUs have a TSC-like register.

> In my hobby platform, it's common to start the timer, then grab a value
> from it after the user hits a key after viewing some introduction screen.
> The value grabbed is often used as the actual random number, but it could
> be just as useful if used to seed a random generator.

SOP :-)

> If you're particularly paranoid, you set both timers for 32-bit mode,
> start one first thing at startup, and the other when the user hits the
> key, then read both of them the first time a random number is needed.
> Seed your random generator from that, along with any other sources you can
> (such as the video raster counter and the sound device's readable
> oscillator, set to generate a noise waveform).

Slight overkill, when the TSC register is already used and deliberately
underestimated to improve randomness quality.

Mark Murray
Warning: this .sig is umop ap!sdn

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to