Re: Move OpenSSL random under USE_OPENSSL_RANDOM

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Magnus Hagander <magnus@hagander.net>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-11-18T08:54:36Z
Lists: pgsql-hackers
On Wed, Nov 18, 2020 at 09:25:44AM +0100, Daniel Gustafsson wrote:
> Technically that is what it does, except for setting the USE_*RANDOM variables
> for non-OpenSSL builds.  We could skip that too, which I think is what you're
> proposing, but it seems to me that we'll end up with another set of entangled
> logic in pg_strong_random if we do since there then needs to be precedence in
> checking (one might be on Windows with OpenSSL for example, where OpenSSL >
> Windows API).

Yes, I am suggesting to just remove both USE_*_RANDOM flags, and use
the following structure instead in pg_strong_random.c for both the
init and main functions:
#ifdef USE_OPENSSL
	/* foo */
#elif WIN32
	/* bar*/
#else
	/* hoge urandom */
#endif

And complain in configure.ac if we miss urandom for the fallback case.

Now, it would not be the first time I suggest something on this thread
that nobody likes :)
--
Michael

Commits

  1. Remove ability to independently select random number generator

  2. Add pg_strong_random_init function to initialize random number generator