diff --git a/configure.ac b/configure.ac index 57f734879e..0cf8d36fcd 100644 --- a/configure.ac +++ b/configure.ac @@ -1352,7 +1352,8 @@ if test "$with_ssl" = openssl ; then # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it # doesn't have these OpenSSL 1.1.0 functions. So check for individual # functions. - AC_CHECK_FUNCS([OPENSSL_init_ssl BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free]) + AC_CHECK_FUNCS([OPENSSL_init_ssl BIO_meth_new ASN1_STRING_get0_data]) + AC_CHECK_FUNCS([HMAC_CTX_new], [AC_DEFINE([USE_RESOWNER_FOR_HMAC], 1)]) # OpenSSL versions before 1.1.0 required setting callback functions, for # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock() # function was removed. diff --git a/meson.build b/meson.build index 18b5be842e..1b46cf1790 100644 --- a/meson.build +++ b/meson.build @@ -1283,8 +1283,7 @@ if sslopt in ['auto', 'openssl'] ['OPENSSL_init_ssl'], ['BIO_meth_new'], ['ASN1_STRING_get0_data'], - ['HMAC_CTX_new'], - ['HMAC_CTX_free'], + ['HMAC_CTX_new', {'define': 'USE_RESOWNER_FOR_HMAC'}], # OpenSSL versions before 1.1.0 required setting callback functions, for # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock() @@ -1309,6 +1308,10 @@ if sslopt in ['auto', 'openssl'] elif not required cdata.set('HAVE_' + func.to_upper(), val ? 1 : false) endif + definevar = c.get(1, {}).get('define', false) + if definevar + cdata.set(definevar, 1) + endif endforeach if are_openssl_funcs_complete diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 591e1ca3df..3fad59e530 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -198,11 +198,8 @@ /* Define to 1 if you have the `history_truncate_file' function. */ #undef HAVE_HISTORY_TRUNCATE_FILE -/* Define to 1 if you have the `HMAC_CTX_free' function. */ -#undef HAVE_HMAC_CTX_FREE - -/* Define to 1 if you have the `HMAC_CTX_new' function. */ -#undef HAVE_HMAC_CTX_NEW +/* Define to 1 if you track OpenSSL HMAC contexts with a resource owner. */ +#undef USE_RESOWNER_FOR_HMAC /* Define to 1 if you have the header file. */ #undef HAVE_IFADDRS_H