Date: Sun, 1 Oct 1995 21:47:32 +1000 From: Bruce Evans <bde@zeta.org.au> To: hackers@freebsd.org, mark@grondar.za Subject: Re: How to get to the hardware? Message-ID: <199510011147.VAA08665@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>#if defined (__i386__) && 0 > /* > * On a 386, read the high resolution timer. We assume that > * this gives us 2 bits of randomness. XXX This needs > * investigation. > */ > outb_p(0x00, 0x43); /* latch the count ASAP */ > add_entropy_byte(r, inb_p(0x40), 1); > add_entropy_byte(r, inb(0x40), 1); > r->entropy_count += 2; > if (r->entropy_count > r->bit_length) > r->entropy_count = r->bit_length; >#endif This is much the same as calling microtime() or gettimeofday() and and getting "random" bits from (tv_usec & 1) and (tv_usec & (1 << 7)) (here 7 is an approximation to (1e6 / TIMER_FREQ) * 8)). These bits are actually extremely non-random. They can be predicted as accurately as the current time if their values at a previous time are known. Thus they are insignificantly more random than the current time in microseconds. More investigation is required to find a source of random bits. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510011147.VAA08665>