X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsha1.c;h=035f898c71f1dae4fab2ed3c48ef125be0e66b5d;hb=882eb279d46373c3de620fd74504c8502f9297a0;hp=0bc29b4e264d6cc6274286b1d83037eef6d36495;hpb=d6471083ad248f2f9b607ae07fd7768f290b1758;p=gnulib.git diff --git a/lib/sha1.c b/lib/sha1.c index 0bc29b4e2..035f898c7 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -23,9 +23,7 @@ Robert Klep -- Expansion function fix */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "sha1.h" @@ -181,7 +179,7 @@ sha1_stream (FILE *stream, void *resblock) return 0; } -/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The +/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ @@ -270,10 +268,10 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) /* --- Code below is the primary difference between md5.c and sha1.c --- */ /* SHA1 round constants */ -#define K1 0x5a827999L -#define K2 0x6ed9eba1L -#define K3 0x8f1bbcdcL -#define K4 0xca62c1d6L +#define K1 0x5a827999 +#define K2 0x6ed9eba1 +#define K3 0x8f1bbcdc +#define K4 0xca62c1d6 /* Round functions. Note that F2 is the same as F4. */ #define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) ) @@ -305,7 +303,7 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) if (ctx->total[0] < len) ++ctx->total[1]; -#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) +#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n)))) #define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \