diff options
author | markm <markm@FreeBSD.org> | 2000-07-17 12:28:58 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2000-07-17 12:28:58 +0000 |
commit | 968e0bbd12ba6e07b82f33004f95a3a9cbe321dd (patch) | |
tree | 665e6cf941dd4e34afdf6ba32e2095d9928db7da /etc/rc.shutdown | |
parent | 8d7820758595ec235d4238e286c63546a533f9d3 (diff) | |
download | FreeBSD-src-968e0bbd12ba6e07b82f33004f95a3a9cbe321dd.zip FreeBSD-src-968e0bbd12ba6e07b82f33004f95a3a9cbe321dd.tar.gz |
Add entropy caching. With this, some entropy is cached at shutdown
time, and this is used to reseed the random number generator at
boot time.
NOTE - this has no hope of working if you halt(); you need to
execute rc.shutdown to get the entropy stash.
Diffstat (limited to 'etc/rc.shutdown')
-rw-r--r-- | etc/rc.shutdown | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/etc/rc.shutdown b/etc/rc.shutdown index 0d93bcf..7014c70 100644 --- a/etc/rc.shutdown +++ b/etc/rc.shutdown @@ -26,6 +26,21 @@ elif [ -r /etc/rc.conf ]; then . /etc/rc.conf fi +# Write some entropy so the rebooting /dev/random can reseed +# +case ${entropy_file} in +[Nn][Oo] | '') + ;; +*) + if [ -f ${entropy_file} -a -r ${entropy_file} ] ; then + echo -n "Writing entropy file" + touch ${entropy_file} && \ + chmod 600 ${entropy_file} && \ + dd if=/dev/random of=${entropy_file} bs=4096 count=1 + fi + ;; +esac + # Check if /var/db/mounttab is clean. case $1 in reboot) |