From: "Theodore Ts'o" <tytso@mit.edu>
To: Sandy Harris <sandyinchina@gmail.com>
Cc: "Stephan Müller" <smueller@chronox.de>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jason A. Donenfeld" <jason@zx2c4.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Linux Crypto Mailing List" <linux-crypto@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v12 3/4] Linux Random Number Generator
Date: Sun, 23 Jul 2017 17:47:57 -0400 [thread overview]
Message-ID: <20170723214757.qil4p7s4d6xc2ker@thunk.org> (raw)
In-Reply-To: <CACXcFm=mQ9namu2R32fJDDRe_gEGxiAar=Hne6012Vnq9x+uRA@mail.gmail.com>
On Sun, Jul 23, 2017 at 02:05:38PM -0400, Sandy Harris wrote:
> Sandy Harris <sandyinchina@gmail.com> wrote:
>
> > The biggest problem with random(4) is that you cannot generate good
> > output without a good seed & just after boot, ...
> >
> > The only really good solution I know of is to find a way to provide a
> > chunk of randomness early in the boot process. John Denker has a good
> > discussion of doing this by modifying the kernel image & Ted talks of
> > doing it via the boot loader. ...
>
> Would it be enough to have a kernel module that does more-or-less what
> the current shell scripts do, but earlier in the boot process? Throw
> the stored data into the random(4) driver at module init time & update
> it periodically later. This would not help much for first boot on a
> new system, unless its store could be updated during install; Denker's
> point that you need each system provisioned differently is important.
> However it looks like it would be enough on other boots.
There are two things that make this hard. The first is progamming
environment for, say, the GRUB bootloader, is very different from that
of, say, a System V init script. The second is that it's not obvious
where you can safely store the information across boots.
For a specific architecture --- say, a PC desktop/server using a MBR
or GPT partition table, it's not that hard. At which point, if you
want to assume that you are using a distribution kernel which is using
an initial ramdisk, you might not even need a kernel module; you could
just do it in the initrd before systemd gets a chance to run, and then
you can do it as a straight-forward shell script. So that's actually
not hard, and not that different from what we have today.
It won't solve the problem for, say a Tails system, where you could be
booting off of a DVD (in which case you might not have any place to
store state), or a USB or SD card. That's *also* not hard, but you
end up having to have a different solution for that case.
> It also looks like it might be easier to implement & test. In
> particular it is an isolated do-one-thing-well tool; the programmer
> only needs to worry about his or her module, not several different
> boot loaders or the procedures that distros have for CD images or
> manufacturers for device setup.
Unfortunately, you *do* still have to worry about multiple partition
tables, and potential places where the entropy could be stored. The
solution for MBR, GPT, and Tails will all have to be slightly
different.
Again, none of this is terribly tricky work. There are lots of fiddly
details, and if you get it right for one configuration, you will still
have to do something else for the next configuration. So it's a lot
of grunt work, and since you can't come up for one solution that will
solve it for all systems, it won't be terribly glorious.
Note that you can also solve this problem by diddling the systemd unit
files, if you can make sure that you can fix the dependencies such
that the entropy setup is the very thing that happens after root file
system is mounted read/write, and before anything that might try to
generate keys is allowed to run. That's going to be roughly the same
level of coverage as a kernel module and doesn't require trying to
store it in some partition-table unique place, but instead you have to
learn a lot of about systemd unit file configuration.
Cheers,
- Ted
next prev parent reply other threads:[~2017-07-23 21:48 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 7:57 [RFC PATCH v12 0/4] /dev/random - a new approach Stephan Müller
2017-07-18 7:57 ` [RFC PATCH v12 1/4] crypto: make Jitter RNG directly accessible Stephan Müller
2017-07-18 8:30 ` Greg Kroah-Hartman
2017-07-18 8:40 ` Stephan Müller
2017-07-18 8:49 ` Greg Kroah-Hartman
2017-07-18 8:53 ` Stephan Müller
2017-07-18 9:02 ` Arnd Bergmann
2017-07-18 9:10 ` Stephan Müller
2017-07-18 9:16 ` Arnd Bergmann
2017-07-18 9:17 ` Stephan Müller
2017-07-18 7:58 ` [RFC PATCH v12 2/4] random: conditionally compile code depending on LRNG Stephan Müller
2017-07-18 8:13 ` Arnd Bergmann
2017-07-18 8:37 ` Stephan Müller
2017-07-18 8:47 ` Arnd Bergmann
2017-07-18 8:50 ` Stephan Müller
2017-07-18 7:59 ` [RFC PATCH v12 3/4] Linux Random Number Generator Stephan Müller
2017-07-18 8:32 ` Greg Kroah-Hartman
2017-07-18 8:45 ` Stephan Müller
2017-07-18 8:52 ` Greg Kroah-Hartman
2017-07-18 14:37 ` Stephan Müller
2017-07-18 21:08 ` Theodore Ts'o
2017-07-19 1:00 ` Sandy Harris
2017-07-19 1:51 ` Theodore Ts'o
2017-07-19 6:25 ` Stephan Müller
2017-07-30 10:44 ` Pavel Machek
2017-07-23 18:05 ` Sandy Harris
2017-07-23 21:47 ` Theodore Ts'o [this message]
2017-07-19 6:22 ` Stephan Müller
2017-07-19 6:34 ` Greg Kroah-Hartman
2017-07-19 17:26 ` Theodore Ts'o
2017-07-20 19:00 ` Stephan Müller
2017-07-21 3:08 ` Theodore Ts'o
2017-07-21 8:57 ` Stephan Müller
2017-07-21 15:09 ` Arnd Bergmann
2017-07-21 15:17 ` Stephan Müller
2017-07-18 8:52 ` Greg Kroah-Hartman
2017-07-18 7:59 ` [RFC PATCH v12 4/4] LRNG - enable compile Stephan Müller
2017-07-18 8:51 ` Arnd Bergmann
2017-07-18 8:56 ` Stephan Müller
2017-07-21 11:30 [RFC PATCH v12 3/4] Linux Random Number Generator Jeffrey Walton
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=20170723214757.qil4p7s4d6xc2ker@thunk.org \
--to=tytso@mit.edu \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jason@zx2c4.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandyinchina@gmail.com \
--cc=smueller@chronox.de \
/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®