Collecting entropy from device_attach() times.
RW
rwmaillists at googlemail.com
Wed Oct 3 13:51:24 UTC 2012
On Wed, 03 Oct 2012 13:42:03 +0200
Dag-Erling Smørgrav wrote:
> RW <rwmaillists at googlemail.com> writes:
> > As I pointed-out before if you use binuptime() you cant use entropy
> > estimation based on bit-shifting time differences.
>
> Forgot to answer this: yes you can. The last time I raised the
> issue, I also provided sample code for reimplementing
> get_cyclecount() in terms of binuptime(). Basically, you discard the
> top N bits of the integer portion and the bottom 64 - N bits of the
> fractional portion, and you're left with a monotonically increasing
> 64-bit value that will wrap around at a point that depends on N.
>
Yes, getting a monotonically increasing value from binuptime() is
simple, but the xor issue is secondary to the problem I was referring
to when I quoted the arm code for get_cyclecount().
When the time difference comes from the TSC, Pavels code computes an
amount of entropy that scales reasonably well with TSC frequency. When
when you use binuptime() you've thrown away all counter frequency
information. The entropy calculation will produce a completely
bogus figure.
More information about the freebsd-security
mailing list