Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Oct 2012 13:42:03 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        RW <rwmaillists@googlemail.com>
Cc:        Anderson <jonathan.anderson@cl.cam.ac.uk>, Pawel Jakub Dawidek <pjd@freebsd.org>, John Baldwin <jhb@freebsd.org>, Ben Laurie <benl@freebsd.org>, freebsd-security@freebsd.org, Mariusz Gromada <mariusz.gromada@gmail.com>, Jonathan@FreeBSD.ORG
Subject:   Re: Collecting entropy from device_attach() times.
Message-ID:  <86txub93zo.fsf@ds4.des.no>
In-Reply-To: <20121003011607.5553fe48@gumby.homeunix.com> (RW's message of "Wed, 3 Oct 2012 01:16:07 %2B0100")
References:  <20120918211422.GA1400@garage.freebsd.pl> <20120919231051.4bc5335b@gumby.homeunix.com> <20120920102104.GA1397@garage.freebsd.pl> <201209200758.51924.jhb@freebsd.org> <20120922080323.GA1454@garage.freebsd.pl> <20120922195325.GH1454@garage.freebsd.pl> <505E59DC.7090505@gmail.com> <20120923151706.GN1454@garage.freebsd.pl> <5060D723.6020305@gmail.com> <CAG5KPzxf0Rfufk5K6Jt4e85xc7zXY_B3a2Sq0Uf_uVLHbV-baw@mail.gmail.com> <86r4pqqwnm.fsf@ds4.des.no> <86ipat6n0o.fsf@ds4.des.no> <86y5joiyan.fsf@ds4.des.no> <20121003011607.5553fe48@gumby.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
RW <rwmaillists@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.

BTW, get_cyclecount() is documented to work the way I suggest that it
should, not the way it actually does.  Also, the man page is incomplete.
For instance, it suggests, but does not state outright, that the value
may wrap around.  It also states categorically that TSCs are per-CPU in
SMP systems, whereas in fact all modern amd64 systems (and many P4-era
systems, contingent on motherboard support) have synchronized TSCs.

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?86txub93zo.fsf>