103 lines
4.5 KiB
Diff
103 lines
4.5 KiB
Diff
--- ext/openssl/openssl.c.orig 2018-04-24 17:49:42.959226505 +0200
|
|
+++ ext/openssl/openssl.c 2018-04-24 18:05:49.423593182 +0200
|
|
@@ -72,7 +72,8 @@
|
|
#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 < 0x2070000fL)
|
|
#define OPENSSL_ALGO_DSS1 5
|
|
#endif
|
|
#define OPENSSL_ALGO_SHA224 6
|
|
@@ -566,7 +567,8 @@ ZEND_GET_MODULE(openssl)
|
|
#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 < 0x2070000fL)
|
|
#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
|
|
@@ -683,7 +685,8 @@ static const unsigned char *ASN1_STRING_
|
|
return M_ASN1_STRING_data(asn1);
|
|
}
|
|
|
|
-#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined (LIBRESSL_VERSION_NUMBER)
|
|
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined (LIBRESSL_VERSION_NUMBER) && \
|
|
+ LIBRESSL_VERSION_NUMBER < 0x2070000fL)
|
|
|
|
static int X509_get_signature_nid(const X509 *x)
|
|
{
|
|
@@ -1243,7 +1246,8 @@ static void php_openssl_dispose_config(s
|
|
}
|
|
/* }}} */
|
|
|
|
-#if defined(PHP_WIN32) || (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER))
|
|
+#if defined(PHP_WIN32) || (OPENSSL_VERSION_NUMBER >= 0x10100000L && \
|
|
+ !(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL))
|
|
#define PHP_OPENSSL_RAND_ADD_TIME() ((void) 0)
|
|
#else
|
|
#define PHP_OPENSSL_RAND_ADD_TIME() php_openssl_rand_add_timeval()
|
|
@@ -1330,7 +1334,8 @@ static EVP_MD * php_openssl_get_evp_md_f
|
|
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 < 0x2070000fL)
|
|
case OPENSSL_ALGO_DSS1:
|
|
mdtype = (EVP_MD *) EVP_dss1();
|
|
break;
|
|
@@ -1418,7 +1423,8 @@ PHP_MINIT_FUNCTION(openssl)
|
|
le_x509 = zend_register_list_destructors_ex(php_openssl_x509_free, NULL, "OpenSSL X.509", module_number);
|
|
le_csr = zend_register_list_destructors_ex(php_openssl_csr_free, NULL, "OpenSSL X.509 CSR", module_number);
|
|
|
|
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
|
|
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined (LIBRESSL_VERSION_NUMBER) && \
|
|
+ LIBRESSL_VERSION_NUMBER < 0x2070000fL)
|
|
OPENSSL_config(NULL);
|
|
SSL_library_init();
|
|
OpenSSL_add_all_ciphers();
|
|
@@ -1461,7 +1467,8 @@ PHP_MINIT_FUNCTION(openssl)
|
|
#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 < 0x2070000fL)
|
|
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);
|
|
@@ -1599,7 +1606,8 @@ PHP_MINFO_FUNCTION(openssl)
|
|
*/
|
|
PHP_MSHUTDOWN_FUNCTION(openssl)
|
|
{
|
|
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
|
|
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined (LIBRESSL_VERSION_NUMBER) && \
|
|
+ LIBRESSL_VERSION_NUMBER < 0x2070000fL)
|
|
EVP_cleanup();
|
|
|
|
/* prevent accessing locking callback from unloaded extension */
|
|
@@ -3644,7 +3652,8 @@ PHP_FUNCTION(openssl_csr_get_public_key)
|
|
RETURN_FALSE;
|
|
}
|
|
|
|
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
|
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !(defined (LIBRESSL_VERSION_NUMBER) && \
|
|
+ LIBRESSL_VERSION_NUMBER < 0x2070000fL)
|
|
/* 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.
|
|
@@ -3655,7 +3664,8 @@ PHP_FUNCTION(openssl_csr_get_public_key)
|
|
/* 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 < 0x2070000fL)
|
|
/* We need to free the CSR as it was duplicated */
|
|
X509_REQ_free(csr);
|
|
#endif
|