[m-rev.] for review: add a system RNG implementation for the C backends on Linux

Peter Wang novalazy at gmail.com
Mon Feb 1 16:28:10 AEDT 2021


On Mon, 01 Feb 2021 15:56:01 +1100 Julien Fischer <jfischer at opturion.com> wrote:
> >> +
> >> +#if defined(__linux__)
> >> +    #define MR_SYSRAND_IMPL_URANDOM
> >> +#else
> >> +    #define MR_SYSRAND_IMPL_NONE
> >> +#endif
> >
> > I've used /dev/urandom on Linux, FreeBSD, OpenBSD, MacOS X and AIX,
> > and Solaris and NetBSD also have it, so you can enable
> > MR_SYSRAND_IMPL_URANDOM on anything but Windows.
> 
> /dev/urandom should only be used when nothing better is available;
> macOS and the BSDs should all use arc4random().

Sure.

> 
> I don't have access to a Solaris or AIX system to test on.
> 

I don't see any reason not to enable the use of /dev/urandom on
Unix-likes immediately. The code is portable, they all do have
/dev/urandom in practice, and the worst that can happen is a runtime
error if open() fails.

Peter


More information about the reviews mailing list