com php-src: Followup on 0ec147d3 for another place: ext/openssl/openssl.c ext/openssl/php_openssl.h ext/openssl/xp_ssl.c
| From: | Anatol Belski | Date: | Mon, 24 Jul 2017 14:33:12 +0000 |
| Subject: | com php-src: Followup on 0ec147d3 for another place: ext/openssl/openssl.c ext/openssl/php_openssl.h ext/openssl/xp_ssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98770@lists.php.net to get a copy of this message | ||
Commit: e2b61eccb9ffda6d43d14962b5eaa19c2da3de87
Author: Anatol Belski <ab@php.net> Mon, 24 Jul 2017 16:24:04 +0200
Parents: 6918a68d9d64c5c55a29305d892341d5fff9bcde
Branches: PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e2b61eccb9ffda6d43d14962b5eaa19c2da3de87
Log:
Followup on 0ec147d3 for another place
which requires also to move the macros into the header
(cherry picked from commit b7eb2c060409a8f5809d6e73f53d88844cf9ed09)
Changed paths:
M ext/openssl/openssl.c
M ext/openssl/php_openssl.h
M ext/openssl/xp_ssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index f500fef..13e298e 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -87,14 +87,6 @@
#define HAVE_EVP_PKEY_EC 1
#endif
-#ifdef PHP_WIN32
-#define PHP_OPENSSL_BIO_MODE_R(flags) (((flags) & PKCS7_BINARY) ? "rb" :
"r")
-#define PHP_OPENSSL_BIO_MODE_W(flags) (((flags) & PKCS7_BINARY) ? "wb" :
"w")
-#else
-#define PHP_OPENSSL_BIO_MODE_R(flags) "r"
-#define PHP_OPENSSL_BIO_MODE_W(flags) "w"
-#endif
-
ZEND_DECLARE_MODULE_GLOBALS(openssl)
/* FIXME: Use the openssl constants instead of
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index bab7159..ba8e6bd 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.h
@@ -127,6 +127,15 @@ PHP_FUNCTION(openssl_spki_export);
PHP_FUNCTION(openssl_spki_export_challenge);
PHP_FUNCTION(openssl_get_cert_locations);
+
+#ifdef PHP_WIN32
+#define PHP_OPENSSL_BIO_MODE_R(flags) (((flags) & PKCS7_BINARY) ? "rb" :
"r")
+#define PHP_OPENSSL_BIO_MODE_W(flags) (((flags) & PKCS7_BINARY) ? "wb" :
"w")
+#else
+#define PHP_OPENSSL_BIO_MODE_R(flags) "r"
+#define PHP_OPENSSL_BIO_MODE_W(flags) "w"
+#endif
+
#else
#define phpext_openssl_ptr NULL
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index b00bf06..c6391ca 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -1170,7 +1170,7 @@ static int set_server_dh_param(php_stream * stream, SSL_CTX *ctx) /* {{{ */
}
convert_to_string_ex(zdhpath);
- bio = BIO_new_file(Z_STRVAL_P(zdhpath), "r");
+ bio = BIO_new_file(Z_STRVAL_P(zdhpath), PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
if (bio == NULL) {
php_error_docref(NULL, E_WARNING, "invalid dh_param");