The non-cryptographic RNG implemented by random() has the property
that a seed value of zero will result in a generated sequence of
all-zero values. This situation can arise if currticks() returns zero
at start of day.
Work around this problem by falling back to a fixed non-zero seed if
necessary.
This has no effect on the separate DRBG used by cryptographic code.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
*/
void srandom ( unsigned int seed ) {
rnd_seed = seed;
+ if ( ! rnd_seed )
+ rnd_seed = 4; /* Chosen by fair dice roll */
}
/**