]> granicus.if.org Git - php/commitdiff
Followup on 0ec147d3 for another place
authorAnatol Belski <ab@php.net>
Mon, 24 Jul 2017 14:24:04 +0000 (16:24 +0200)
committerAnatol Belski <ab@php.net>
Mon, 24 Jul 2017 14:33:12 +0000 (16:33 +0200)
which requires also to move the macros into the header

(cherry picked from commit b7eb2c060409a8f5809d6e73f53d88844cf9ed09)

ext/openssl/openssl.c
ext/openssl/php_openssl.h
ext/openssl/xp_ssl.c

index f500fef6d7fc511906d670f7ddb0525c6c78075e..13e298ec87c69253df11b20ebbf7163815c5e5e6 100644 (file)
 #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
index bab71595120f27b3ab86c32ad63033af507862c5..ba8e6bd6b7e28cdbc34def7e84b873069b492cf5 100644 (file)
@@ -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
index b00bf063043752150bca21f30f440665e8b7cdb4..c6391ca136dd946bf22cd412ff5d411d1ba1fe00 100644 (file)
@@ -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");