From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751929AbaC0B4P (ORCPT ); Wed, 26 Mar 2014 21:56:15 -0400 Received: from terminus.zytor.com ([198.137.202.10]:47626 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751469AbaC0B4O (ORCPT ); Wed, 26 Mar 2014 21:56:14 -0400 User-Agent: K-9 Mail for Android In-Reply-To: References: <20140321142950.GI1763@lst.de> <20140321143342.GK1763@lst.de> <533375C1.5060904@mit.edu> <158d2776-1ea4-4f32-a9e9-0488047e6b70@email.android.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH v2 02/03]: hwrng: create filler thread From: "H. Peter Anvin" Date: Wed, 26 Mar 2014 18:55:17 -0700 To: Andy Lutomirski CC: Torsten Duwe , "Theodore Ts'o" , Greg Kroah-Hartman , Matt Mackall , Herbert Xu , Arnd Bergmann , Rusty Russell , Satoru Takeuchi , ingo.tuchscherer@de.ibm.com, "linux-kernel@vger.kernel.org" , Hans-Georg Markgraf , Gerald Schaefer , Martin Schwidefsky , Heiko Carstens , Joe Perches , Greg Price Message-ID: <56e20125-95d3-465f-b582-fba5ba74d2f3@email.android.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are a number of things wrong with this post, but I'll respond in detail when I get to a keyboard. On March 26, 2014 6:11:53 PM PDT, Andy Lutomirski wrote: >[cc: Greg Price, might be working on this stuff] > >On Wed, Mar 26, 2014 at 6:03 PM, H. Peter Anvin wrote: >> I'm wondering more about the default. We default to 50% for >arch_get_random_seed, and this is supposed to be the default for in >effect unverified hwrngs... > >TBH I'm highly skeptical of this kind of entropy estimation. >/dev/random is IMO just silly, since you need to have very >conservative entropy estimates for the concept to really work, and >that ends up being hideously slow. Also, in the /dev/random sense, >most hardware RNGs have no entropy at all, since they're likely to be >FIPS-approved DRBGs that don't have a real non-deterministic source. > >For the kernel's RNG to be secure, I think it should have the property >that it still works if you rescale all the entropy estimates by any >constant that's decently close to 1. > >If entropy estimates are systematically too low, then a naive >implementation results in an excessively long window during early >bootup in which /dev/urandom is completely insecure. > >If entropy estimates are systematically too high, then a naive >implementation fails to do a catastrophic reseed, and the RNG can be >brute-forced. > >So I think that the core code should do something along the lines of >using progressively larger reseeds. Since I think that /dev/random is >silly, this means that we only really care about the extent to which >"entropy" measures entropy conditioned on whatever an attacker can >actually compute. Since this could vary widely between devices (e.g. >if your TPM is malicious), I think that the best we can do is to >collect ~256 bits from everything available, shove it all in to the >core together, and repeat. For all I know, the core code already does >this. > >The upshot is that the actual rescaling factor should barely matter. >50% is probably fine. So is 100% and 25%. 10% is probably asking for >trouble during early boot if all you have is a TPM. > >--Andy -- Sent from my mobile phone. Please pardon brevity and lack of formatting.