On 03.04.2013 11:04, Bruce Evans wrote: >> + mib[0] = CTL_KERN; >> + mib[1] = KERN_ARND; >> + sysctl(mib, 2, (void *)&next, &len, NULL, 0); >> } > > The sysctl() is certain to fail on old kernels (like open of /dev/random > on even older kernels), but there is no longer any error checking or > handling. The contents of `next' on error is indeterminate (not documented > in the man page), but is probably unchanged. Applications can actually > detect this error although though the API doesn't support this, by > using the documented implementation details and assuming that errno > is properly left changed if the syscall fails (set errno to 0 before > the call here and check it after).
Even in case sysctl is not fail, kernel's arc4 is very poorly initialized right after the boot. See the comment in the libkern/arc4random.c arc4_randomstir(), it is about device not loaded case, but it is the same even if device is loaded but not harvest enough. NetBSD implementation of kernel's arc4 is different from ours. Really I am _very_ tired to tell people about the problem, to write patches for the problem, etc., so anybody who are interested can search more details and patches in the mail archives. _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"