Browse Source

[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 <mdc@etherboot.org>
tags/v1.0.0-rc1
Joshua Oreman 15 years ago
parent
commit
ff4d61de96
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/include/gpxe/crypto.h

+ 2
- 2
src/include/gpxe/crypto.h View File

@@ -129,7 +129,7 @@ static inline void cipher_encrypt ( struct cipher_algorithm *cipher,
129 129
 	cipher->encrypt ( ctx, src, dst, len );
130 130
 }
131 131
 #define cipher_encrypt( cipher, ctx, src, dst, len ) do {		\
132
-	assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 );		\
132
+	assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 );	\
133 133
 	cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) );	\
134 134
 	} while ( 0 )
135 135
 
@@ -139,7 +139,7 @@ static inline void cipher_decrypt ( struct cipher_algorithm *cipher,
139 139
 	cipher->decrypt ( ctx, src, dst, len );
140 140
 }
141 141
 #define cipher_decrypt( cipher, ctx, src, dst, len ) do {		\
142
-	assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 );		\
142
+	assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 );	\
143 143
 	cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) );	\
144 144
 	} while ( 0 )
145 145
 

Loading…
Cancel
Save