blob: 14b2378a9ca0a6e7331d7ba28817354b1b4c1c4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: preseedrandom
# KEYWORD: FreeBSD nojail
feed_dev_random()
{
if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
fi
}
soft_random_generator=`sysctl kern.random 2>/dev/null`
if [ -n "${soft_random_generator}" ] ; then
echo -n 'Pre-seeding PRNG:'
# 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.
#
if [ -w /dev/random ]; then
feed_dev_random "/entropy"
fi
echo -n ' kickstart'
echo '.'
fi
|