Skip to content

Commit ea8bc34

Browse files
committed
Make detection of SSL_CTX_set_min_proto_version more portable
As already explained in configure.in, using the OpenSSL version number to detect presence of functions doesn't work, because LibreSSL reports incompatible version numbers. Fortunately, the functions we need here are actually macros, so we can just test for them directly.
1 parent e73e67c commit ea8bc34

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/libpq/be-secure-openssl.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static bool dummy_ssl_passwd_cb_called = false;
6868
static bool ssl_is_server_start;
6969

7070
static int ssl_protocol_version_to_openssl(int v, const char *guc_name);
71-
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
71+
#ifndef SSL_CTX_set_min_proto_version
7272
static int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version);
7373
static int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version);
7474
#endif
@@ -1273,7 +1273,7 @@ ssl_protocol_version_to_openssl(int v, const char *guc_name)
12731273
/*
12741274
* Replacements for APIs present in newer versions of OpenSSL
12751275
*/
1276-
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
1276+
#ifndef SSL_CTX_set_min_proto_version
12771277

12781278
/*
12791279
* OpenSSL versions that support TLS 1.3 shouldn't get here because they
@@ -1327,4 +1327,4 @@ SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version)
13271327
return 1; /* success */
13281328
}
13291329

1330-
#endif /* OPENSSL_VERSION_NUMBER */
1330+
#endif /* !SSL_CTX_set_min_proto_version */

0 commit comments

Comments
 (0)