diff options
Diffstat (limited to 'cipher/sha1.c')
-rw-r--r-- | cipher/sha1.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/cipher/sha1.c b/cipher/sha1.c index 04bdbac98..40ad62f1f 100644 --- a/cipher/sha1.c +++ b/cipher/sha1.c @@ -39,6 +39,7 @@ #include "util.h" #include "memory.h" #include "dynload.h" +#include "bithelp.h" typedef struct { @@ -49,20 +50,6 @@ typedef struct { } SHA1_CONTEXT; -#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 - - void @@ -123,11 +110,11 @@ transform( SHA1_CONTEXT *hd, byte *data ) ^ x[(i-8)&0x0f] ^ x[(i-3)&0x0f] \ , (x[i&0x0f] = (tm << 1) | (tm >> 31)) ) -#define R(a,b,c,d,e,f,k,m) do { e += rol( 5, a ) \ +#define R(a,b,c,d,e,f,k,m) do { e += rol( a, 5 ) \ + f( b, c, d ) \ + k \ + m; \ - b = rol( 30, b ); \ + b = rol( b, 30 ); \ } while(0) R( a, b, c, d, e, F1, K1, x[ 0] ); R( e, a, b, c, d, F1, K1, x[ 1] ); |