Return two fixes from previous backout which does not require

review by secteam@ for the reasons mentioned below.

1) Rename /dev/urandom to /dev/random since urandom marked as
XXX Deprecated
alias in /sys/dev/random/randomdev.c
(this is our naming convention and no review by secteam@ required)

2) Set rs_stired flag after forced initialization to prevent
double stearing.
(this is already in OpenBSD, i.e. they don't have double stearing.
It means that this change matches their code path and no additional
secteam@ review required)

Submitted by:   Thorsten Glaser <tg@mirbsd.de> (2)
This commit is contained in:
Andrey A. Chernov 2008-09-09 09:46:36 +00:00
parent c10eb6d10a
commit 4220467ec2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182886

View File

@ -54,7 +54,7 @@ struct arc4_stream {
static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
#define RANDOMDEV "/dev/urandom"
#define RANDOMDEV "/dev/random"
#define KEYSIZE 128
#define THREAD_LOCK() \
do { \
@ -193,6 +193,7 @@ arc4random_stir(void)
THREAD_LOCK();
arc4_check_init();
arc4_stir();
rs_stired = 1;
THREAD_UNLOCK();
}