mirror of
https://git.yoctoproject.org/poky
synced 2026-04-28 06:32:34 +02:00
initscripts: Use current date as an additional source of entropy
If the seed file is empty or does not exist, the date is an extremely poor backup source of entropy, but it is better than nothing. (From OE-Core rev: 0a41a7c20316c7d3330233a624d8cf20ea5a81ae) Signed-off-by: Richard Tollerton <rich.tollerton@ni.com> Signed-off-by: Ben Shelton <ben.shelton@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
769b0f3018
commit
82ef864f19
@@ -20,12 +20,11 @@ RANDOM_SEED_FILE=/var/lib/urandom/random-seed
|
||||
case "$1" in
|
||||
start|"")
|
||||
test "$VERBOSE" != no && echo "Initializing random number generator..."
|
||||
# Load and then save 512 bytes,
|
||||
# which is the size of the entropy pool
|
||||
if test -f "$RANDOM_SEED_FILE"
|
||||
then
|
||||
cat "$RANDOM_SEED_FILE" >/dev/urandom
|
||||
fi
|
||||
# Load and then save 512 bytes, which is the size of the entropy
|
||||
# pool. Also load the current date, in case the seed file is
|
||||
# empty.
|
||||
( date +%s.%N; [ -f "$RANDOM_SEED_FILE" ] && cat "$RANDOM_SEED_FILE" ) \
|
||||
>/dev/urandom
|
||||
rm -f "$RANDOM_SEED_FILE"
|
||||
umask 077
|
||||
dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
|
||||
|
||||
Reference in New Issue
Block a user