From: Joshua Oreman Date: Wed, 1 Jul 2009 04:55:10 +0000 (-0700) Subject: [crypto] Add parentheses around len argument in blocksize assert X-Git-Tag: v1.0.0-rc1~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff4d61de962a11517fd9958d0a40fbd8bcbd92ec;p=thirdparty%2Fipxe.git [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 --- diff --git a/src/include/gpxe/crypto.h b/src/include/gpxe/crypto.h index 3831b79c7..751ca05ba 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 )