dev-lang/php: add LibreSSL compatibility patch
authorAaron Bauman <bman@gentoo.org>
Mon, 30 Apr 2018 00:14:35 +0000 (20:14 -0400)
committerAaron Bauman <bman@gentoo.org>
Mon, 30 Apr 2018 00:14:48 +0000 (20:14 -0400)
This patch fixes building with >=dev-libs/libressl-2.7.x.  Patch taken
from upstream bug https://bugs.php.net/bug.php?id=76174.  Hopefully this
will be included in future releases to properly detect LibreSSL
versions due to API differences.

Closes: https://bugs.gentoo.org/651308
Package-Manager: Portage-2.3.31, Repoman-2.3.9

dev-lang/php/files/libressl-compatibility.patch [new file with mode: 0644]
dev-lang/php/php-7.0.29.ebuild
dev-lang/php/php-7.0.30.ebuild
dev-lang/php/php-7.1.16.ebuild
dev-lang/php/php-7.1.17.ebuild
dev-lang/php/php-7.2.5.ebuild

diff --git a/dev-lang/php/files/libressl-compatibility.patch b/dev-lang/php/files/libressl-compatibility.patch
new file mode 100644 (file)
index 0000000..3b9c39d
--- /dev/null
@@ -0,0 +1,65 @@
+--- a/ext/openssl/openssl.c    2018-04-04 14:26:34.583000000 +0000
++++ b/ext/openssl/openssl.c    2018-04-04 14:20:16.907000000 +0000
+@@ -73,7 +73,7 @@
+ #ifdef HAVE_OPENSSL_MD2_H
+ #define OPENSSL_ALGO_MD2      4
+ #endif
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+ #define OPENSSL_ALGO_DSS1     5
+ #endif
+ #define OPENSSL_ALGO_SHA224 6
+@@ -560,7 +560,7 @@
+ #endif
+ 
+ /* {{{ OpenSSL compatibility functions and macros */
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+ #define EVP_PKEY_get0_RSA(_pkey) _pkey->pkey.rsa
+ #define EVP_PKEY_get0_DH(_pkey) _pkey->pkey.dh
+ #define EVP_PKEY_get0_DSA(_pkey) _pkey->pkey.dsa
+@@ -677,7 +677,7 @@
+       return M_ASN1_STRING_data(asn1);
+ }
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined (LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER < 0x10002000L || (defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+ 
+ static int X509_get_signature_nid(const X509 *x)
+ {
+@@ -1324,7 +1324,7 @@
+                       mdtype = (EVP_MD *) EVP_md2();
+                       break;
+ #endif
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+               case OPENSSL_ALGO_DSS1:
+                       mdtype = (EVP_MD *) EVP_dss1();
+                       break;
+@@ -1450,7 +1450,7 @@
+ #ifdef HAVE_OPENSSL_MD2_H
+       REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
+ #endif
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+       REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT);
+ #endif
+       REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT);
+@@ -3620,7 +3620,7 @@
+               RETURN_FALSE;
+       }
+ 
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+       /* Due to changes in OpenSSL 1.1 related to locking when decoding CSR,
+        * the pub key is not changed after assigning. It means if we pass
+        * a private key, it will be returned including the private part.
+@@ -3631,7 +3631,7 @@
+       /* Retrieve the public key from the CSR */
+       tpubkey = X509_REQ_get_pubkey(csr);
+ 
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+       /* We need to free the CSR as it was duplicated */
+       X509_REQ_free(csr);
+ #endif
index ab385d52c394987b731cb64f5f962f2ec68e3987..f0c6303f1cbb54333d32d13597ae5ebef29f244a 100644 (file)
@@ -163,7 +163,12 @@ REQUIRED_USE="
        mysql? ( || ( mysqli pdo ) )
 "
 
-PATCHES=( "${FILESDIR}/mbstring-oniguruma-6.8.patch" )
+PATCHES=(
+       "${FILESDIR}/mbstring-oniguruma-6.8.patch"
+       # hopefully upstream will include the same version check fixes in upcoming releases
+       # patch added 20180429
+       "${FILESDIR}/libressl-compatibility.patch"
+)
 
 PHP_MV="$(get_major_version)"
 
index ec866bd84bad9e1773f29538ca42eecac09382bf..8de4204d1c029f53dcaa7211cd501d73cab9f604 100644 (file)
@@ -163,7 +163,12 @@ REQUIRED_USE="
        mysql? ( || ( mysqli pdo ) )
 "
 
-PATCHES=( "${FILESDIR}/mbstring-oniguruma-6.8.patch" )
+PATCHES=(
+       "${FILESDIR}/mbstring-oniguruma-6.8.patch"
+       # hopefully upstream will include the same version check fixes in upcoming releases
+       # patch added 20180429
+       "${FILESDIR}/libressl-compatibility.patch"
+)
 
 PHP_MV="$(get_major_version)"
 
index 55fab7c4c96b6781379f5bceb1ca22c7be35d569..0075b8f5bd7c9a3f52733f06589928926670bde6 100644 (file)
@@ -145,7 +145,12 @@ REQUIRED_USE="
        mysql? ( || ( mysqli pdo ) )
 "
 
-PATCHES=( "${FILESDIR}/mbstring-oniguruma-6.8.patch" )
+PATCHES=(
+       "${FILESDIR}/mbstring-oniguruma-6.8.patch"
+       # hopefully upstream will include the same version check fixes in upcoming releases
+       # patch added 20180429
+       "${FILESDIR}/libressl-compatibility.patch"
+)
 
 PHP_MV="$(get_major_version)"
 
index 34ff2d2648dcdf9d2b09e4a729f52696de1862d9..fcd553f314841a47344593e7cc1ea98d26b57101 100644 (file)
@@ -144,6 +144,11 @@ REQUIRED_USE="
        session-mm? ( session !threads )
        mysql? ( || ( mysqli pdo ) )
 "
+PATCHES=(
+       # hopefully upstream will include the same version check fixes in upcoming releases
+       # patch added 20180429
+       "${FILESDIR}/libressl-compatibility.patch"
+)
 
 PHP_MV="$(get_major_version)"
 
index 5407f131e1a1400589f0dfba1a7903284d3f267d..558d91754f325703cc7554dccfd8bba8e9c8708c 100644 (file)
@@ -149,6 +149,11 @@ REQUIRED_USE="
        mysql? ( || ( mysqli pdo ) )
        zip-encryption? ( zip )
 "
+PATCHES=(
+       # hopefully upstream will include the same version check fixes in upcoming releases
+       # patch added 20180429
+       "${FILESDIR}/libressl-compatibility.patch"
+)
 
 PHP_MV="$(get_major_version)"