david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[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>
This commit is contained in:
Joshua Oreman 2009-06-30 21:55:10 -07:00 committed by Marty Connor
parent 59b7d00c06
commit ff4d61de96
1 changed files with 2 additions and 2 deletions

View File

@ -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 )