|
86 | 86 | #define HAVE_EVP_PKEY_EC 1
|
87 | 87 | #endif
|
88 | 88 |
|
| 89 | +#ifdef PHP_WIN32 |
| 90 | +#define PHP_OPENSSL_BIO_MODE_R(flags) (((flags) & PKCS7_BINARY) ? "rb" : "r") |
| 91 | +#define PHP_OPENSSL_BIO_MODE_W(flags) (((flags) & PKCS7_BINARY) ? "wb" : "w") |
| 92 | +#else |
| 93 | +#define PHP_OPENSSL_BIO_MODE_R(flags) "r" |
| 94 | +#define PHP_OPENSSL_BIO_MODE_W(flags) "w" |
| 95 | +#endif |
| 96 | + |
89 | 97 | ZEND_DECLARE_MODULE_GLOBALS(openssl)
|
90 | 98 |
|
91 | 99 | /* FIXME: Use the openssl constants instead of
|
@@ -5008,7 +5016,7 @@ PHP_FUNCTION(openssl_pkcs7_verify)
|
5008 | 5016 | goto clean_exit;
|
5009 | 5017 | }
|
5010 | 5018 |
|
5011 |
| - in = BIO_new_file(filename, (flags & PKCS7_BINARY) ? "rb" : "r"); |
| 5019 | + in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(flags)); |
5012 | 5020 | if (in == NULL) {
|
5013 | 5021 | php_openssl_store_errors();
|
5014 | 5022 | goto clean_exit;
|
@@ -5120,7 +5128,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
|
5120 | 5128 | return;
|
5121 | 5129 | }
|
5122 | 5130 |
|
5123 |
| - infile = BIO_new_file(infilename, (flags & PKCS7_BINARY) ? "rb" : "r"); |
| 5131 | + infile = BIO_new_file(infilename, PHP_OPENSSL_BIO_MODE_R(flags)); |
5124 | 5132 | if (infile == NULL) {
|
5125 | 5133 | php_openssl_store_errors();
|
5126 | 5134 | goto clean_exit;
|
@@ -5278,7 +5286,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
|
5278 | 5286 | goto clean_exit;
|
5279 | 5287 | }
|
5280 | 5288 |
|
5281 |
| - infile = BIO_new_file(infilename, (flags & PKCS7_BINARY) ? "rb" : "r"); |
| 5289 | + infile = BIO_new_file(infilename, PHP_OPENSSL_BIO_MODE_R(flags)); |
5282 | 5290 | if (infile == NULL) {
|
5283 | 5291 | php_openssl_store_errors();
|
5284 | 5292 | php_error_docref(NULL, E_WARNING, "error opening input file %s!", infilename);
|
|
0 commit comments