mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Remove ability to independently select random number generator
Remove the ability to select random number generator independently from SSL library. Instead, use the random number generator from the SSL library (today only OpenSSL supported) if one is configured. If no SSL library is configured, use the platform default (which means use CryptoAPI on Win32 and /dev/urandom on Linux). This also restructures pg_strong_random.c to have three clearly separate sections, one for each implementation, with two functions in each, instead of a scattered set of ifdefs throughout the whole file. Author: Daniel Gustafsson, Magnus Hagander, Michael Paquier Discussion: https://postgr.es/m/632623.1605460616@sss.pgh.pa.us
This commit is contained in:
61
configure
vendored
61
configure
vendored
@ -18055,19 +18055,21 @@ $as_echo "#define USE_WIN32_SHARED_MEMORY 1" >>confdefs.h
|
||||
SHMEM_IMPLEMENTATION="src/backend/port/win32_shmem.c"
|
||||
fi
|
||||
|
||||
# Select random number source
|
||||
#
|
||||
# You can override this logic by setting the appropriate USE_*RANDOM flag to 1
|
||||
# in the template or configure command line.
|
||||
|
||||
# If not selected manually, try to select a source automatically.
|
||||
if test x"$USE_OPENSSL_RANDOM" = x"" && test x"$USE_WIN32_RANDOM" = x"" && test x"$USE_DEV_URANDOM" = x"" ; then
|
||||
if test x"$with_openssl" = x"yes" ; then
|
||||
USE_OPENSSL_RANDOM=1
|
||||
elif test "$PORTNAME" = "win32" ; then
|
||||
USE_WIN32_RANDOM=1
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
|
||||
# Select random number source. If a TLS library is used then it will be the
|
||||
# first choice, else the native platform sources (Windows API or /dev/urandom)
|
||||
# will be used.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which random number source to use" >&5
|
||||
$as_echo_n "checking which random number source to use... " >&6; }
|
||||
if test x"$with_openssl" = x"yes" ; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenSSL" >&5
|
||||
$as_echo "OpenSSL" >&6; }
|
||||
elif test x"$PORTNAME" = x"win32" ; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Windows native" >&5
|
||||
$as_echo "Windows native" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: /dev/urandom" >&5
|
||||
$as_echo "/dev/urandom" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
|
||||
$as_echo_n "checking for /dev/urandom... " >&6; }
|
||||
if ${ac_cv_file__dev_urandom+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
@ -18087,36 +18089,11 @@ if test "x$ac_cv_file__dev_urandom" = xyes; then :
|
||||
fi
|
||||
|
||||
|
||||
if test x"$ac_cv_file__dev_urandom" = x"yes" ; then
|
||||
USE_DEV_URANDOM=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which random number source to use" >&5
|
||||
$as_echo_n "checking which random number source to use... " >&6; }
|
||||
if test x"$USE_OPENSSL_RANDOM" = x"1" ; then
|
||||
|
||||
$as_echo "#define USE_OPENSSL_RANDOM 1" >>confdefs.h
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenSSL" >&5
|
||||
$as_echo "OpenSSL" >&6; }
|
||||
elif test x"$USE_WIN32_RANDOM" = x"1" ; then
|
||||
|
||||
$as_echo "#define USE_WIN32_RANDOM 1" >>confdefs.h
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Windows native" >&5
|
||||
$as_echo "Windows native" >&6; }
|
||||
elif test x"$USE_DEV_URANDOM" = x"1" ; then
|
||||
|
||||
$as_echo "#define USE_DEV_URANDOM 1" >>confdefs.h
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: /dev/urandom" >&5
|
||||
$as_echo "/dev/urandom" >&6; }
|
||||
else
|
||||
as_fn_error $? "
|
||||
if test x"$ac_cv_file__dev_urandom" = x"no" ; then
|
||||
as_fn_error $? "
|
||||
no source of strong random numbers was found
|
||||
PostgreSQL can use OpenSSL or /dev/urandom as a source of random numbers." "$LINENO" 5
|
||||
PostgreSQL can use OpenSSL, native Windows API or /dev/urandom as a source of random numbers." "$LINENO" 5
|
||||
fi
|
||||
fi
|
||||
|
||||
# If not set in template file, set bytes to use libc memset()
|
||||
|
Reference in New Issue
Block a user