Hi all,
Currently we have three options for pg_strong_random() sources:
1. OpenSSL's RAND_bytes()
2. Windows' CryptGenRandom() function
3. /dev/urandom
The patch supports the getrandom() function as a new source of
pg_strong_random(). The getrandom() function uses the same source as
the /dev/urandom device but it seems much faster than opening,
reading, and closing /dev/urandom. Here is the execution time of
generating 1 million UUIDv4 data measured on my environment:
HEAD(/dev/urandom): 1863.064 ms
Patched(getrandom()): 516.627 ms
I guess that while OpenSSL's RAND_bytes() should still be prioritized
where available it might be a good idea to support getrandom() for
builds where RAND_bytes() is not available.
Feedback is very welcome.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com