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 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46C71C3A5A2 for ; Fri, 20 Sep 2019 14:36:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E47F2190F for ; Fri, 20 Sep 2019 14:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568990195; bh=UdNzovcKyZpZxczO/+ZLqGn4wfUX7R9VU6/eNsOHJVI=; h=From:To:Cc:Subject:Date:List-ID:From; b=NaAt15HxpsrE/Wo7942AO6em06BLn9I0R8qauJaMk8hYXQaA3ZrSvoZiBgKmhXIwx o+V2jPgmx8608pwLqAmE2mCjY5mOchFJNXwlApeOknoN/FrnotYGTMktINURfvQH4Y KhaleK9jRXCU1fAecdLkL+AEFANMv6i7PB5L5leU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392413AbfITOge (ORCPT ); Fri, 20 Sep 2019 10:36:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:48824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388039AbfITOgd (ORCPT ); Fri, 20 Sep 2019 10:36:33 -0400 Received: from localhost (c-67-180-165-146.hsd1.ca.comcast.net [67.180.165.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C0F4206C2; Fri, 20 Sep 2019 14:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568990192; bh=UdNzovcKyZpZxczO/+ZLqGn4wfUX7R9VU6/eNsOHJVI=; h=From:To:Cc:Subject:Date:From; b=PsuELdiTwZ0uKFAseBBIl+FQ0jl+wrcFUUF7O+agBb8n4p/1RXoRd+Gj+s1nnTKVP /vAFAl6VvdLTOmFytk5ShVdgJ7wNzqTFir9jPam6YTzprE+wYYjQyw5JX4H4JXB/gh BabaDD/Dla7e99lS72oDsItadPSr4V3dJPpGIErY= From: Andy Lutomirski To: Theodore Tso Cc: LKML , Linux API , Kees Cook , "Jason A. Donenfeld" , "Ahmed S. Darwish" , Lennart Poettering , "Eric W. Biederman" , "Alexander E. Patrakov" , Michael Kerrisk , Willy Tarreau , Matthew Garrett , Ext4 Developers List , linux-man , Andy Lutomirski Subject: [PATCH v2 0/7] Rework random blocking Date: Fri, 20 Sep 2019 07:36:22 -0700 Message-Id: X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-man-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org This makes two major semantic changes to Linux's random APIs: It adds getentropy(..., GRND_INSECURE). This causes getentropy to always return *something*. There is no guarantee whatsoever that the result will be cryptographically random or even unique, but the kernel will give the best quality random output it can. The name is a big hint: the resulting output is INSECURE. The purpose of this is to allow programs that genuinely want best-effort entropy to get it without resorting to /dev/urandom. Plenty of programs do this because they need to do *something* during boot and they can't afford to wait. Calling it "INSECURE" is probably the best we can do to discourage using this API for things that need security. This series also removes the blocking pool and makes /dev/random work just like getentropy(..., 0) and makes GRND_RANDOM a no-op. I believe that Linux's blocking pool has outlived its usefulness. Linux's CRNG generates output that is good enough to use even for key generation. The blocking pool is not stronger in any material way, and keeping it around requires a lot of infrastructure of dubious value. This series should not break any existing programs. /dev/urandom is unchanged. /dev/random will still block just after booting, but it will block less than it used to. getentropy() with existing flags will return output that is, for practical purposes, just as strong as before. Changes from v1: - Rebased to v5.3. No other changes. Andy Lutomirski (7): random: Don't wake crng_init_wait when crng_init == 1 random: Add GRND_INSECURE to return best-effort non-cryptographic bytes random: Ignore GRND_RANDOM in getentropy(2) random: Make /dev/random be almost like /dev/urandom random: Remove the blocking pool random: Delete code to pull data into pools random: Remove kernel.random.read_wakeup_threshold drivers/char/random.c | 234 ++++-------------------------------- include/uapi/linux/random.h | 4 +- 2 files changed, 27 insertions(+), 211 deletions(-) -- 2.21.0