From: Anatol Belski Date: Mon, 24 Jul 2017 14:24:04 +0000 (+0200) Subject: Followup on 0ec147d3 for another place X-Git-Tag: php-7.2.0beta2~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7eb2c060409a8f5809d6e73f53d88844cf9ed09;p=php Followup on 0ec147d3 for another place which requires also to move the macros into the header --- diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 148540c80c..19cc0ac100 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -86,14 +86,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 a157969883..d7477966fa 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -128,6 +128,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 5aec089e00..fe7aeda06d 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -1181,7 +1181,7 @@ static int php_openssl_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");