On Mon, Jul 21, 2014 at 12:01 AM, Antti Kantee <[email protected]> wrote:
> On 20/07/14 14:30, Justin Cormack wrote:
>>>
>>> What is the benefit of using arc4random?  Why not just use urandom on all
>>> platforms all the time?
>>
>>
>> arc4random is more performant, has no failure cases, and on eg freebsd
>> /dev/urandom is just a symlink to /dev/random so thats probably not
>> what you want.
>
>
> It has at least one failure case, except you can't control it:
> http://nxr.netbsd.org/xref/src/lib/libc/gen/arc4random.c#179
>
> I'm still not convinced, but you seem to want it, so go ahead.

Not convinced that that sysctl could actually fail though.

>
> I guess that's ok for config, if someone changes the code they probably
> understand that we're not obliged to support whatever modifications they
> made.
>
> Can arc4random_buf() be considered to be universally available with
> arc4random?  NetBSD grew it only in netbsd-6.

Well it would be easier if we had detection here rather than defines,
would be ok for NetBSD 5 to fall back to /dev/urandom. Some earlier
osx versions don't have it, and osx has /dev/urandom being same as
/dev/random, and apparently osx /dev/random never blocks. Apparently
Android has arc4random_buf in libc but not in the headers.

So overall I think its ok to fall back to /dev/urandom as the posix
version if arc4random_buf is not available, but the detection might
need to be tweaked for unforseen cases, like most of rumpuser_port.h.

Justin

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
rumpkernel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rumpkernel-users

Reply via email to