From 5a8972c61ea22209deca1aa920c7801e651af0d8 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 15 Nov 2025 11:44:43 +0100 Subject: [PATCH] fix: clarify operator precedence in key validation Add explicit parentheses to key validation condition to make operator precedence clear. The logic remains unchanged, but the grouping is now explicit and easier to understand during code review. --- blake2/src/macros.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blake2/src/macros.rs b/blake2/src/macros.rs index a5d0af50..6574eb58 100644 --- a/blake2/src/macros.rs +++ b/blake2/src/macros.rs @@ -309,7 +309,8 @@ macro_rules! blake2_mac_impl { let kl = key.map_or(0, |k| k.len()); let bs = <$hash as BlockSizeUser>::BlockSize::USIZE; let qbs = bs / 4; - if key.is_some() && kl == 0 || kl > bs || salt.len() > qbs || persona.len() > qbs { + if (key.is_some() && kl == 0) || kl > bs || salt.len() > qbs || persona.len() > qbs + { return Err(InvalidLength); } let buffer = if let Some(k) = key {