After bug report from John V. Belmonte

Updated init and quit scripts to reflect kernel 2.4/2.6 reality
     (Scripts taken from drivers/char/random.c)
     as per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=247779
This commit is contained in:
Michael Kerrisk 2004-12-16 14:24:00 +00:00
parent d4e39a3e0a
commit 8deb0f0d5b
1 changed files with 24 additions and 13 deletions

View File

@ -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