Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] initscripts: Make installation of S20urandom optional.
Date: Mon, 20 Jul 2020 22:42:51 +0200	[thread overview]
Message-ID: <20200720204251.GC2296@scaer> (raw)
In-Reply-To: <b4563955-d358-cfd3-8ae6-6e358e551595@theobroma-systems.com>

Christoph, All,

On 2020-07-20 14:26 +0200, Christoph M?llner spake thusly:
> On 7/19/20 2:24 PM, Yann E. MORIN wrote:
> > On 2020-07-19 14:09 +0200, Peter Seiderer spake thusly:
> >> On Sun, 19 Jul 2020 13:49:50 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > [--SNIP--]
> >>> I would however believe this script is not interesting at all. In fact,
> >>> an ambedded device seldom reboots nicely; instead, it is most often a
> >>> hard-reboot (with a power cycle). In that case, the script would have no
> >>> chance whatsoever to save the current seed before shutdown, thus on next
> That's not fully correct.
> save_random_seed() is also called during start.

Right. But if the entropy pool is so poor at boot that you need to
save-restore the seed at each boot, the probability that the new seed you
save back at startup is very predicatble as it is saved right just after
loading the old one, and since you don't have much entropy to start with,
that defeat the very purpose of saving and restoring the seed.

[--SNIP--]
> I agree mostly to your argumentation.
> 
> However, I know that a S20urandom-like mechanism is exactly
> what I need in systems where I need to start an SSH server
> in an development image for a system without proper entropy source.
> I.e. where poor quality of random number does not matter, but
> a bootup delay of a minute until the kernel RNG is seeded hurts.

Then you do not need to save-n-restore the seed; instead, you need a
better source of entropy availabe early at boot. And that is exactly
what rng-tools and jitterentropy-library, or haveged or others, are
supposed to provide: a strong source of entopy even in the abscence
of HW-TRNG. See:

    package/haveged/
    package/jitterentropy-library/
    https://lwn.net/Articles/802360/  (in kernel-land)

> So I am in favor of being able to remove S20urandom (thus my patch),
> but I see that users need that and would like to continue to support
> people that need it out-of-the-box.

I don't think people need to "save and restore the seed". Really, what
people really need is "strong entropy in early boot".

Saving and restoring the seed is only one technique to do so, and a poor
one at that, because it is fraught with corner cases that break that
assumption.

Instead, solutions exists that are more robust: using rng-tools with
jitternetropy, or haveged. Or a recent kernel (5.3+) that already uses
(some kind of) jitterentropy to seed /dev/random.

> What about moving S20urandom into a package urandom-scripts
> (similar to ifupdown-scripts)?

That would be the least of all evils about this! ;-) I'm going to have a
look at your patch now. Thanks for your persistence! (pun intended! ;-] )

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

      parent reply	other threads:[~2020-07-20 20:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-18 22:44 [Buildroot] [PATCH] initscripts: Make installation of S20urandom optional christoph.muellner at theobroma-systems.com
2020-07-19  8:05 ` Thomas Petazzoni
2020-07-19 11:49   ` Yann E. MORIN
2020-07-19 12:09     ` Peter Seiderer
2020-07-19 12:24       ` Yann E. MORIN
2020-07-20 12:26         ` Christoph Müllner
2020-07-20 12:30           ` Thomas Petazzoni
2020-07-20 15:22             ` Christoph Müllner
2020-07-20 20:42           ` Yann E. MORIN [this message]

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=20200720204251.GC2296@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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