X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmd5.c;h=2f249521cbeab2386b10a5379dda9a3635436eb7;hb=4b4109233097408185555b472eb302c8d3da33b9;hp=5dd43e50043aec6b1dc52170ac6ce8ebed2a1bbd;hpb=d349992d82f97d614404565ff66e3f8a47b4a568;p=gnulib.git diff --git a/lib/md5.c b/lib/md5.c index 5dd43e500..2f249521c 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -1,6 +1,6 @@ /* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2001 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. @@ -36,6 +36,7 @@ #endif #include "md5.h" +#include "unlocked-io.h" #ifdef _LIBC # include @@ -304,19 +305,16 @@ md5_process_block (buffer, len, ctx) { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ - CYCLIC (a, s); \ + a = rol (a, s); \ a += b; \ } \ while (0) - /* It is unfortunate that C does not provide an operator for - cyclic rotation. Hope the C compiler is smart enough. */ -#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) - /* Before we start, one word to the strange constants. They are defined in RFC 1321 as - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 + T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or + perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' */ /* Round 1. */ @@ -345,7 +343,7 @@ md5_process_block (buffer, len, ctx) do \ { \ a += f (b, c, d) + correct_words[k] + T; \ - CYCLIC (a, s); \ + a = rol (a, s); \ a += b; \ } \ while (0)