suggested change for cipher/sha1.c's M(i) macro

Jim Meyering meyering at ascend.com
Sun Sep 17 16:32:20 CEST 2000


Hi,

In case you haven't already done so, ...

Please consider using `rol( tm, 1 )' in place of the functionally
equivalent `(tm << 1) | (tm >> 31)'.

Regards,
Jim

Index: cipher/sha1.c
===================================================================
RCS file: /home/koch/cvs/gnupg/cipher/sha1.c,v
retrieving revision 1.14
diff -u -p -r1.14 sha1.c
--- cipher/sha1.c	2000/07/14 17:34:42	1.14
+++ cipher/sha1.c	2000/09/17 13:22:34
@@ -108,7 +108,7 @@ transform( SHA1_CONTEXT *hd, byte *data
 
 #define M(i) ( tm =   x[i&0x0f] ^ x[(i-14)&0x0f] \
 		    ^ x[(i-8)&0x0f] ^ x[(i-3)&0x0f] \
-	       , (x[i&0x0f] = (tm << 1) | (tm >> 31)) )
+	       , (x[i&0x0f] = rol( tm, 1 )) )
 
 #define R(a,b,c,d,e,f,k,m)  do { e += rol( a, 5 )     \
 				      + f( b, c, d )  \



More information about the Gnupg-devel mailing list