You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm primarily using this on FreeBSD. According to the FreeBSD manpage for random(3):
The functions described in this manual page are not secure. Applications which require unpredictable random numbers should use arc4random(3) instead.
I'll look at using getrandom(2) where available (i.e. on Linux) and then fall back to arc4random() everywhere else (FreeBSD, Mac OS X, older Linux without getrandom(2)).
It looks like getrandom(2) is a good choice for the following reasons:
it doesn't need to open any files (e.g. /dev/random nor /dev/urandom).
it doesn't need to be seeded by us.
it removes the libbsd dependency on Linux (when getrandom(2) is available).
it is cryptographically secure.
it doesn't block once the pool is ready -- I would assume it would be ready by the time MySQL is started.
etc.
However, even though the getrandom(2) syscall has been present in the kernel since 3.17, which was released over 2 years ago, it was only introduced into glibc 10 days ago (see The long road to getrandom() in glibc).
I'm going to hold off on implementing this change until I can get my hands on a Linux distribution with the new glibc. In the meantime, I'll make a release with the changes from the other issues.
Wouldn't it be better, to replace arc4random() with random() ? This seems to be the only dependency to libbsd.
The text was updated successfully, but these errors were encountered: