]> granicus.if.org Git - php/commitdiff
Remove curl gnutls locking
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 11 Apr 2019 14:45:45 +0000 (16:45 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 11 Apr 2019 14:45:45 +0000 (16:45 +0200)
This is only relevant for the gcrypt backend, which is no longer in
use. I couldn't find any hard info on when exactly gcrypt support was
dropped, but nette is the default since 2.11.1. Most code that still
has the gcrypt handling is checking against < 2.12. In either case,
those versions were released in 2010/2011.

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

index 6ebfac78c8d903c45d0d9f50f610718b04175820..88447bd78af6d732e4a13f3fe548a3277c72ee8e 100644 (file)
@@ -80,9 +80,7 @@ int main(int argc, char *argv[])
 }
 ]])], [
       AC_MSG_RESULT([yes])
-      AC_CHECK_HEADER([gcrypt.h], [
-        AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
-      ])
+      AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
     ], [
       AC_MSG_RESULT([no])
     ], [
index 8959bc10043134d468f9a54ef3157f79071255bf..f074cbac0dbac984260494895cde344446fe5b8a 100644 (file)
        "cause random crashes on SSL requests"
 #   endif
 #  elif defined(HAVE_CURL_GNUTLS)
-#   if defined(HAVE_GCRYPT_H)
-#    define PHP_CURL_NEED_GNUTLS_TSL
-#    include <gcrypt.h>
-#   else
-#    warning \
-       "libcurl was compiled with GnuTLS support, but configure could not find " \
-       "gcrypt.h; thus no SSL crypto locking callbacks will be set, which may " \
-       "cause random crashes on SSL requests"
-#   endif
+    /* Modern versions of GnuTLS use the nette backend rather than gcrypt, so there
+        * is nothing to do here anymore. */
 #  else
 #   warning \
        "libcurl was compiled with SSL support, but configure could not determine which" \
@@ -111,43 +104,6 @@ static ZEND_ATTRIBUTE_UNUSED unsigned long php_curl_ssl_id(void)
 #endif
 /* }}} */
 
-#ifdef PHP_CURL_NEED_GNUTLS_TSL /* {{{ */
-static int php_curl_ssl_mutex_create(void **m)
-{
-       if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
-               return SUCCESS;
-       } else {
-               return FAILURE;
-       }
-}
-
-static int php_curl_ssl_mutex_destroy(void **m)
-{
-       tsrm_mutex_free(*((MUTEX_T *) m));
-       return SUCCESS;
-}
-
-static int php_curl_ssl_mutex_lock(void **m)
-{
-       return tsrm_mutex_lock(*((MUTEX_T *) m));
-}
-
-static int php_curl_ssl_mutex_unlock(void **m)
-{
-       return tsrm_mutex_unlock(*((MUTEX_T *) m));
-}
-
-static struct gcry_thread_cbs php_curl_gnutls_tsl = {
-       GCRY_THREAD_OPTION_USER,
-       NULL,
-       php_curl_ssl_mutex_create,
-       php_curl_ssl_mutex_destroy,
-       php_curl_ssl_mutex_lock,
-       php_curl_ssl_mutex_unlock
-};
-#endif
-/* }}} */
-
 static void _php_curl_close_ex(php_curl *ch);
 static void _php_curl_close(zend_resource *rsrc);
 
@@ -1473,9 +1429,6 @@ PHP_MINIT_FUNCTION(curl)
                CRYPTO_set_locking_callback(php_curl_ssl_lock);
        }
 #endif
-#ifdef PHP_CURL_NEED_GNUTLS_TSL
-       gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
-#endif
 
        if (curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK) {
                return FAILURE;