]> granicus.if.org Git - php/commitdiff
Don't link against openssl 1.1 in curl
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 6 Jan 2020 09:40:43 +0000 (10:40 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 6 Jan 2020 09:42:57 +0000 (10:42 +0100)
OpenSSL 1.1 does not need crypto locking callbacks, so avoid
detecting and linking against it in the first place.

ext/curl/config.m4
ext/curl/interface.c

index fd0e29a96d5cec4ed23195502483d622440e3a34..5799aa8f90bc93b2f0b5aa8cafeaae054d8d5bd5 100644 (file)
@@ -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)
index 4e17e29159c26dad0fdd5f1792812bdd91e3d59b..877b128ed2d57815d4b26020ba37739bb9363133 100644 (file)
@@ -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