summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2015-12-26 20:33:03 +0000
committerJakub Zelenka <bukka@php.net>2015-12-26 20:33:03 +0000
commit213844de497086e512da2d2d94b1705abd985c5a (patch)
treedc9b00c8615b4d4b58ef0ec549dd9dfe6717122d
parentfc3575aaf14983b9c7337e027ad73aec753997ef (diff)
downloadphp-git-213844de497086e512da2d2d94b1705abd985c5a.tar.gz
Fix EVP_EncryptFinal and EVP_DecryptFinal
-rw-r--r--ext/openssl/openssl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 56c7e05aa3..5877b9ffaf 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -5418,7 +5418,7 @@ PHP_FUNCTION(openssl_encrypt)
php_openssl_cipher_update(cipher_type, cipher_ctx, &mode, &outbuf, &outlen,
data, data_len, aad, aad_len, 1) == FAILURE) {
RETVAL_FALSE;
- } else if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + i, &i)) {
+ } else if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + outlen, &i)) {
outlen += i;
if (options & OPENSSL_RAW_DATA) {
ZSTR_VAL(outbuf)[outlen] = '\0';
@@ -5521,7 +5521,7 @@ PHP_FUNCTION(openssl_decrypt)
php_openssl_cipher_update(cipher_type, cipher_ctx, &mode, &outbuf, &outlen,
data, data_len, aad, aad_len, 0) == FAILURE) {
RETVAL_FALSE;
- } else if (EVP_DecryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + i, &i)) {
+ } else if (EVP_DecryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + outlen, &i)) {
outlen += i;
ZSTR_VAL(outbuf)[outlen] = '\0';
ZSTR_LEN(outbuf) = outlen;