]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libiberty/md5.c
Update copyright years.
[thirdparty/gcc.git] / libiberty / md5.c
index 8cc0cb5fe96f43885f1564ba7e285a7315a04e5a..755b8ff9f8d89823d3e606ccef621983a1c28f8a 100644 (file)
@@ -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, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-2020 Free Software Foundation, Inc.
 
    NOTE: This source is derived from an old version taken from the GNU C
    Library (glibc).
@@ -231,7 +231,7 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
   /* Process available complete blocks.  */
   if (len > 64)
     {
-#if !_STRING_ARCH_unaligned
+#if !_STRING_ARCH_unaligned || defined UBSAN_BOOTSTRAP
 /* To check alignment gcc has an appropriate operator.  Other
    compilers don't.  */
 # if __GNUC__ >= 2
@@ -293,8 +293,7 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
      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] += len;
-  if (ctx->total[0] < len)
-    ++ctx->total[1];
+  ctx->total[1] += ((len >> 31) >> 1) + (ctx->total[0] < len);
 
   /* Process all bytes in the buffer with 64 bytes in each round of
      the loop.  */