Re: Support getrandom() for pg_strong_random() source - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Support getrandom() for pg_strong_random() source
Date
Msg-id a6ba99bf-c5bd-4522-b25a-c817ec495644@eisentraut.org
Whole thread Raw
In response to Re: Support getrandom() for pg_strong_random() source  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
List pgsql-hackers
On 22.07.25 13:11, Dagfinn Ilmari Mannsåker wrote:
> getrandom() is Linux-specific, while getentropy() is specified by POSIX
> (since 2024).  It was originally introduced by OpenBSD 5.6 in 2014, and
> was added to macOS 10.12 in 2016, glibc 2.25 (same as getrandom()) in
> 2017, musl 1.1.20 and FreeBSD 12.0 in 2018, and NetBSD 10.0 in 2024
> 
> Sources:
> 
> https://pubs.opengroup.org/onlinepubs/9799919799/functions/getentropy.html
> https://dotat.at/@/2024-10-01-getentropy.html
> 
> So I think it's more worthwhile to add support for getentropy() than
> getrandom().

The POSIX description of getentropy() says:

"The intended use of this function is to create a seed for other 
pseudo-random number generators."

So using getentropy() for generating the random numbers that are passed 
back to the application code would appear to be the wrong use.



pgsql-hackers by date:

Previous
From: Japin Li
Date:
Subject: Re: [WIP]Vertical Clustered Index (columnar store extension) - take2
Next
From: Fabrice Chapuis
Date:
Subject: Re: pg_basebackup and pg_switch_wal()