[m-rev.] for review: add a system RNG implementation for the C backends on Linux
Julien Fischer
jfischer at opturion.com
Mon Feb 1 16:52:25 AEDT 2021
On Mon, 1 Feb 2021, Peter Wang wrote:
> 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.
I've enabled the urandom method for AIX and Solaris**; I'll be
implementing the arc4random approach in my next change, so I'll
leave the other systems until then.
Julien.
** if you, or anyone else, has access to an AIX or Solaris system,
could you please check once this diff makes into an ROTD.
More information about the reviews
mailing list