com php-src: Try to fix LibreSSL build: ext/openssl/openssl.c ext/openssl/xp_ssl.c
| From: | Jakub Zelenka | Date: | Sun, 23 Oct 2016 18:55:22 +0000 |
| Subject: | com php-src: Try to fix LibreSSL build: ext/openssl/openssl.c ext/openssl/xp_ssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95265@lists.php.net to get a copy of this message | ||
Commit: 820bca8ca3e6520d13171cca141e02d5f2b9d27e
Author: Jakub Zelenka <bukka@php.net> Sun, 23 Oct 2016 19:55:22 +0100
Parents: 930ae4034e9e6f66180c3a017e323d934f09e367
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=820bca8ca3e6520d13171cca141e02d5f2b9d27e
Log:
Try to fix LibreSSL build
Changed paths:
M ext/openssl/openssl.c
M ext/openssl/xp_ssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 075be20..ab58f47 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -73,7 +73,7 @@
#ifdef HAVE_OPENSSL_MD2_H
#define OPENSSL_ALGO_MD2 4
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
#define OPENSSL_ALGO_DSS1 5
#endif
#define OPENSSL_ALGO_SHA224 6
@@ -557,7 +557,7 @@ ZEND_GET_MODULE(openssl)
#endif
/* {{{ OpenSSL compatibility functions and macros */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
#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
@@ -1296,7 +1296,7 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(zend_long algo) { /* {{{ */
mdtype = (EVP_MD *) EVP_md2();
break;
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
case OPENSSL_ALGO_DSS1:
mdtype = (EVP_MD *) EVP_dss1();
break;
@@ -1422,7 +1422,7 @@ 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
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
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);
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index a7a622f..9a53a6e 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -91,7 +91,7 @@
/* Used for peer verification in windows */
#define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out) ASN1_STRING_to_UTF8(&out,
X509_NAME_ENTRY_get_data(X509_NAME_get_entry(ne, i)))
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength);
#endif
@@ -1123,7 +1123,7 @@ static void init_server_reneg_limit(php_stream *stream,
php_openssl_netstream_da
}
/* }}} */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
{
BIGNUM *bn = NULL;
@@ -1192,7 +1192,7 @@ static int set_server_dh_param(php_stream * stream, SSL_CTX *ctx) /* {{{ */
}
/* }}} */
-#if defined(HAVE_ECDH) && OPENSSL_VERSION_NUMBER < 0x10100000L
+#if defined(HAVE_ECDH) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined
(LIBRESSL_VERSION_NUMBER))
static int set_server_ecdh_curve(php_stream *stream, SSL_CTX *ctx) /* {{{ */
{
zval *zvcurve;
@@ -1235,13 +1235,13 @@ static int set_server_specific_opts(php_stream *stream, SSL_CTX *ctx) /* {{{
*/
zval *zv;
long ssl_ctx_options = SSL_CTX_get_options(ctx);
-#if defined(HAVE_ECDH) && OPENSSL_VERSION_NUMBER < 0x10100000L
+#if defined(HAVE_ECDH) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined
(LIBRESSL_VERSION_NUMBER))
if (set_server_ecdh_curve(stream, ctx) == FAILURE) {
return FAILURE;
}
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
SSL_CTX_set_tmp_rsa_callback(ctx, tmp_rsa_cb);
#endif
/* We now use tmp_rsa_cb to generate a key of appropriate size whenever necessary */