diff options
Diffstat (limited to 'src/ext/gnulib/md5.c')
-rw-r--r-- | src/ext/gnulib/md5.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ext/gnulib/md5.c b/src/ext/gnulib/md5.c index c41538c..d37ca72 100644 --- a/src/ext/gnulib/md5.c +++ b/src/ext/gnulib/md5.c @@ -1,6 +1,6 @@ /* 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-1997, 1999-2001, 2005-2006, 2008-2013 Free Software + Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -15,7 +15,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ @@ -23,8 +24,7 @@ #include "md5.h" -#include <stdalign.h> -#include <stdint.h> +#include <stddef.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> @@ -83,7 +83,7 @@ md5_init_ctx (struct md5_ctx *ctx) /* Copy the 4 byte value from v into the memory location pointed to by *cp, If your architecture allows unaligned access this is equivalent to * (uint32_t *) cp = v */ -static void +static inline void set_uint32 (char *cp, uint32_t v) { memcpy (cp, &v, sizeof v); @@ -254,7 +254,8 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) if (len >= 64) { #if !_STRING_ARCH_unaligned -# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0) +# define alignof(type) offsetof (struct { char c; type x; }, x) +# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) if (UNALIGNED_P (buffer)) while (len > 64) { @@ -312,13 +313,13 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) uint32_t B = ctx->B; uint32_t C = ctx->C; uint32_t D = ctx->D; - uint32_t lolen = len; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ - ctx->total[0] += lolen; - ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen); + ctx->total[0] += len; + if (ctx->total[0] < len) + ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ |