diff options
author | markm <markm@FreeBSD.org> | 2004-04-09 15:56:16 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2004-04-09 15:56:16 +0000 |
commit | 876f2f7db7bf97627963961062028988595a748d (patch) | |
tree | b70fc2cde39655c12aff4aae057a441dbe213c97 /etc/rc.d | |
parent | 55fe453be79ed7f8b847749e04d07c6f89ef819d (diff) | |
download | FreeBSD-src-876f2f7db7bf97627963961062028988595a748d.zip FreeBSD-src-876f2f7db7bf97627963961062028988595a748d.tar.gz |
Take into account hardware-supplied entropy. If the entropy source
is hardware, the Yarrow initialisations don't need to be done.
Diffstat (limited to 'etc/rc.d')
-rw-r--r-- | etc/rc.d/initrandom | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/etc/rc.d/initrandom b/etc/rc.d/initrandom index 7c49ab1..e418d86 100644 --- a/etc/rc.d/initrandom +++ b/etc/rc.d/initrandom @@ -23,50 +23,57 @@ feed_dev_random() initrandom_start() { + soft_random_generator=`sysctl kern.random 2>/dev/null` + echo -n 'Entropy harvesting:' - if checkyesno harvest_interrupt; then - if [ -w /dev/random ]; then - ${SYSCTL_W} kern.random.sys.harvest.interrupt=1 >/dev/null - echo -n ' interrupts' + if [ \! -z "${soft_random_generator}" ] ; then + + if checkyesno harvest_interrupt; then + if [ -w /dev/random ]; then + ${SYSCTL_W} kern.random.sys.harvest.interrupt=1 >/dev/null + echo -n ' interrupts' + fi fi - fi - if checkyesno harvest_ethernet; then - if [ -w /dev/random ]; then - ${SYSCTL_W} kern.random.sys.harvest.ethernet=1 >/dev/null - echo -n ' ethernet' + if checkyesno harvest_ethernet; then + if [ -w /dev/random ]; then + ${SYSCTL_W} kern.random.sys.harvest.ethernet=1 >/dev/null + echo -n ' ethernet' + fi fi - fi - if checkyesno harvest_p_to_p; then - if [ -w /dev/random ]; then - ${SYSCTL_W} kern.random.sys.harvest.point_to_point=1 >/dev/null - echo -n ' point_to_point' + if checkyesno harvest_p_to_p; then + if [ -w /dev/random ]; then + ${SYSCTL_W} kern.random.sys.harvest.point_to_point=1 >/dev/null + echo -n ' point_to_point' + fi fi - fi - echo '.' + # XXX temporary until we can improve the entropy + # harvesting rate. + # Entropy below is not great, but better than nothing. + # This unblocks the generator at startup + ( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) \ + | dd of=/dev/random bs=8k 2>/dev/null + cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null - # First pass at reseeding /dev/random. - # - case ${entropy_file} in - [Nn][Oo] | '') - ;; - *) - if [ -w /dev/random ]; then - feed_dev_random "${entropy_file}" - fi - ;; - esac + # First pass at reseeding /dev/random. + # + case ${entropy_file} in + [Nn][Oo] | '') + ;; + *) + if [ -w /dev/random ]; then + feed_dev_random "${entropy_file}" + fi + ;; + esac - # XXX temporary until we can get the entropy - # harvesting rate up - # Entropy below is not great, - # but better than nothing. - ( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) \ - | dd of=/dev/random bs=8k 2>/dev/null - cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null + echo -n ' kickstart' + fi + + echo '.' } load_rc_config random |