1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Fix building with LibreSSL.

LibreSSL defines OPENSSL_VERSION_NUMBER to claim that it is version 2.0.0,
but it doesn't have the functions added in OpenSSL 1.1.0. Add autoconf
checks for the individual functions we need, and stop relying on
OPENSSL_VERSION_NUMBER.

Backport to 9.5 and 9.6, like the patch that broke this. In the
back-branches, there are still a few OPENSSL_VERSION_NUMBER checks left,
to check for OpenSSL 0.9.8 or 0.9.7. I left them as they were - LibreSSL
has all those functions, so they work as intended.

Per buildfarm member curculio.

Discussion: <2442.1473957669@sss.pgh.pa.us>
This commit is contained in:
Heikki Linnakangas
2016-09-15 22:29:39 +03:00
parent ffccee4736
commit 5c6df67e0c
6 changed files with 85 additions and 21 deletions

View File

@ -914,10 +914,6 @@ px_find_cipher(const char *name, PX_Cipher **res)
static int openssl_random_init = 0;
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define RAND_OpenSSL RAND_SSLeay
#endif
/*
* OpenSSL random should re-feeded occasionally. From /dev/urandom
* preferably.
@ -926,7 +922,13 @@ static void
init_openssl_rand(void)
{
if (RAND_get_rand_method() == NULL)
{
#ifdef HAVE_RAND_OPENSSL
RAND_set_rand_method(RAND_OpenSSL());
#else
RAND_set_rand_method(RAND_SSLeay());
#endif
}
openssl_random_init = 1;
}