Lower the OpenSSL requirement to 1.0.1
authorOndřej Surý <ondrej@sury.org>
Fri, 31 Dec 2021 06:40:21 +0000 (07:40 +0100)
committerOndřej Surý <ondrej@debian.org>
Mon, 2 Dec 2024 07:33:26 +0000 (08:33 +0100)
Gbp-Pq: Name 0041-Lower-the-OpenSSL-requirement-to-1.0.1.patch

build/php.m4
ext/openssl/config0.m4
ext/openssl/openssl.c
ext/openssl/php_openssl.h
ext/openssl/xp_ssl.c

index e13fc3367ea1e49447c40c18465f8809112f78e6..0648237345da3b6641528417e5d57e2eb3f06fc6 100644 (file)
@@ -1929,7 +1929,7 @@ dnl
 AC_DEFUN([PHP_SETUP_OPENSSL],[
   found_openssl=no
 
-  PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.2], [found_openssl=yes])
+  PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1], [found_openssl=yes])
 
   if test "$found_openssl" = "yes"; then
     PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
index ffd4e0751cc6b73a4cff9649493e16d81616752b..3bc1a0897bd14c88478bc28415f55216a614237b 100644 (file)
@@ -1,7 +1,7 @@
 PHP_ARG_WITH([openssl],
   [for OpenSSL support],
   [AS_HELP_STRING([--with-openssl],
-    [Include OpenSSL support (requires OpenSSL >= 1.0.2)])])
+    [Include OpenSSL support (requires OpenSSL >= 1.0.1)])])
 
 PHP_ARG_WITH([kerberos],
   [for Kerberos support],
index a50a3074117cf995b3287af665768765740d9b07..0fd057383bc28aa9472579721aa13cf1d05f798a 100644 (file)
@@ -95,7 +95,7 @@
 #endif
 #define DEBUG_SMIME    0
 
-#if !defined(OPENSSL_NO_EC) && defined(EVP_PKEY_EC)
+#if !defined(OPENSSL_NO_EC) && defined(EVP_PKEY_EC) && OPENSSL_VERSION_NUMBER >= 0x10002000L
 #define HAVE_EVP_PKEY_EC 1
 #endif
 
@@ -1236,6 +1236,13 @@ PHP_MINIT_FUNCTION(openssl)
        OpenSSL_add_all_ciphers();
        OpenSSL_add_all_digests();
        OpenSSL_add_all_algorithms();
+
+#if !defined(OPENSSL_NO_AES) && defined(EVP_CIPH_CCM_MODE) && OPENSSL_VERSION_NUMBER < 0x100020000
+       EVP_add_cipher(EVP_aes_128_ccm());
+       EVP_add_cipher(EVP_aes_192_ccm());
+       EVP_add_cipher(EVP_aes_256_ccm());
+#endif
+
        SSL_load_error_strings();
 #else
        OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
index 5cfadbedc9829e5178539fb2876089e30f2070e9..cd2dc1bdc94238df9c7508ef6f27ca535542608c 100644 (file)
@@ -35,7 +35,9 @@ extern zend_module_entry openssl_module_entry;
 #endif
 #else
 /* OpenSSL version check */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10002000L
+#define PHP_OPENSSL_API_VERSION 0x10001
+#elif OPENSSL_VERSION_NUMBER < 0x10100000L
 #define PHP_OPENSSL_API_VERSION 0x10002
 #elif OPENSSL_VERSION_NUMBER < 0x30000000L
 #define PHP_OPENSSL_API_VERSION 0x10100
index a0db38c20bc024e84a110ea1c78998e303af2fec..6adc6cc8a32e41f8200e4a3bf0e7ae8351e551b1 100644 (file)
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
 #include <openssl/err.h>
+
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
 #include <openssl/bn.h>
 #include <openssl/dh.h>
+#endif
 
 #ifdef PHP_WIN32
 #include "win32/winutil.h"
 
 #ifndef OPENSSL_NO_TLSEXT
 #define HAVE_TLS_SNI 1
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
 #define HAVE_TLS_ALPN 1
 #endif
+#endif
 
 #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
 #define HAVE_SEC_LEVEL 1
@@ -1316,8 +1321,12 @@ static int php_openssl_set_server_ecdh_curve(php_stream *stream, SSL_CTX *ctx) /
 
        zvcurve = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "ecdh_curve");
        if (zvcurve == NULL) {
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
                SSL_CTX_set_ecdh_auto(ctx, 1);
                return SUCCESS;
+#else
+               curve_nid = NID_X9_62_prime256v1;
+#endif
        } else {
                if (!try_convert_to_string(zvcurve)) {
                        return FAILURE;