From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E3F8C4332F for ; Wed, 9 Feb 2022 08:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242089AbiBIIhF (ORCPT ); Wed, 9 Feb 2022 03:37:05 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:34568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231430AbiBIIg4 (ORCPT ); Wed, 9 Feb 2022 03:36:56 -0500 X-Greylist: delayed 352 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 09 Feb 2022 00:36:54 PST Received: from isilmar-4.linta.de (isilmar-4.linta.de [136.243.71.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8187C03649A; Wed, 9 Feb 2022 00:36:54 -0800 (PST) X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id D5DEB20142F; Wed, 9 Feb 2022 08:31:15 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id BA0348033A; Wed, 9 Feb 2022 07:18:42 +0100 (CET) Date: Wed, 9 Feb 2022 07:18:42 +0100 From: Dominik Brodowski To: "Jason A. Donenfeld" Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, tytso@mit.edu, ebiggers@kernel.org, Eric Biggers Subject: Re: [PATCH v2 1/9] random: use RDSEED instead of RDRAND in entropy extraction Message-ID: References: <20220209011919.493762-1-Jason@zx2c4.com> <20220209011919.493762-2-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220209011919.493762-2-Jason@zx2c4.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Wed, Feb 09, 2022 at 02:19:11AM +0100 schrieb Jason A. Donenfeld: > When /dev/random was directly connected with entropy extraction, without > any expansion stage, extract_buf() was called for every 10 bytes of data > read from /dev/random. For that reason, RDRAND was used rather than > RDSEED. At the same time, crng_reseed() was still only called every 5 > minutes, so there RDSEED made sense. > > Those olden days were also a time when the entropy collector did not use > a cryptographic hash function, which meant most bets were off in terms > of real preimage resistance. For that reason too it didn't matter > _that_ much whether RDSEED was mixed in before or after entropy > extraction; both choices were sort of bad. > > But now we have a cryptographic hash function at work, and with that we > get real preimage resistance. We also now only call extract_entropy() > every 5 minutes, rather than every 10 bytes. This allows us to do two > important things. > > First, we can switch to using RDSEED in extract_entropy(), as Dominik > suggested. Second, we can ensure that RDSEED input always goes into the > cryptographic hash function with other things before being used > directly. This eliminates a category of attacks in which the CPU knows > the current state of the crng and knows that we're going to xor RDSEED > into it, and so it computes a malicious RDSEED. By going through our > hash function, it would require the CPU to compute a preimage on the > fly, which isn't going to happen. > > Cc: Theodore Ts'o > Reviewed-by: Eric Biggers > Suggested-by: Dominik Brodowski > Signed-off-by: Jason A. Donenfeld Reviewed-by: Dominik Brodowski Thanks, Dominik