]> 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:24:04 +0000 (16:24 +0200)
which requires also to move the macros into the header

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

index 148540c80c6f603bfc9dc174722adb51ec3c7bb0..19cc0ac100cfd16038fbd35d4313386e9041bb87 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 a157969883b776fc06611e2f76ff77982ce373d8..d7477966fae1d6fc87a7e653e494dce067089b21 100644 (file)
@@ -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
index 5aec089e00c85ce51b8a6137564cd3c8937fe4fc..fe7aeda06d67a88df1fde565cc2fbdd2022f2040 100644 (file)
@@ -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");