From: | Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> |
---|---|
To: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Support getrandom() for pg_strong_random() source |
Date: | 2025-08-08 22:37:42 |
Message-ID: | CAOYmi+nipMzpYjnCsX7WVy0Hczr5dAsUexHOmjMQ9tbPKuSzxg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 8, 2025 at 3:25 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On the other hand, I found a blog post[3] (10 years-old post) that on
> Solaris the output of getentropy() should not be used where randomness
> is needed. I'm not sure it's still true but I guess that it might be
> reasonable to consider that this is correct behavior in principle, and
> that the behavior of glibc etc. is in some sense an exception.
Thanks for finding that! Ah, FIPS:
> More specifically the data returned by getentropy(2) has not had the required FIPS 140-2 processing for the DRBG applied to it.
So FIPS compliance is a case where "a stream of numbers would be
suitable for seeding a CSPRNG, but not suitable as output from a
CSPRNG". That's evidence enough for me to abandon my preference for
getentropy() (whether Solaris still does that or not).
I've been looking at libsodium's randomness implementations [1]:
> On Windows systems, the RtlGenRandom() function is used.
> On OpenBSD and Bitrig, the arc4random() function is used.
> On recent FreeBSD and Linux kernels, the getrandom system call is used.
> On other Unices, the /dev/urandom device is used.
(Note that libsodium has some internal concept of a "safe" arc4random
implementation, which it locks to certain platforms. If an OS is still
literally using RC4 we would not want to use it.)
So, my next question: is getrandom() always preferable to /dev/urandom?
--Jacob
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2025-08-08 22:37:51 | Re: Enhance statistics reset functions to return reset timestamp |
Previous Message | Andres Freund | 2025-08-08 22:34:33 | Re: Kernel AIO on FreeBSD, macOS and a couple of other Unixen |