diff options
author | Juan RP <xtraeme@voidlinux.eu> | 2015-05-11 16:58:20 +0200 |
---|---|---|
committer | Juan RP <xtraeme@voidlinux.eu> | 2015-05-11 16:58:20 +0200 |
commit | 4bb1c55f3390bbcb0e11b4ab44299ae06d89b888 (patch) | |
tree | 1bd6e48a97d4bc9e43c621a01d614d5ce27f5642 | |
parent | d111a61fbd67ccf1b29f0707526025440fbf51be (diff) | |
download | runit-void-4bb1c55f3390bbcb0e11b4ab44299ae06d89b888.tar.gz runit-void-4bb1c55f3390bbcb0e11b4ab44299ae06d89b888.tar.xz runit-void-4bb1c55f3390bbcb0e11b4ab44299ae06d89b888.zip |
Find out size of the saved random-seed via /proc/sys/kernel/random/poolsize. 20150511.1
This is what the random(4) manual page recommends, and hopefully should improve entropy reading from /dev/{u,}random.
-rwxr-xr-x | 3 | 2 | ||||
-rw-r--r-- | core-services/05-misc.sh | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/3 b/3 index 13c96b1..42d6c22 100755 --- a/3 +++ b/3 @@ -19,7 +19,7 @@ sv exit /var/service/* [ -x /etc/rc.shutdown ] && /etc/rc.shutdown msg "Saving random seed..." -( umask 077; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 >/dev/null 2>&1 ) +( umask 077; bytes=$(cat /proc/sys/kernel/random/poolsize) || bytes=512; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes >/dev/null 2>&1 ) if [ -z "$VIRTUALIZATION" -a -n "$HARDWARECLOCK" ]; then hwclock --systohc ${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z)} diff --git a/core-services/05-misc.sh b/core-services/05-misc.sh index db1bf34..8f5c6c5 100644 --- a/core-services/05-misc.sh +++ b/core-services/05-misc.sh @@ -2,7 +2,7 @@ msg "Initializing random seed..." cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true -( umask 077; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 >/dev/null 2>&1 ) +( umask 077; bytes=$(cat /proc/sys/kernel/random/poolsize) || bytes=512; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes >/dev/null 2>&1 ) msg "Setting up loopback interface..." ip link set up dev lo |