From: Kurt Roeckx <kurt@roeckx.be>
To: linux-kernel@vger.kernel.org
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: Stop breaking the CSRNG
Date: Wed, 2 Oct 2019 18:55:33 +0200 [thread overview]
Message-ID: <20191002165533.GA18282@roeckx.be> (raw)
Hi,
As OpenSSL, we want cryptograhic secure random numbers. Before
getrandom(), Linux never provided a good API for that, both
/dev/random and /dev/urandom have problems. getrandom() fixed
that, so we switched to it were available.
It was possible to combine /dev/random and /dev/urandom, and get
something that worked properly. You could call select() on
/dev/random and know that both were initialized when it returned.
But then select() started returning before /dev/random was
initialized, so that if you switch to /dev/urnadom, it's still
uninitialized.
A solution for that was that you could instead read 1 byte from
/dev/random, and then switch to /dev/urandom. But that also stopped
working, /dev/urandom can still be uninitialized when you can read from
/dev/random. So there no longer is a way to wait for /dev/urandom
to be initialized.
As a result of that, we now refuse to use /dev/urandom on recent
kernels, and require to use of getrandom(). (To make this work with
older userspace, this means we need to import all the different
__NR_getrandom defines, and do the system call ourself.)
But it seems people are now thinking about breaking getrandom() too,
to let it return data when it's not initialized by default. Please
don't.
If you think such a mode is useful for some applications, let them set
a flag, instead of the reverse.
Kurt
next reply other threads:[~2019-10-02 17:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 16:55 Kurt Roeckx [this message]
2019-10-03 3:36 ` Theodore Y. Ts'o
2019-10-03 21:14 ` Kurt Roeckx
2019-10-06 12:15 ` Pavel Machek
2019-10-03 10:13 ` David Laight
2019-10-03 11:51 ` Adam Borowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191002165533.GA18282@roeckx.be \
--to=kurt@roeckx.be \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®