Note: the previous rev's CVS comment was messed up due to an editor snafu.
authorMatthew Dillon <dillon@dragonflybsd.org>
Wed, 12 Apr 2006 18:28:30 +0000 (18:28 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Wed, 12 Apr 2006 18:28:30 +0000 (18:28 +0000)
commit9a2df248c10274844f2bcfd0f83826d49e98c239
tree421d3726e3eb9c6f36840d172bb45b6c421eaa5c
parent1f30239450a6485ec98c3d5e3a7b4211a957678e
Note: the previous rev's CVS comment was messed up due to an editor snafu.

/dev/random was almost always returning 0 bytes.  This was due to several
factors, primarily the fact that the stack smash handler reads 32 bytes from
/dev/urandom every time a program is exec'd, and because /dev/random and
/dev/urandom share the same pool.

* Give /dev/random and /dev/urandom their own separate pools.

* Be slightly less conservative on the number of bits of randomness we
  think we've added.

* extract_entropy() calls add_timer_randomness(), which adds entropy.  This
  can create a situation where entropy always appears to be available when,
  in fact, it is of very low quality.  Add a little hysteresis so degenerate
  cases return 0 bytes instead of 1 byte.

* Also (in this commit) fix a bug in the previous commit where the randomness
  added was accidently halved.

Reported-by: David Rhodus
sys/kern/kern_random.c