7 # REQUIRE: var initrandom
9 # KEYWORD: nojail shutdown
14 start_cmd="random_start"
15 stop_cmd="random_stop"
19 if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
20 cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
26 # Reseed /dev/random with previously stored entropy.
27 case ${entropy_dir} in
31 entropy_dir=${entropy_dir:-/var/db/entropy}
32 if [ -d "${entropy_dir}" ]; then
33 if [ -w /dev/random ]; then
34 for seedfile in ${entropy_dir}/*; do
35 feed_dev_random "${seedfile}"
42 case ${entropy_file} in
46 if [ -w /dev/random ]; then
47 feed_dev_random "${entropy_file}"
48 feed_dev_random /var/db/entropy-file
56 # Write some entropy so when the machine reboots /dev/random
59 case ${entropy_file} in
63 echo -n 'Writing entropy file:'
64 rm -f ${entropy_file} 2> /dev/null
67 if touch ${entropy_file} 2> /dev/null; then
68 entropy_file_confirmed="${entropy_file}"
70 # Try this as a reasonable alternative for read-only
71 # roots, diskless workstations, etc.
72 rm -f /var/db/entropy-file 2> /dev/null
73 if touch /var/db/entropy-file 2> /dev/null; then
74 entropy_file_confirmed=/var/db/entropy-file
77 case ${entropy_file_confirmed} in
79 warn 'write failed (read-only fs?)'
82 dd if=/dev/random of=${entropy_file_confirmed} \
83 bs=4096 count=1 2> /dev/null