lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170117234149.alego63cw6a7azw3@thunk.org>
Date:   Tue, 17 Jan 2017 18:41:49 -0500
From:   Theodore Ts'o <tytso@....edu>
To:     "H. Peter Anvin" <hpa@...ux.intel.com>
Cc:     Denys Vlasenko <dvlasenk@...hat.com>,
        Denys Vlasenko <vda.linux@...glemail.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: random: /dev/random often returns short reads

On Tue, Jan 17, 2017 at 02:29:30PM -0800, H. Peter Anvin wrote:
> If there is a real need to hack around this, then I would instead
> suggest modifying random_read() to block rather than return if the user
> requests below a certain value, O_NONBLOCK is not set, and the whole
> request cannot be fulfilled.  It probably needs to be a sysctl
> configurable, though, and most likely defaulting to 1, as it could just
> as easily break properly functioning applications.

Ugh.  This seems horribly complicated.  If we _really_ need to give
aid and comfort to people trying to do pointless FIPS certification
workarounds (as opposed to closing bugzilla complaints with "working
as intended"), how about this?

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 7f0622426b97..d35281492e04 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1460,7 +1460,13 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
 	int large_request = (nbytes > 256);
 
 	trace_extract_entropy_user(r->name, nbytes, ENTROPY_BITS(r), _RET_IP_);
-	xfer_secondary_pool(r, nbytes);
+	if (r->entropy_count < (nbytes << (ENTROPY_SHIFT + 3))) {
+		int hack_xfer_size = nbytes;
+
+		if (3 * r->entropy_count < r->poolinfo->poolfracbits)
+			hack_xfer_size *= 2;
+		_xfer_secondary_pool(r, hack_xfer_size);
+	}
 	nbytes = account(r, nbytes, 0, 0);
 
 	while (nbytes) {

					- Ted

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ