[Buildroot] [git commit] package/urandom-scripts: do not seed if initial seed doesn't exist
Peter Korsgaard
peter at korsgaard.com
Sat Apr 16 13:44:34 UTC 2022
commit: https://git.buildroot.net/buildroot/commit/?id=e65e9acb201ba2cf3f1b0b209b45d557577d8044
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
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 at green-communications.fr>
Reported-by: Eugen Hristev <Eugen.Hristev at microchip.com>
Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>
Signed-off-by: Peter Korsgaard <peter at korsgaard.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=$?
More information about the buildroot
mailing list