8000 Define OPENSSL_API_COMPAT · postgres/postgres@96f9639 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96f9639

Browse files
peteremichaelpq
authored andcommitted
Define OPENSSL_API_COMPAT
This avoids deprecation warnings from newer OpenSSL versions (3.0.0 in particular). This has been originally applied as 4d3db13 for v14 and newer versions, but not on the older branches out of caution, and this commit closes the gap to remove all these deprecation warnings in all the branches still supported. OPENSSL_API_COMPAT's value is set based on the oldest version of OpenSSL supported on a branch: 1.0.1 for Postgres 13 and 0.9.8 for Postgres 11 and 12. Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/FEF81714-D479-4512-839B-C769D2605F8A@yesql.se Discussion: https://postgr.es/m/ZJJmOH+hIOSoesux@paquier.xyz Backpatch-through: 11
1 parent 973c415 commit 96f9639

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

configure

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12063,7 +12063,11 @@ fi
1206312063
fi
1206412064

1206512065
if test "$with_openssl" = yes ; then
12066-
if test "$PORTNAME" != "win32"; then
12066+
# Minimum required OpenSSL version is 0.9.8
12067+
12068+
$as_echo "#define OPENSSL_API_COMPAT 0x00908000L" >>confdefs.h
12069+
12070+
if test "$PORTNAME" != "win32"; then
1206712071
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_new_ex_data in -lcrypto" >&5
1206812072
$as_echo_n "checking for CRYPTO_new_ex_data in -lcrypto... " >&6; }
1206912073
if ${ac_cv_lib_crypto_CRYPTO_new_ex_data+:} false; then :

configure.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,9 @@ fi
12691269

12701270
if test "$with_openssl" = yes ; then
12711271
dnl Order matters!
1272+
# Minimum required OpenSSL version is 0.9.8
1273+
AC_DEFINE(OPENSSL_API_COMPAT, [0x00908000L],
1274+
[Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.])
12721275
if test "$PORTNAME" != "win32"; then
12731276
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
12741277
AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])

src/include/pg_config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,10 @@
778778
/* Define bytes to use libc memset(). */
779779
#undef MEMSET_LOOP_LIMIT
780780

781+
/* Define to the OpenSSL API version in use. This avoids deprecation warnings
782+
from newer OpenSSL versions. */
783+
#undef OPENSSL_API_COMPAT
784+
781785
/* Define to the address where bug reports for this package should be sent. */
782786
#undef PACKAGE_BUGREPORT
783787

src/include/pg_config.h.win32

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,10 @@
628628
/* Define bytes to use libc memset(). */
629629
#define MEMSET_LOOP_LIMIT 1024
630630

631+
/* Define to the OpenSSL API version in use. This avoids deprecation warnings
632+
from newer OpenSSL versions. */
633+
#define OPENSSL_API_COMPAT 0x00908000L
634+
631635
/* Define to the address where bug reports for this package should be sent. */
632636
#define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org"
633637

src/tools/msvc/Solution.pm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ sub GenerateFiles
151151
{
152152
my $self = shift;
153153
my $bits = $self->{platform} eq 'Win32' ? 32 : 64;
154+
my $openssl_api_compat;
155+
my $ac_define_openssl_api_compat_found = 0;
154156

155157
# Parse configure.in to get version numbers
156158
open(my $c, '<', "configure.in")
@@ -167,10 +169,15 @@ sub GenerateFiles
167169
$self->{numver} = sprintf("%d%04d", $1, $2 ? $2 : 0);
168170
$self->{majorver} = sprintf("%d", $1);
169171
}
172+
elsif (/\bAC_DEFINE\(OPENSSL_API_COMPAT, \[([0-9xL]+)\]/)
173+
{
174+
$ac_define_openssl_api_compat_found = 1;
175+
$openssl_api_compat = $1;
176+
}
170177
}
171178
close($c);
172179
confess "Unable to parse configure.in for all variables!"
173-
if ($self->{strver} eq '' || $self->{numver} eq '');
180+
if ($self->{strver} eq '' || $self->{numver} eq '' || $ac_define_openssl_api_compat_found == 0);
174181

175182
if (IsNewer("src/include/pg_config_os.h", "src/include/port/win32.h"))
176183
{
@@ -254,6 +261,7 @@ sub GenerateFiles
254261
if ($self->{options}->{openssl})
255262
{
256263
print $o "#define USE_OPENSSL 1\n";
264+
print $o "#define OPENSSL_API_COMPAT $openssl_api_compat\n";
257265

258266
my ($digit1, $digit2, $digit3) = $self->GetOpenSSLVersion();
259267

0 commit comments

Comments
 (0)
0