Keep RC5 bit shifts in [0..31]
authorViktor Dukhovni <openssl-users@dukhovni.org>
Fri, 29 Jan 2016 00:04:49 +0000 (19:04 -0500)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Fri, 29 Jan 2016 02:39:46 +0000 (21:39 -0500)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/rc5/rc5_locl.h

index 9944440..6b34f92 100644 (file)
 # endif
 #endif
 #ifndef ROTATE_l32
-# define ROTATE_l32(a,n)     (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f))))
+# define ROTATE_l32(a,n)     (((a)<<(n&0x1f))|(((a)&0xffffffff)>>((32-n)&0x1f)))
 #endif
 #ifndef ROTATE_r32
-# define ROTATE_r32(a,n)     (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f)))
+# define ROTATE_r32(a,n)     (((a)<<((32-n)&0x1f))|(((a)&0xffffffff)>>(n&0x1f)))
 #endif
 
 #define RC5_32_MASK     0xffffffffL