Binary files php-5.6.40.orig/ext/openssl/.openssl.c.swp and php-5.6.40/ext/openssl/.openssl.c.swp differ
Binary files php-5.6.40.orig/ext/openssl/.xp_ssl.c.swp and php-5.6.40/ext/openssl/.xp_ssl.c.swp differ
diff -puriN php-5.6.40.orig/ext/openssl/openssl.c php-5.6.40/ext/openssl/openssl.c
--- php-5.6.40.orig/ext/openssl/openssl.c	2019-01-09 03:54:13.000000000 -0600
+++ php-5.6.40/ext/openssl/openssl.c	2020-08-02 02:16:33.000000000 -0500
@@ -258,7 +258,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey
 	ZEND_ARG_INFO(0, key)
 ZEND_END_ARG_INFO()
 
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10000000L && !defined (LIBRESSL_VERSION_NUMBER))
 ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4)
 	ZEND_ARG_INFO(0, password)
 	ZEND_ARG_INFO(0, salt)
@@ -485,7 +485,7 @@ const zend_function_entry openssl_functi
 	PHP_FE(openssl_seal,				arginfo_openssl_seal)
 	PHP_FE(openssl_open,				arginfo_openssl_open)
 
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10000000L && !defined (LIBRESSL_VERSION_NUMBER))
 	PHP_FE(openssl_pbkdf2,	arginfo_openssl_pbkdf2)
 #endif
 
@@ -591,7 +591,7 @@ int php_openssl_get_ssl_stream_data_inde
 static char default_ssl_conf_filename[MAXPATHLEN];
 
 struct php_x509_request { /* {{{ */
-#if OPENSSL_VERSION_NUMBER >= 0x10000002L
+#if OPENSSL_VERSION_NUMBER >= 0x10000002L 
 	LHASH_OF(CONF_VALUE) * global_config;	/* Global SSL config */
 	LHASH_OF(CONF_VALUE) * req_config;		/* SSL config for this request */
 #else
@@ -786,7 +786,7 @@ static time_t asn1_time_to_time_t(ASN1_U
 }
 /* }}} */
 
-#if OPENSSL_VERSION_NUMBER >= 0x10000002L
+#if OPENSSL_VERSION_NUMBER >= 0x10000002L 
 static inline int php_openssl_config_check_syntax(const char * section_label, const char * config_filename, const char * section, LHASH_OF(CONF_VALUE) * config TSRMLS_DC) /* {{{ */
 #else
 static inline int php_openssl_config_check_syntax(const char * section_label, const char * config_filename, const char * section, LHASH * config TSRMLS_DC)
@@ -4037,7 +4037,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
 
 /* }}} */
 
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10000000L && !defined (LIBRESSL_VERSION_NUMBER))
 
 /* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"])
    Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */
diff -puriN php-5.6.40.orig/ext/openssl/xp_ssl.c php-5.6.40/ext/openssl/xp_ssl.c
--- php-5.6.40.orig/ext/openssl/xp_ssl.c	2019-01-09 03:54:13.000000000 -0600
+++ php-5.6.40/ext/openssl/xp_ssl.c	2020-08-02 01:20:30.000000000 -0500
@@ -906,7 +906,7 @@ static int set_local_cert(SSL_CTX *ctx,
 				}		
 			}
 
-#if OPENSSL_VERSION_NUMBER < 0x10001001L
+#if OPENSSL_VERSION_NUMBER < 0x10001001L 
 			do {
 				/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
 				X509 *cert = NULL;
@@ -1477,7 +1477,7 @@ int php_openssl_setup_crypto(php_stream
 		}
 	}
 
-#if OPENSSL_VERSION_NUMBER >= 0x10001001L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001001L && !defined (LIBRESSL_VERSION_NUMBER))
 	sslsock->ctx = SSL_CTX_new(method);
 #else
 	/* Avoid const warning with old versions */
@@ -1499,7 +1499,7 @@ int php_openssl_setup_crypto(php_stream
 	ssl_ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
 #endif
 
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10000000L && !defined (LIBRESSL_VERSION_NUMBER))
 	if (!GET_VER_OPT("disable_compression") || zend_is_true(*val)) {
 		ssl_ctx_options |= SSL_OP_NO_COMPRESSION;
 	}
