diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-04-23 07:11:09 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-04-24 00:39:25 +0200 |
commit | 15fd0d95f88a57aab618cac0a91c8332c8c07498 (patch) | |
tree | ff9728a4bdd117427490537534644378d1be4604 /src | |
parent | c07c73ced78a8ad9f5aab786072fba04f5aa625c (diff) | |
download | android-node-v8-15fd0d95f88a57aab618cac0a91c8332c8c07498.tar.gz android-node-v8-15fd0d95f88a57aab618cac0a91c8332c8c07498.tar.bz2 android-node-v8-15fd0d95f88a57aab618cac0a91c8332c8c07498.zip |
src: fix node_crypto.cc compiler warnings
Currently the following compiler warnings are issued by clang:
../src/node_crypto.cc:2801:56:
warning: '&&' within '||' [-Wlogical-op-parentheses]
return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16;
~~ ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
../src/node_crypto.cc:2801:56:
note: place parentheses around the '&&' expression to silence this
warning
return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16;
^
../src/node_crypto.cc:2925:51:
warning: '&&' within '||' [-Wlogical-op-parentheses]
if (cipher->auth_tag_len_ != kNoAuthTagLength &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
../src/node_crypto.cc:2925:51:
note: place parentheses around the '&&' expression to silence this
warning
if (cipher->auth_tag_len_ != kNoAuthTagLength &&
^
This commit adds parenthesis around these expressions to silence the
warnings.
PR-URL: https://github.com/nodejs/node/pull/20216
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_crypto.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 9af6263b25..04a5924c09 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2798,7 +2798,7 @@ void CipherBase::InitIv(const FunctionCallbackInfo<Value>& args) { static bool IsValidGCMTagLength(unsigned int tag_len) { - return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16; + return tag_len == 4 || tag_len == 8 || (tag_len >= 12 && tag_len <= 16); } bool CipherBase::InitAuthenticated(const char *cipher_type, int iv_len, @@ -2922,8 +2922,8 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) { unsigned int tag_len = Buffer::Length(args[0]); const int mode = EVP_CIPHER_CTX_mode(cipher->ctx_); if (mode == EVP_CIPH_GCM_MODE) { - if (cipher->auth_tag_len_ != kNoAuthTagLength && - cipher->auth_tag_len_ != tag_len || + if ((cipher->auth_tag_len_ != kNoAuthTagLength && + cipher->auth_tag_len_ != tag_len) || !IsValidGCMTagLength(tag_len)) { char msg[50]; snprintf(msg, sizeof(msg), |