diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2014-01-01 12:03:04 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2014-01-01 12:03:04 +0100 |
commit | 355c81b998372175d81e6def2231affca743e840 (patch) | |
tree | 2a7a61416193fcdc7caeca8d6c962e1e7a89212c /src | |
parent | f4dfbeaec4bfb5369f1f4bf16c06178107384177 (diff) | |
download | pjctl-355c81b998372175d81e6def2231affca743e840.tar.gz pjctl-355c81b998372175d81e6def2231affca743e840.tar.bz2 pjctl-355c81b998372175d81e6def2231affca743e840.zip |
wip
Diffstat (limited to 'src')
-rw-r--r-- | src/ext/gnulib/md5.c | 19 | ||||
-rw-r--r-- | src/ext/gnulib/md5.h | 7 |
2 files changed, 14 insertions, 12 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. */ diff --git a/src/ext/gnulib/md5.h b/src/ext/gnulib/md5.h index 3786dc5..8b06466 100644 --- a/src/ext/gnulib/md5.h +++ b/src/ext/gnulib/md5.h @@ -1,6 +1,6 @@ /* Declaration of functions and data types used for MD5 sum computing library functions. - Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2013 Free Software + Copyright (C) 1995-1997, 1999-2001, 2004-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. */ #ifndef _MD5_H #define _MD5_H 1 @@ -72,7 +73,7 @@ struct md5_ctx /* * The following three functions are build up the low level used in - * the functions 'md5_stream' and 'md5_buffer'. + * the functions `md5_stream' and `md5_buffer'. */ /* Initialize structure containing state of computation. |