Date: Fri, 28 Sep 2012 00:10:15 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: Bruce Evans <brde@optusnet.com.au> Cc: freebsd-security@freebsd.org, RW <rwmaillists@googlemail.com> Subject: Re: Collecting entropy from device_attach() times. Message-ID: <86fw63w20o.fsf@ds4.des.no> In-Reply-To: <20120928062245.K4426@besplex.bde.org> (Bruce Evans's message of "Fri, 28 Sep 2012 07:35:42 %2B1000 (EST)") References: <20120918211422.GA1400@garage.freebsd.pl> <20120919192836.3a60cdfd@gumby.homeunix.com> <863923pzgi.fsf@ds4.des.no> <CAG5KPzwhq4UzPxbx74vX5KKtqC4tWkTsKAHjGDsdD8MqJVVkRg@mail.gmail.com> <20120927125956.0594fa73@gumby.homeunix.com> <86pq57o7ps.fsf@ds4.des.no> <20120928062245.K4426@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans <brde@optusnet.com.au> writes: > "Dag-Erling Sm=C3=B8rgrav" <des@des.no> writes: > > RW <rwmaillists@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 --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86fw63w20o.fsf>