summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@ni.com>2014-07-17 16:56:55 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-19 00:08:59 +0100
commit82ef864f19b5712bed54b92ff369b4dc0693dc9a (patch)
treeb63353a4eb94915b5185ce3e8e9b3f4eb0c154d1 /meta
parent769b0f3018358b276e1a12b0a6f621412f2ccbcd (diff)
downloadpoky-82ef864f19b5712bed54b92ff369b4dc0693dc9a.tar.gz
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>
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/urandom11
1 files changed, 5 insertions, 6 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/urandom b/meta/recipes-core/initscripts/initscripts-1.0/urandom
index a0549dec25..ec4ef61f23 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/urandom
+++ b/meta/recipes-core/initscripts/initscripts-1.0/urandom
@@ -20,12 +20,11 @@ RANDOM_SEED_FILE=/var/lib/urandom/random-seed
20case "$1" in 20case "$1" in
21 start|"") 21 start|"")
22 test "$VERBOSE" != no && echo "Initializing random number generator..." 22 test "$VERBOSE" != no && echo "Initializing random number generator..."
23 # Load and then save 512 bytes, 23 # Load and then save 512 bytes, which is the size of the entropy
24 # which is the size of the entropy pool 24 # pool. Also load the current date, in case the seed file is
25 if test -f "$RANDOM_SEED_FILE" 25 # empty.
26 then 26 ( date +%s.%N; [ -f "$RANDOM_SEED_FILE" ] && cat "$RANDOM_SEED_FILE" ) \
27 cat "$RANDOM_SEED_FILE" >/dev/urandom 27 >/dev/urandom
28 fi
29 rm -f "$RANDOM_SEED_FILE" 28 rm -f "$RANDOM_SEED_FILE"
30 umask 077 29 umask 077
31 dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \ 30 dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \