diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-06 10:40:43 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-06 10:42:57 +0100 |
commit | 68f6ab711323678382d2746e57358d3f57a3446b (patch) | |
tree | dd09f26c7d9e35d0dfa32f32ff6a3a715f5848e8 /ext/curl | |
parent | 74b11e3315d4204d391e4212a2be800b235af41e (diff) | |
download | php-git-68f6ab711323678382d2746e57358d3f57a3446b.tar.gz |
Don't link against openssl 1.1 in curl
OpenSSL 1.1 does not need crypto locking callbacks, so avoid
detecting and linking against it in the first place.
Diffstat (limited to 'ext/curl')
-rw-r--r-- | ext/curl/config.m4 | 16 | ||||
-rw-r--r-- | ext/curl/interface.c | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4 index fd0e29a96d..5799aa8f90 100644 --- a/ext/curl/config.m4 +++ b/ext/curl/config.m4 @@ -26,7 +26,7 @@ if test "$PHP_CURL" != "no"; then save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $CURL_LIBS" - AC_MSG_CHECKING([for openssl support in libcurl]) + AC_MSG_CHECKING([for libcurl linked against old openssl]) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <strings.h> #include <curl/curl.h> @@ -39,13 +39,23 @@ int main(int argc, char *argv[]) const char *ptr = data->ssl_version; while(*ptr == ' ') ++ptr; - return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1); + if (strncasecmp(ptr, "OpenSSL/1.1", sizeof("OpenSSL/1.1")-1) == 0) { + /* New OpenSSL version */ + return 3; + } + if (strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1) == 0) { + /* Old OpenSSL version */ + return 0; + } + /* Different SSL library */ + return 2; } + /* No SSL support */ return 1; } ]])],[ AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support]) + AC_DEFINE([HAVE_CURL_OLD_OPENSSL], [1], [Have cURL with old OpenSSL]) PKG_CHECK_MODULES([OPENSSL], [openssl], [ PHP_EVAL_LIBLINE($OPENSSL_LIBS, CURL_SHARED_LIBADD) PHP_EVAL_INCLINE($OPENSSL_CFLAGS) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 4e17e29159..877b128ed2 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -43,7 +43,7 @@ #endif /* {{{ cruft for thread safe SSL crypto locks */ -#if defined(ZTS) && defined(HAVE_CURL_OPENSSL) +#if defined(ZTS) && defined(HAVE_CURL_OLD_OPENSSL) # if defined(HAVE_OPENSSL_CRYPTO_H) # define PHP_CURL_NEED_OPENSSL_TSL # include <openssl/crypto.h> @@ -53,7 +53,7 @@ "openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \ "cause random crashes on SSL requests" # endif -#endif /* ZTS && HAVE_CURL_OPENSSL */ +#endif /* ZTS && HAVE_CURL_OLD_OPENSSL */ /* }}} */ #define SMART_STR_PREALLOC 4096 |