Collecting entropy from device_attach() times.

Dag-Erling Smørgrav des at des.no
Thu Sep 27 22:10:23 UTC 2012


Bruce Evans <brde at optusnet.com.au> writes:
> "Dag-Erling Smørgrav" <des at des.no> writes:
> > RW <rwmaillists at googlemail.com> writes:
> > > binuptime(&bt);
> > > return (bt.frac ^ bt.sec);
> > Why the heck does it xor the integer and fractional parts together?
> Because most of the entropy is in the fractional part,

This is not about entropy, it's about implementing get_cyclecount() on a
platform that doesn't have a TSC.  It's supposed to be monotonic, and
this implementation clearly isn't.  Even when bt.sec is small enough
that it doesn't affect significant digits of bt.frac (which should be
most of the time, unless the resolution of the underlying timecounter
exceeds ~2^32 Hz), get_cyclecount() will go backward every time a new
second ticks over.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-security mailing list