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
 	cipher->encrypt ( ctx, src, dst, len );
129
 	cipher->encrypt ( ctx, src, dst, len );
130
 }
130
 }
131
 #define cipher_encrypt( cipher, ctx, src, dst, len ) do {		\
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
 	cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) );	\
133
 	cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) );	\
134
 	} while ( 0 )
134
 	} while ( 0 )
135
 
135
 
139
 	cipher->decrypt ( ctx, src, dst, len );
139
 	cipher->decrypt ( ctx, src, dst, len );
140
 }
140
 }
141
 #define cipher_decrypt( cipher, ctx, src, dst, len ) do {		\
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
 	cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) );	\
143
 	cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) );	\
144
 	} while ( 0 )
144
 	} while ( 0 )
145
 
145
 

Loading…
Cancel
Save