All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: peter@korsgaard.com, buildroot@buildroot.org
Cc: Eugen Hristev <Eugen.Hristev@microchip.com>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: [Buildroot] [PATCH] package/urandom-scripts: do not seed if initial seed doesn't exist
Date: Sat, 16 Apr 2022 13:31:38 +0200	[thread overview]
Message-ID: <20220416113138.72159-1-Jason@zx2c4.com> (raw)
In-Reply-To: <87sfqd8eo9.fsf@dell.be.48ers.dk>

By returning a failure in the event that the initial seed doesn't exist,
we'd then skip creating a new seed, which means we'd never in fact have
an initial seed, and this script is therefore useless. Fix this by
checking for the existence of the seed file first, and just returning 0
if it's not there.

Reported-by: Nicolas Cavallari <Nicolas.Cavallari@green-communications.fr>
Reported-by: Eugen Hristev <Eugen.Hristev@microchip.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 package/urandom-scripts/S20urandom | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/urandom-scripts/S20urandom b/package/urandom-scripts/S20urandom
index c6b2ebd48f..6c6aea9eee 100644
--- a/package/urandom-scripts/S20urandom
+++ b/package/urandom-scripts/S20urandom
@@ -18,6 +18,7 @@ else
 fi
 
 init_rng() {
+	[ -f "$URANDOM_SEED" ] || return 0
 	printf 'Initializing random number generator: '
 	dd if="$URANDOM_SEED" bs="$pool_size" of=/dev/urandom count=1 2> /dev/null
 	status=$?
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-04-16 11:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  3:52 [Buildroot] [PATCH] package/urandom-scripts: hash old seed with new seed when saving Jason A. Donenfeld
2022-03-23  5:10 ` Jason A. Donenfeld
2022-03-23  8:43 ` Nicolas Cavallari
2022-03-23  9:13 ` Yann E. MORIN
2022-03-23 13:39   ` Nicolas Cavallari
2022-03-23 20:06   ` Jason A. Donenfeld
2022-03-23 20:07     ` [Buildroot] [PATCH v2] " Jason A. Donenfeld
2022-03-24  8:24       ` Yann E. MORIN
2022-03-24  9:15         ` David Laight
2022-03-24 10:09           ` Yann E. MORIN
2022-03-24 10:25             ` David Laight
2022-03-24 10:39               ` Yann E. MORIN
2022-03-24 13:06                 ` David Laight
2022-03-24 13:54           ` Jason A. Donenfeld
2022-03-24 14:31             ` David Laight
2022-03-24 14:39               ` Jason A. Donenfeld
2022-03-28 13:17         ` Peter Korsgaard
2022-04-15 10:54           ` Eugen.Hristev--- via buildroot
2022-04-15 12:25             ` Nicolas Cavallari
2022-04-16 11:12               ` Peter Korsgaard
2022-04-16 11:31                 ` Jason A. Donenfeld [this message]
2022-04-16 13:47                   ` [Buildroot] [PATCH] package/urandom-scripts: do not seed if initial seed doesn't exist Peter Korsgaard
2022-04-18 20:19                     ` Eugen.Hristev--- via buildroot
2022-04-18 20:36                       ` Jason A. Donenfeld
2022-04-19 10:23                         ` Eugen.Hristev--- via buildroot
2022-04-18 20:50                       ` Peter Korsgaard
2022-05-22 10:11                   ` Peter Korsgaard
2022-04-16  8:29             ` [Buildroot] [PATCH v2] package/urandom-scripts: hash old seed with new seed when saving Peter Korsgaard
2022-03-24  2:41     ` [Buildroot] [PATCH] " Jason A. Donenfeld

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=20220416113138.72159-1-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=Eugen.Hristev@microchip.com \
    --cc=buildroot@buildroot.org \
    --cc=peter@korsgaard.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.