aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/sha1.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-02-11 03:25:44 +0000
committerWerner Koch <[email protected]>1998-02-11 03:25:44 +0000
commit4c0c155922b70b62793905490e210e9af4e3b18d (patch)
treea0d8d84a89cfd4579817a993715e750917961c3e /cipher/sha1.c
parentrelease 0.2.3 (diff)
downloadgnupg-4c0c155922b70b62793905490e210e9af4e3b18d.tar.gz
gnupg-4c0c155922b70b62793905490e210e9af4e3b18d.zip
a couple of changes; but some parts are now broken
Diffstat (limited to 'cipher/sha1.c')
-rw-r--r--cipher/sha1.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/cipher/sha1.c b/cipher/sha1.c
index 51029c451..a54ec6a80 100644
--- a/cipher/sha1.c
+++ b/cipher/sha1.c
@@ -99,14 +99,30 @@
#define K3 0x8F1BBCDCL /* Rounds 40-59 */
#define K4 0xCA62C1D6L /* Rounds 60-79 */
-#define ROTL(n,X) ( ( ( X ) << n ) | ( ( X ) >> ( 32 - n ) ) )
+
+#if defined(__GNUC__) && defined(__i386__)
+static inline u32
+rol(int n, u32 x)
+{
+ __asm__("roll %%cl,%0"
+ :"=r" (x)
+ :"0" (x),"c" (n));
+ return x;
+}
+#else
+ #define rol(n,x) ( ((x) << (n)) | ((x) >> (32-(n))) )
+#endif
+
+
+
+
#define expand(W,i) ( W[ i & 15 ] = \
- ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
+ rol( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )
#define subRound(a, b, c, d, e, f, k, data) \
- ( e += ROTL( 5, a ) + f( b, c, d ) + k + data, b = ROTL( 30, b ) )
+ ( e += rol( 5, a ) + f( b, c, d ) + k + data, b = rol( 30, b ) )
void