com php-src: Simplify AAD condition: ext/openssl/openssl.c
| From: | Jakub Zelenka | Date: | Mon, 07 Dec 2015 19:19:44 +0000 |
| Subject: | com php-src: Simplify AAD condition: ext/openssl/openssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92485@lists.php.net to get a copy of this message | ||
Commit: c54174255d8b5149821c94bd29eb90267197d763
Author: Jakub Zelenka <bukka@php.net> Mon, 7 Dec 2015 19:19:44 +0000
Parents: da0c2a4b6b514afe412f1318c0d496d92f43443c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c54174255d8b5149821c94bd29eb90267197d763
Log:
Simplify AAD condition
Changed paths:
M ext/openssl/openssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 7d6c1e0..63bc668 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -5346,16 +5346,9 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
zend_string **poutbuf, int *poutlen, char *data, size_t data_len,
char *aad, size_t aad_len, int enc) /* {{{ */
{
- int ret, i = 0;
+ int i = 0;
- if (aad) {
- ret = EVP_CipherUpdate(cipher_ctx, NULL, &i, (unsigned char *)aad, (int)aad_len);
- } else {
- unsigned char buf[4];
- ret = EVP_CipherUpdate(cipher_ctx, NULL, &i, buf, 0);
- }
-
- if (!ret) {
+ if (mode->is_aead && !EVP_CipherUpdate(cipher_ctx, NULL, &i, (unsigned char *)aad,
(int)aad_len)) {
php_error_docref(NULL, E_WARNING, "Setting of additional application data failed");
return FAILURE;
}