Automatically load OpenSSL configuration file, from PHP 7.2

This commit is contained in:
Remi Collet 2017-09-06 13:14:52 +02:00
parent 61f1cde1f7
commit 0bfd45f309
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,52 @@
Backported from PHP 7.2
From 58df6a3b61f5cb914d899fbb44eecadad8098700 Mon Sep 17 00:00:00 2001
From: Jakub Zelenka <bukka@php.net>
Date: Mon, 28 Aug 2017 18:48:25 +0100
Subject: [PATCH] Do not explicitly initialize and clean up OpenSSL for OpenSSL
1.1
From 1f843a8fb50de77a3f53a6b892a46d9e0afdfdd7 Mon Sep 17 00:00:00 2001
From: Jakub Zelenka <bukka@php.net>
Date: Mon, 28 Aug 2017 19:25:18 +0100
Subject: [PATCH] Automatically load OpenSSL configuration file
diff -up ./ext/openssl/openssl.c.loadconf ./ext/openssl/openssl.c
--- ./ext/openssl/openssl.c.loadconf 2017-08-30 18:13:18.000000000 +0200
+++ ./ext/openssl/openssl.c 2017-09-06 13:11:47.212803443 +0200
@@ -1409,6 +1409,8 @@ PHP_MINIT_FUNCTION(openssl)
le_x509 = zend_register_list_destructors_ex(php_x509_free, NULL, "OpenSSL X.509", module_number);
le_csr = zend_register_list_destructors_ex(php_csr_free, NULL, "OpenSSL X.509 CSR", module_number);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
+ OPENSSL_config(NULL);
SSL_library_init();
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
@@ -1421,6 +1423,9 @@ PHP_MINIT_FUNCTION(openssl)
#endif
SSL_load_error_strings();
+#else
+ OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
+#endif
/* register a resource id number with OpenSSL so that we can map SSL -> stream structures in
* OpenSSL callbacks */
@@ -1585,12 +1590,15 @@ PHP_MINFO_FUNCTION(openssl)
*/
PHP_MSHUTDOWN_FUNCTION(openssl)
{
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
EVP_cleanup();
/* prevent accessing locking callback from unloaded extension */
CRYPTO_set_locking_callback(NULL);
/* free allocated error strings */
ERR_free_strings();
+ CONF_modules_free();
+#endif
php_unregister_url_stream_wrapper("https");
php_unregister_url_stream_wrapper("ftps");

View File

@ -67,7 +67,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: php
Version: %{upver}%{?rcver:~%{rcver}}
Release: 1%{?dist}
Release: 2%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@ -111,6 +111,8 @@ Patch45: php-5.6.3-ldap_r.patch
Patch46: php-7.0.0-fixheader.patch
# drop "Configure command" from phpinfo output
Patch47: php-5.6.3-phpinfo.patch
# Automatically load OpenSSL configuration file
Patch48: php-7.1.9-openssl-load-config.patch
# Upstream fixes (100+)
@ -718,6 +720,7 @@ support for JavaScript Object Notation (JSON) to PHP.
%endif
%patch46 -p1 -b .fixheader
%patch47 -p1 -b .phpinfo
%patch48 -p1 -b .loadconf
# upstream patches
@ -1505,6 +1508,9 @@ rm -f README.{Zeus,QNX,CVS-RULES}
%changelog
* Wed Sep 6 2017 Remi Collet <remi@fedoraproject.org> - 7.1.9-2
- Automatically load OpenSSL configuration file, from PHP 7.2
* Wed Aug 30 2017 Remi Collet <remi@fedoraproject.org> - 7.1.9-1
- Update to 7.1.9 - http://www.php.net/releases/7_1_9.php