Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2012 09:59:17 +0100
From:      Ben Laurie <benl@freebsd.org>
To:        Pawel Jakub Dawidek <pjd@freebsd.org>
Cc:        freebsd-security@freebsd.org, Jonathan Anderson <jonathan.anderson@cl.cam.ac.uk>
Subject:   Re: Collecting entropy from device_attach() times.
Message-ID:  <CAG5KPzx2oK%2BULbfbthj2XVx-%2BRtRHHbYMW1BG6Aymju-0x-vvg@mail.gmail.com>
In-Reply-To: <20120919202023.GD1416@garage.freebsd.pl>
References:  <20120918211422.GA1400@garage.freebsd.pl> <A8FD98DD94774D00B4E5F78D3174C1B4@gmail.com> <20120919192923.GA1416@garage.freebsd.pl> <CAG5KPzyxSMZ8X4RmEhCHA=dHTLUw5mOUf-oveJtOPx8im3dpeQ@mail.gmail.com> <20120919202023.GD1416@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 19, 2012 at 9:20 PM, Pawel Jakub Dawidek <pjd@freebsd.org> wrot=
e:
> On Wed, Sep 19, 2012 at 08:59:15PM +0100, Ben Laurie wrote:
>> On Wed, Sep 19, 2012 at 8:29 PM, Pawel Jakub Dawidek <pjd@freebsd.org> w=
rote:
>> > On Wed, Sep 19, 2012 at 07:30:52PM +0100, Jonathan Anderson wrote:
>> >> > If all the times are more or less equally probable in this range [=
=85]
>> >>
>> >> They're very unlikely to be equally probable. It would make sense to =
do some characterization of these times and their statistics: a highly non-=
uniform distribution would mean that we don't actually get many bits per at=
tach.
>> >
>> > I have times for ~2000 device_attach() calls when loading sound card
>> > driver on totally idle system. If someone could take those and analyse
>> > the distribution that would be great.
>> >
>> >> > [=85] we have more
>> >> > than 19 bits of entropy from this one call, but I reduced if to fou=
r
>> >> > bits only, because there are devices that are much faster to attach=
.
>> >> >
>> >>
>> >> Another reason for doing the above characterization is that, if a par=
ticular device_attach() really does provide 12 bits of uncertainty, it's a =
shame to drop eight of them on the floor.
>> >
>> > Rights. That's why I've prepared another patch:
>> >
>> >         http://people.freebsd.org/~pjd/patches/harvest_device_attach.2=
.patch
>> >
>> > which effectively discards top ten bits, which means we expect 0.1% of
>> > the attach time to be unpredictable (the attach time in most cases var=
y
>> > by few percent, not sure yet how much of this variation is really
>> > unpredictable).
>>
>> This is the wrong thing to do! There's no reason to discard bits on
>> input (modulo the device throwing away inputs, that is) - just reduce
>> your entropy estimate. "Extra" bits do no harm.
>
> I 'discard' ten bits from the estimation. I don't discard them by
> zeroing them out. If the number is a 26 bit value then I feed entire
> number, but pass estimation of 16 bits.

Sorry, should've read the code first! This is great. I also like your
friend's analysis.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG5KPzx2oK%2BULbfbthj2XVx-%2BRtRHHbYMW1BG6Aymju-0x-vvg>