From ff4d61de962a11517fd9958d0a40fbd8bcbd92ec Mon Sep 17 00:00:00 2001 From: Joshua Oreman Date: Tue, 30 Jun 2009 21:55:10 -0700 Subject: [PATCH] [crypto] Add parentheses around len argument in blocksize assert This fixes an issue where passing a length as a compound expression (e.g. using `hdrlen + datalen') would trigger compiler warnings and potentially precedence-related errors. Signed-off-by: Marty Connor --- src/include/gpxe/crypto.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/gpxe/crypto.h b/src/include/gpxe/crypto.h index 3831b79c..751ca05b 100644 --- a/src/include/gpxe/crypto.h +++ b/src/include/gpxe/crypto.h @@ -129,7 +129,7 @@ static inline void cipher_encrypt ( struct cipher_algorithm *cipher, cipher->encrypt ( ctx, src, dst, len ); } #define cipher_encrypt( cipher, ctx, src, dst, len ) do { \ - assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 ); \ + assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 ); \ cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) ); \ } while ( 0 ) @@ -139,7 +139,7 @@ static inline void cipher_decrypt ( struct cipher_algorithm *cipher, cipher->decrypt ( ctx, src, dst, len ); } #define cipher_decrypt( cipher, ctx, src, dst, len ) do { \ - assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 ); \ + assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 ); \ cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) ); \ } while ( 0 )