Store the defined random pool size, #177722 thanks to Yaroslav Isakov.

This commit is contained in:
Roy Marples 2007-05-11 10:33:49 +00:00
parent 56148d60dd
commit 81ccc67446
5 changed files with 18 additions and 10 deletions

View File

@ -3,6 +3,7 @@
11 May 2007; Roy Marples <uberlord@gentoo.org>: 11 May 2007; Roy Marples <uberlord@gentoo.org>:
Store the defined random pool size, #177722 thanks to Yaroslav Isakov.
Use auto for /mnt/cdrom, #177990. Use auto for /mnt/cdrom, #177990.
Use clock MONOTONIC to timeout, not localtime, #177514. Use clock MONOTONIC to timeout, not localtime, #177514.

View File

@ -17,4 +17,4 @@ start() {
eend $? "Failed to set the hostname" eend $? "Failed to set the hostname"
} }
# vim: ts=4 : # vim: set ts=4 :

View File

@ -30,5 +30,4 @@ stop() {
eend $? $"Failed to stop local" eend $? $"Failed to stop local"
} }
# vim: set ts=4 :
# vim:ts=4

View File

@ -12,5 +12,4 @@ start() {
fi fi
} }
# vim: set ts=4 :
# vim:ts=4

View File

@ -6,6 +6,17 @@ depend() {
need localmount need localmount
} }
save_seed() {
local poolsize=1
if [ -e /proc/sys/kernel/random/poolsize ] ; then
poolsize=$(($(cat /proc/sys/kernel/random/poolsize) / 4096))
fi
umask 077
dd if=/dev/urandom of=/var/run/random-seed count=${poolsize} 2>/dev/null
}
start() { start() {
[ -c /dev/urandom ] || return [ -c /dev/urandom ] || return
if [ -f /var/run/random-seed ] ; then if [ -f /var/run/random-seed ] ; then
@ -16,8 +27,7 @@ start() {
return 0 return 0
fi fi
ebegin "Initializing random number generator" ebegin "Initializing random number generator"
umask 077 save_seed
dd if=/dev/urandom of=/var/run/random-seed count=1 2>/dev/null
eend $? "Error initializing random number generator" eend $? "Error initializing random number generator"
umask 022 umask 022
} }
@ -26,9 +36,8 @@ stop() {
ebegin "Saving random seed" ebegin "Saving random seed"
# Carry a random seed from shut-down to start-up; # Carry a random seed from shut-down to start-up;
# see documentation in linux/drivers/char/random.c # see documentation in linux/drivers/char/random.c
umask 077 save_seed
dd if=/dev/urandom of=/var/run/random-seed count=1 2>/dev/null
eend $? "Failed to save random seed" eend $? "Failed to save random seed"
} }
# vim:ts=4 # vim: set ts=4 :