diff --git a/man4/random.4 b/man4/random.4 index d12c43cef..e9105f554 100644 --- a/man4/random.4 +++ b/man4/random.4 @@ -7,6 +7,8 @@ .\" .\" Some changes by tytso and aeb. .\" +.\" 2004-12-16, John V. Belmonte/mtk, Updated init and quit scripts +.\" .TH RANDOM 4 2003-10-25 "Linux" "Linux Programmer's Manual" .SH NAME random, urandom \- kernel random number source devices @@ -59,25 +61,34 @@ To do this, add the following lines to an appropriate script which is run during the Linux system start-up sequence: .nf - echo "Initializing kernel random number generator..." - # Initialize kernel random number generator with random seed - # from last shut-down (or start-up) to this start-up. Load and - # then save 512 bytes, which is the size of the entropy pool. - if [ -f /var/random-seed ]; then - cat /var/random-seed >/dev/urandom - fi - dd if=/dev/urandom of=/var/random-seed count=1 + echo "Initializing random number generator..." + random_seed=/var/run/random-seed + # Carry a random seed from start-up to start-up + # Load and then save the whole entropy pool + if [ -f $random_seed ]; then + cat $random_seed >/dev/urandom + else + touch $random_seed + fi + chmod 600 $random_seed + poolfile=/proc/sys/kernel/random/poolsize + [ -r $poolfile ] && bytes=`cat $poolfile` || bytes=512 + dd if=/dev/urandom of=$random_seed count=1 bs=$bytes .fi Also, add the following lines in an appropriate script which is run during the Linux system shutdown: .nf - # Carry a random seed from shut-down to start-up for the random - # number generator. Save 512 bytes, which is the size of the - # random number generator's entropy pool. - echo "Saving random seed..." - dd if=/dev/urandom of=/var/random-seed count=1 + # Carry a random seed from shut-down to start-up + # Save the whole entropy pool + echo "Saving random seed..." + random_seed=/var/run/random-seed + touch $random_seed + chmod 600 $random_seed + poolfile=/proc/sys/kernel/random/poolsize + [ -r $poolfile ] && bytes=`cat $poolfile` || bytes=512 + dd if=/dev/urandom of=$random_seed count=1 bs=$bytes .fi .SH "PROC INTERFACE" The files in the directory