com php-src: Merge branch 'PHP-7.0' into PHP-7.1: Zend/zend_a lloc.c Zend/zend_multiply.h ext/openssl/openssl.c ext/pcre/php_pcre.c
ext/spl/spl_iterators.c
| From: | Stanislav Malyshev | Date: | Thu, 13 Oct 2016 06:26:15 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.0' into PHP-7.1: Zend/zend_a lloc.c Zend/zend_multiply.h ext/openssl/openssl.c ext/pcre/php_pcre.c ext/spl/spl_iterators.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95006@lists.php.net to get a copy of this message | ||
Commit: ff75665663045a96d6f182e24283e6bebb8537fa
Author: Stanislav Malyshev <stas@php.net> Wed, 12 Oct 2016 23:26:15 -0700
Parents: 47e21eb5177dae5a02fa397a79bd4bf0b778cd6e cd8c9b06149dc7dc0415524f1d74880fd6f2d25c
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ff75665663045a96d6f182e24283e6bebb8537fa
Log:
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
Fix outlen for openssl function
Syncronize with 5.6 - __toString should return ""
Fix potential overflows in php_pcre_replace_impl
Changed paths:
MM Zend/zend_alloc.c
MM Zend/zend_multiply.h
MM ext/openssl/openssl.c
MM ext/pcre/php_pcre.c
MM ext/spl/spl_iterators.c
Diff:
diff --cc ext/openssl/openssl.c
index dc16499,6bf1d6b..58053d2
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@@ -6336,18 -5383,18 +6336,18 @@@ PHP_FUNCTION(openssl_encrypt
PHP_FUNCTION(openssl_decrypt)
{
zend_long options = 0;
- char *data, *method, *password, *iv = "";
- size_t data_len, method_len, password_len, iv_len = 0;
+ char *data, *method, *password, *iv = "", *tag = NULL, *aad = "";
+ size_t data_len, method_len, password_len, iv_len = 0, tag_len = 0, aad_len = 0;
const EVP_CIPHER *cipher_type;
- EVP_CIPHER_CTX cipher_ctx;
- int i, keylen;
- size_t outlen;
+ EVP_CIPHER_CTX *cipher_ctx;
+ struct php_openssl_cipher_mode mode;
- int outlen, i = 0;
++ int i = 0, outlen;
zend_string *outbuf;
- unsigned char *key;
zend_string *base64_str = NULL;
- zend_bool free_iv;
+ zend_bool free_iv = 0, free_password = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|ls", &data, &data_len,
&method, &method_len, &password, &password_len, &options, &iv, &iv_len)
== FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lsss", &data, &data_len,
&method, &method_len,
+ &password, &password_len, &options, &iv, &iv_len, &tag, &tag_len,
&aad, &aad_len) == FAILURE) {
return;
}
@@@ -6367,19 -5411,10 +6367,19 @@@
RETURN_FALSE;
}
+ cipher_ctx = EVP_CIPHER_CTX_new();
+ if (!cipher_ctx) {
+ php_error_docref(NULL, E_WARNING, "Failed to create cipher context");
+ RETURN_FALSE;
+ }
+
+ php_openssl_load_cipher_mode(&mode, cipher_type);
+
if (!(options & OPENSSL_RAW_DATA)) {
- base64_str = php_base64_decode_ex((unsigned char*)data, (int)data_len, 1);
+ base64_str = php_base64_decode((unsigned char*)data, data_len);
if (!base64_str) {
php_error_docref(NULL, E_WARNING, "Failed to base64 decode the input");
+ EVP_CIPHER_CTX_free(cipher_ctx);
RETURN_FALSE;
}
data_len = ZSTR_LEN(base64_str);