diff --git a/configure.in.in b/configure.in.in index 1d757b2..326be9a 100644 --- a/configure.in.in +++ b/configure.in.in @@ -106,7 +106,7 @@ dnl *** Check for standard header files *** dnl *************************************** AC_HEADER_STDC() AC_CHECK_HEADERS([assert.h errno.h fcntl.h fnmatch.h fstab.h libintl.h \ - locale.h math.h md5.h md5global.h mmintrin.h mntent.h \ + locale.h math.h mmintrin.h mntent.h \ paths.h regex.h signal.h stdarg.h string.h sys/mman.h \ sys/mnttab.h sys/mount.h sys/param.h sys/resource.h \ sys/statvfs.h sys/stat.h sys/time.h sys/types.h sys/ucred.h \ @@ -118,12 +118,6 @@ dnl ************************************ AC_FUNC_MMAP() AC_CHECK_FUNCS([getfsstat getmntent getvfsstat regexec setfsent setmntent]) -dnl ****************************************** -dnl *** Check for Message Digest functions *** -dnl ****************************************** -AC_SEARCH_LIBS([MD5Init], [md md5 c], \ - [AC_DEFINE([HAVE_MD5INIT], [1], [Define if MD5Init present])]) - dnl *************************************** dnl *** Check for strftime() extensions *** dnl *************************************** diff --git a/exo/exo-md5.c b/exo/exo-md5.c index 5d93271..b4e1f73 100644 --- a/exo/exo-md5.c +++ b/exo/exo-md5.c @@ -1,5 +1,6 @@ /* $Id$ */ /*- + * Copyright (c) 2008 Jannis Pohlmann * Copyright (c) 2004-2007 os-cillation e.K. * Copyright (c) 2004 James M. Cape * @@ -43,8 +44,6 @@ -#if !defined(HAVE_MD5INIT) || !defined(HAVE_MD5_H) - /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. The original code was @@ -64,6 +63,8 @@ struct _MD5_CTX { guint32 in[16]; }; + + #if G_BYTE_ORDER == G_BIG_ENDIAN static void byteSwap (guint32 *buf, unsigned words) @@ -80,6 +81,8 @@ byteSwap (guint32 *buf, unsigned words) #define byteSwap(buf,words) #endif + + /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. @@ -96,8 +99,12 @@ MD5Init (MD5_CTX *ctx) ctx->bytes[1] = 0; } + + /* The four core functions - F1 is optimized somewhat */ + + /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) @@ -108,6 +115,8 @@ MD5Init (MD5_CTX *ctx) #define MD5STEP(f,w,x,y,z,in,s) \ (w += f(x,y,z) + in, w = (w<>(32-s)) + x) + + /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks @@ -197,6 +206,8 @@ MD5Transform (guint32 buf[4], guint32 const in[16]) buf[3] += d; } + + /* * Update context to reflect the concatenation of another buffer full * of bytes. @@ -237,6 +248,8 @@ MD5Update (MD5_CTX *ctx, md5byte const *buf, unsigned len) memcpy(ctx->in, buf, len); } + + /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) @@ -274,17 +287,6 @@ MD5Final (unsigned char digest[16], MD5_CTX *ctx) memcpy (digest, ctx->buf, 16); } -#else - -/* RedHat AS, Fedora */ -#ifdef HAVE_MD5GLOBAL_H -#include -#endif - -#include - -#endif /* !defined (HAVE_MD5INIT) */ - static void