Andrey Chernov writes:
> > Look at the function random_yarrow_unblock(). Thats where yopu want to
> > be doing this. This function is where the random device is unblocked
> > once safely seeded.
> 
> Thanx for your hint, but I fear one moment using random_yarrow_unblock().
> It is called under mtx_lock(&random_reseed_mtx) in reseed().
> And when arc4rand() seeding is called, it uses read_random(), so I see 
> possible deadlock can happens.

The usual way round this is with a flag. Set a static, volatile flag, defaulting
"off", and set it to "on" when the seeding has happened. Then arc4random() can
do the right thing, depending on this flag.

> In my version arc4rand() seeding happens only when this lock is released,
> so no blocking is possible. 

Sure, but the dependancies created are problematic in their own right.

M
--
Mark R V Murray
Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open)
Pi: 132511160

_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to