Skip to content

Commit 754ee99

Browse files
committed
src: fix compiler warnings in node_crypto.cc
Add parentheses, like my compiler suggests. In the `IsValidGCMTagLength()` case I’m pretty sure that this grouping is the correct one, because it matches the earlier code; in the other case it would be good to have explicit confirmation. Refs: nodejs#20039
1 parent 63cae79 commit 754ee99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/node_crypto.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,7 +2798,7 @@ void CipherBase::InitIv(const FunctionCallbackInfo<Value>& args) {
27982798

27992799

28002800
static bool IsValidGCMTagLength(unsigned int tag_len) {
2801-
return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16;
2801+
return tag_len == 4 || tag_len == 8 || (tag_len >= 12 && tag_len <= 16);
28022802
}
28032803

28042804
bool CipherBase::InitAuthenticated(const char *cipher_type, int iv_len,
@@ -2922,8 +2922,8 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) {
29222922
unsigned int tag_len = Buffer::Length(args[0]);
29232923
const int mode = EVP_CIPHER_CTX_mode(cipher->ctx_);
29242924
if (mode == EVP_CIPH_GCM_MODE) {
2925-
if (cipher->auth_tag_len_ != kNoAuthTagLength &&
2926-
cipher->auth_tag_len_ != tag_len ||
2925+
if ((cipher->auth_tag_len_ != kNoAuthTagLength &&
2926+
cipher->auth_tag_len_ != tag_len) ||
29272927
!IsValidGCMTagLength(tag_len)) {
29282928
char msg[50];
29292929
snprintf(msg, sizeof(msg),

0 commit comments

Comments
 (0)