]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
More fixes for recent MD5 mixups
authorwessels <>
Thu, 15 Nov 2007 23:47:31 +0000 (23:47 +0000)
committerwessels <>
Thu, 15 Nov 2007 23:47:31 +0000 (23:47 +0000)
- Changing 'xMD5' function name to 'SquidMD5'
- Changing 'MD5_CTX' typedef to 'SquidMD5_CTX'
- Changing 'MD5_DIGEST_CHARS' define to 'SQUID_MD5_DIGEST_LENGTH'
- Changing 'MD5_DIGEST_LENGTH' define to 'SQUID_MD5_DIGEST_LENGTH'
- Removing messy #ifdef logic in include/md5.h that tries to use
  the system libraries if available.  We'll always use the Squid MD5
  routines.

20 files changed:
helpers/basic_auth/NCSA/crypt_md5.c
include/md5.h
lib/md5.c
lib/rfc2617.c
src/CacheDigest.cc
src/MemObject.cc
src/StoreMetaMD5.cc
src/StoreSwapLogData.h
src/cache_diff.cc
src/fs/coss/store_dir_coss.cc
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/ufscommon.cc
src/htcp.cc
src/icp_v2.cc
src/mem.cc
src/store_key_md5.cc
src/store_swapmeta.cc
src/test_cache_digest.cc
src/ufsdump.cc
src/wccp2.cc

index e956000b94be138b514e2367169f5034e4d65872..d342fcedc40bca0c978123e0f25f996ae64e6e92 100644 (file)
@@ -51,7 +51,7 @@ char *crypt_md5(const char *pw, const char *salt)
     static const char *sp, *ep;
     unsigned char final[16];
     int sl, pl, i, j;
-    MD5_CTX ctx, ctx1;
+    SquidMD5_CTX ctx, ctx1;
     unsigned long l;
 
     if (*salt == '$') {
@@ -77,25 +77,25 @@ char *crypt_md5(const char *pw, const char *salt)
     /* get the length of the true salt */
     sl = ep - sp;
 
-    xMD5Init(&ctx);
+    SquidMD5Init(&ctx);
 
     /* The password first, since that is what is most unknown */
-    xMD5Update(&ctx, (unsigned const char *) pw, strlen(pw));
+    SquidMD5Update(&ctx, (unsigned const char *) pw, strlen(pw));
 
     /* Then our magic string */
-    xMD5Update(&ctx, (unsigned const char *) magic, magiclen);
+    SquidMD5Update(&ctx, (unsigned const char *) magic, magiclen);
 
     /* Then the raw salt */
-    xMD5Update(&ctx, (unsigned const char *) sp, sl);
+    SquidMD5Update(&ctx, (unsigned const char *) sp, sl);
 
     /* Then just as many characters of the MD5(pw,salt,pw) */
-    xMD5Init(&ctx1);
-    xMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
-    xMD5Update(&ctx1, (unsigned const char *) sp, sl);
-    xMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
-    xMD5Final(final, &ctx1);
+    SquidMD5Init(&ctx1);
+    SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
+    SquidMD5Update(&ctx1, (unsigned const char *) sp, sl);
+    SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
+    SquidMD5Final(final, &ctx1);
     for (pl = strlen(pw); pl > 0; pl -= 16)
-       xMD5Update(&ctx, (unsigned const char *) final, pl > 16 ? 16 : pl);
+       SquidMD5Update(&ctx, (unsigned const char *) final, pl > 16 ? 16 : pl);
 
     /* Don't leave anything around in vm they could use. */
     memset(final, 0, sizeof final);
@@ -103,9 +103,9 @@ char *crypt_md5(const char *pw, const char *salt)
     /* Then something really weird... */
     for (j = 0, i = strlen(pw); i; i >>= 1)
        if (i & 1)
-           xMD5Update(&ctx, (unsigned const char *) final + j, 1);
+           SquidMD5Update(&ctx, (unsigned const char *) final + j, 1);
        else
-           xMD5Update(&ctx, (unsigned const char *) pw + j, 1);
+           SquidMD5Update(&ctx, (unsigned const char *) pw + j, 1);
 
     /* Now make the output string */
     memset(passwd, 0, sizeof(passwd));
@@ -113,7 +113,7 @@ char *crypt_md5(const char *pw, const char *salt)
     strncat(passwd, sp, sl);
     strcat(passwd, "$");
 
-    xMD5Final(final, &ctx);
+    SquidMD5Final(final, &ctx);
 
     /*
      * and now, just to make sure things don't run too fast
@@ -121,23 +121,23 @@ char *crypt_md5(const char *pw, const char *salt)
      * need 30 seconds to build a 1000 entry dictionary...
      */
     for (i = 0; i < 1000; i++) {
-       xMD5Init(&ctx1);
+       SquidMD5Init(&ctx1);
        if (i & 1)
-           xMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
+           SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
        else
-           xMD5Update(&ctx1, (unsigned const char *) final, 16);
+           SquidMD5Update(&ctx1, (unsigned const char *) final, 16);
 
        if (i % 3)
-           xMD5Update(&ctx1, (unsigned const char *) sp, sl);
+           SquidMD5Update(&ctx1, (unsigned const char *) sp, sl);
 
        if (i % 7)
-           xMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
+           SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
 
        if (i & 1)
-           xMD5Update(&ctx1, (unsigned const char *) final, 16);
+           SquidMD5Update(&ctx1, (unsigned const char *) final, 16);
        else
-           xMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
-       xMD5Final(final, &ctx1);
+           SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
+       SquidMD5Final(final, &ctx1);
     }
 
     p = passwd + strlen(passwd);
@@ -173,15 +173,15 @@ char *crypt_md5(const char *pw, const char *salt)
 */
 char *md5sum(const char *s){
    static unsigned char digest[16];
-   MD5_CTX ctx;
+   SquidMD5_CTX ctx;
    int idx;
    static char sum[33];
 
    memset(digest,0,16);
 
-   xMD5Init(&ctx);
-   xMD5Update(&ctx,(const unsigned char *)s,strlen(s));
-   xMD5Final(digest,&ctx);
+   SquidMD5Init(&ctx);
+   SquidMD5Update(&ctx,(const unsigned char *)s,strlen(s));
+   SquidMD5Final(digest,&ctx);
 
    for(idx=0;idx<16;idx++)
        sprintf(&sum[idx*2],"%02x",digest[idx]);
index be35d1f653e00acb87d26d10848357b32b4f8e6e..8b49396151642c17bfa78f5fdc7bc78faac33c71 100644 (file)
@@ -1,55 +1,6 @@
 #ifndef SQUID_MD5_H
 #define SQUID_MD5_H
 
-#if USE_OPENSSL && HAVE_OPENSSL_MD5_H
-
-/*
- * If Squid is compiled with OpenSSL then we use the MD5 routines
- * from there via some wrapper macros, and the rest of this file is ignored..
- */
-#include <openssl/md5.h>
-
-#define xMD5Init MD5_Init
-#define xMD5Update MD5_Update
-#define xMD5Final MD5_Final
-
-#elif USE_OPENSSL && !HAVE_OPENSSL_MD5_H
-#error Cannot find OpenSSL MD5 headers
-
-#elif HAVE_SYS_MD5_H
-/*
- * Solaris 10 provides MD5 as part of the system.
- * So do other OS - but without MD5_DIGEST_LENGTH defined
- * for them we need to still use the bunded version
- */
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#include <sys/md5.h>
-
-#endif
-
-/* according to CacheDigest.cc squid REQUIRES 16-byte here for hash keys */
-#if MD5_DIGEST_LENGTH == 16
-
-  /* We found a nice usable version. No need for ours */
-#define USE_SQUID_MD5 0
-
-  /* adopt the supplied version we are able to use. */
-#define xMD5Init MD5Init
-#define xMD5Update MD5Update
-#define xMD5Final MD5Final
-#define MD5_DIGEST_CHARS MD5_DIGEST_LENGTH
-
-#else /* NEED squid bundled version */
-
-  /* Turn on internal MD5 code */
-#define USE_SQUID_MD5 1
-
-  /* remove MD5_CTX which may have been defined. */
-#undef MD5_CTX
-
 /*
  * This is the header file for the MD5 message-digest algorithm.
  * The algorithm is due to Ron Rivest.  This code was
 
 #include "squid_types.h"
 
-typedef struct MD5Context {
+typedef struct SquidMD5Context {
     uint32_t buf[4];
     uint32_t bytes[2];
     uint32_t in[16];
-} MD5_CTX;
-
-SQUIDCEXTERN void xMD5Init(struct MD5Context *context);
-SQUIDCEXTERN void xMD5Update(struct MD5Context *context, const void *buf, unsigned len);
-SQUIDCEXTERN void xMD5Final(uint8_t digest[16], struct MD5Context *context);
-SQUIDCEXTERN void xMD5Transform(uint32_t buf[4], uint32_t const in[16]);
+} SquidMD5_CTX;
 
-#endif /* MD5_DIGEST_CHARS != 16 */
+SQUIDCEXTERN void SquidMD5Init(struct SquidMD5Context *context);
+SQUIDCEXTERN void SquidMD5Update(struct SquidMD5Context *context, const void *buf, unsigned len);
+SQUIDCEXTERN void SquidMD5Final(uint8_t digest[16], struct SquidMD5Context *context);
+SQUIDCEXTERN void SquidMD5Transform(uint32_t buf[4], uint32_t const in[16]);
 
+#define SQUID_MD5_DIGEST_LENGTH         16
 
 #endif /* SQUID_MD5_H */
index 257dc436bc18fe62bb2b630c72afa818df7befe7..955c7aeefecb6e10f9cf44011eab2b9dd9fd32f5 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
  * with every copy.
  *
  * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5Init, call MD5Update as
- * needed on buffers full of bytes, and then call MD5Final, which
- * will fill a supplied 16-byte array with the digest.
+ * SquidMD5Context structure, pass it to SquidMD5Init, call
+ * SquidMD5Update as needed on buffers full of bytes, and then call
+ * SquidMD5Final, which will fill a supplied 16-byte array with the
+ * digest.
  *
  * Changed so as no longer to depend on Colin Plumb's `usual.h' header
  * definitions; now uses stuff from dpkg's config.h.
  *  - Ian Jackson <ian@chiark.greenend.org.uk>.
  * Still in the public domain.
  *
- * Changed MD5Update to take a void * for easier use and some other
- * minor cleanup. - Henrik Nordstrom <henrik@henriknordstrom.net>.
+ * Changed SquidMD5Update to take a void * for easier use and some
+ * other minor cleanup. - Henrik Nordstrom <henrik@henriknordstrom.net>.
+ * Still in the public domain.
+ *
+ * Prefixed all symbols with "Squid" so they don't collide with
+ * other libraries.  Duane Wessels <wessels@squid-cache.org>.
  * Still in the public domain.
  *
  */
 
 #include "md5.h"
 
-/*
- * Now that we have several alternatives the MD5 files are
- * passed in by default. But a header-selection decides whether
- * this provided version is to be built.
- * TODO: may obsolete the MSV #if below.
- */
-#if USE_SQUID_MD5
-
-/* MS VisualStudio Projects are monolithic, so we need USE_SSL
- * #if to exclude the MD5 code from compile process when we are
- * building the SSL support.
- */
-#if !USE_SSL
-
 #if HAVE_STRING_H
 #include <string.h>            /* for memcpy() */
 #endif
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>         /* for stupid systems */
 #endif
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>                /* for ntohl() */
-#endif
 
 #ifdef WORDS_BIGENDIAN
-void byteSwap(uint32_t *, unsigned);
-
 void
-byteSwap(uint32_t * buf, unsigned words)
+static byteSwap(uint32_t * buf, unsigned words)
 {
     uint8_t *p = (uint8_t *) buf;
 
@@ -75,7 +61,7 @@ byteSwap(uint32_t * buf, unsigned words)
  * initialization constants.
  */
 void
-xMD5Init(struct MD5Context *ctx)
+SquidMD5Init(struct SquidMD5Context *ctx)
 {
     ctx->buf[0] = 0x67452301;
     ctx->buf[1] = 0xefcdab89;
@@ -91,7 +77,7 @@ xMD5Init(struct MD5Context *ctx)
  * of bytes.
  */
 void
-xMD5Update(struct MD5Context *ctx, const void *_buf, unsigned len)
+SquidMD5Update(struct SquidMD5Context *ctx, const void *_buf, unsigned len)
 {
     uint8_t const *buf = _buf;
     uint32_t t;
@@ -110,7 +96,7 @@ xMD5Update(struct MD5Context *ctx, const void *_buf, unsigned len)
     /* First chunk is an odd size */
     memcpy((uint8_t *) ctx->in + 64 - t, buf, t);
     byteSwap(ctx->in, 16);
-    MD5Transform(ctx->buf, ctx->in);
+    SquidMD5Transform(ctx->buf, ctx->in);
     buf += t;
     len -= t;
 
@@ -118,7 +104,7 @@ xMD5Update(struct MD5Context *ctx, const void *_buf, unsigned len)
     while (len >= 64) {
        memcpy(ctx->in, buf, 64);
        byteSwap(ctx->in, 16);
-       MD5Transform(ctx->buf, ctx->in);
+       SquidMD5Transform(ctx->buf, ctx->in);
        buf += 64;
        len -= 64;
     }
@@ -132,7 +118,7 @@ xMD5Update(struct MD5Context *ctx, const void *_buf, unsigned len)
  * 1 0* (64-bit count of bits processed, MSB-first)
  */
 void
-xMD5Final(unsigned char digest[16], struct MD5Context *ctx)
+SquidMD5Final(unsigned char digest[16], struct SquidMD5Context *ctx)
 {
     int count = ctx->bytes[0] & 0x3f;  /* Number of bytes in ctx->in */
     uint8_t *p = (uint8_t *) ctx->in + count;
@@ -146,7 +132,7 @@ xMD5Final(unsigned char digest[16], struct MD5Context *ctx)
     if (count < 0) {           /* Padding forces an extra block */
        memset(p, 0, count + 8);
        byteSwap(ctx->in, 16);
-       MD5Transform(ctx->buf, ctx->in);
+       SquidMD5Transform(ctx->buf, ctx->in);
        p = (uint8_t *) ctx->in;
        count = 56;
     }
@@ -156,7 +142,7 @@ xMD5Final(unsigned char digest[16], struct MD5Context *ctx)
     /* Append length in bits and transform */
     ctx->in[14] = ctx->bytes[0] << 3;
     ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
-    MD5Transform(ctx->buf, ctx->in);
+    SquidMD5Transform(ctx->buf, ctx->in);
 
     byteSwap(ctx->buf, 4);
     memcpy(digest, ctx->buf, 16);
@@ -179,11 +165,11 @@ xMD5Final(unsigned char digest[16], struct MD5Context *ctx)
 
 /*
  * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data.  MD5Update blocks
+ * reflect the addition of 16 longwords of new data.  SquidMD5Update blocks
  * the data and converts bytes into longwords for this routine.
  */
 void
-xMD5Transform(uint32_t buf[4], uint32_t const in[16])
+SquidMD5Transform(uint32_t buf[4], uint32_t const in[16])
 {
     register uint32_t a, b, c, d;
 
@@ -267,5 +253,3 @@ xMD5Transform(uint32_t buf[4], uint32_t const in[16])
 }
 
 #endif /* !ASM_MD5 */
-#endif /* !USE_SSL */
-#endif /* !USE_SQUID_MD5 */
index 8986817f053f204b42d5b3dcedf0a5790ea57ccf..024787953210ffadc148617b3d6441a1f9330705 100644 (file)
@@ -13,7 +13,7 @@
 
 
 /*
- * $Id: rfc2617.c,v 1.11 2007/11/15 09:18:05 amosjeffries Exp $
+ * $Id: rfc2617.c,v 1.12 2007/11/15 16:47:34 wessels Exp $
  *
  * DEBUG:
  * AUTHOR: RFC 2617 & Robert Collins
@@ -113,27 +113,27 @@ DigestCalcHA1(
     HASHHEX SessionKey
 )
 {
-    MD5_CTX Md5Ctx;
+    SquidMD5_CTX Md5Ctx;
 
     if (pszUserName) {
-       xMD5Init(&Md5Ctx);
-       xMD5Update(&Md5Ctx, pszUserName, strlen(pszUserName));
-       xMD5Update(&Md5Ctx, ":", 1);
-       xMD5Update(&Md5Ctx, pszRealm, strlen(pszRealm));
-       xMD5Update(&Md5Ctx, ":", 1);
-       xMD5Update(&Md5Ctx, pszPassword, strlen(pszPassword));
-       xMD5Final((unsigned char *) HA1, &Md5Ctx);
+       SquidMD5Init(&Md5Ctx);
+       SquidMD5Update(&Md5Ctx, pszUserName, strlen(pszUserName));
+       SquidMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, pszRealm, strlen(pszRealm));
+       SquidMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, pszPassword, strlen(pszPassword));
+       SquidMD5Final((unsigned char *) HA1, &Md5Ctx);
     }
     if (strcasecmp(pszAlg, "md5-sess") == 0) {
        HASHHEX HA1Hex;
        CvtHex(HA1, HA1Hex);    /* RFC2617 errata */
-       xMD5Init(&Md5Ctx);
-       xMD5Update(&Md5Ctx, HA1Hex, HASHHEXLEN);
-       xMD5Update(&Md5Ctx, ":", 1);
-       xMD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
-       xMD5Update(&Md5Ctx, ":", 1);
-       xMD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
-       xMD5Final((unsigned char *) HA1, &Md5Ctx);
+       SquidMD5Init(&Md5Ctx);
+       SquidMD5Update(&Md5Ctx, HA1Hex, HASHHEXLEN);
+       SquidMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
+       SquidMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
+       SquidMD5Final((unsigned char *) HA1, &Md5Ctx);
     }
     CvtHex(HA1, SessionKey);
 }
@@ -152,40 +152,40 @@ DigestCalcResponse(
     HASHHEX Response           /* request-digest or response-digest */
 )
 {
-    MD5_CTX Md5Ctx;
+    SquidMD5_CTX Md5Ctx;
     HASH HA2;
     HASH RespHash;
     HASHHEX HA2Hex;
 
     /*  calculate H(A2)
      */
-    xMD5Init(&Md5Ctx);
-    xMD5Update(&Md5Ctx, pszMethod, strlen(pszMethod));
-    xMD5Update(&Md5Ctx, ":", 1);
-    xMD5Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));
+    SquidMD5Init(&Md5Ctx);
+    SquidMD5Update(&Md5Ctx, pszMethod, strlen(pszMethod));
+    SquidMD5Update(&Md5Ctx, ":", 1);
+    SquidMD5Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));
     if (strcasecmp(pszQop, "auth-int") == 0) {
-       xMD5Update(&Md5Ctx, ":", 1);
-       xMD5Update(&Md5Ctx, HEntity, HASHHEXLEN);
+       SquidMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, HEntity, HASHHEXLEN);
     }
-    xMD5Final((unsigned char *) HA2, &Md5Ctx);
+    SquidMD5Final((unsigned char *) HA2, &Md5Ctx);
     CvtHex(HA2, HA2Hex);
 
     /* calculate response
      */
-    xMD5Init(&Md5Ctx);
-    xMD5Update(&Md5Ctx, HA1, HASHHEXLEN);
-    xMD5Update(&Md5Ctx, ":", 1);
-    xMD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
-    xMD5Update(&Md5Ctx, ":", 1);
+    SquidMD5Init(&Md5Ctx);
+    SquidMD5Update(&Md5Ctx, HA1, HASHHEXLEN);
+    SquidMD5Update(&Md5Ctx, ":", 1);
+    SquidMD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
+    SquidMD5Update(&Md5Ctx, ":", 1);
     if (*pszQop) {
-       xMD5Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));
-       xMD5Update(&Md5Ctx, ":", 1);
-       xMD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
-       xMD5Update(&Md5Ctx, ":", 1);
-       xMD5Update(&Md5Ctx, pszQop, strlen(pszQop));
-       xMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));
+       SquidMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
+       SquidMD5Update(&Md5Ctx, ":", 1);
+       SquidMD5Update(&Md5Ctx, pszQop, strlen(pszQop));
+       SquidMD5Update(&Md5Ctx, ":", 1);
     }
-    xMD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
-    xMD5Final((unsigned char *) RespHash, &Md5Ctx);
+    SquidMD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
+    SquidMD5Final((unsigned char *) RespHash, &Md5Ctx);
     CvtHex(RespHash, Response);
 }
index bbd43a775a5df2f5f5f0b0d83de97cdfb2f4e9fc..994aaf801d0b988df4e4ccc2fef2844b425c53b3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: CacheDigest.cc,v 1.39 2007/04/28 22:26:37 hno Exp $
+ * $Id: CacheDigest.cc,v 1.40 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 70    Cache Digest
  * AUTHOR: Alex Rousskov
@@ -75,7 +75,7 @@ CacheDigest *
 cacheDigestCreate(int capacity, int bpe)
 {
     CacheDigest *cd = (CacheDigest *)memAllocate(MEM_CACHE_DIGEST);
-    assert(MD5_DIGEST_CHARS == 16);    /* our hash functions rely on 16 byte keys */
+    assert(SQUID_MD5_DIGEST_LENGTH == 16);     /* our hash functions rely on 16 byte keys */
     cacheDigestInit(cd, capacity, bpe);
     return cd;
 }
index b2c4582b390fae0cac51ad0db8a8cc95c2faebd4..9ac3633626ee39a4f5ab664d93e3793de32446ac 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: MemObject.cc,v 1.31 2007/11/15 09:18:12 amosjeffries Exp $
+ * $Id: MemObject.cc,v 1.32 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 19    Store Memory Primitives
  * AUTHOR: Robert Collins
@@ -52,11 +52,11 @@ unsigned int
 url_checksum(const char *url)
 {
     unsigned int ck;
-    MD5_CTX M;
+    SquidMD5_CTX M;
     static unsigned char digest[16];
-    xMD5Init(&M);
-    xMD5Update(&M, (unsigned char *) url, strlen(url));
-    xMD5Final(digest, &M);
+    SquidMD5Init(&M);
+    SquidMD5Update(&M, (unsigned char *) url, strlen(url));
+    SquidMD5Final(digest, &M);
     xmemcpy(&ck, digest, sizeof(ck));
     return ck;
 }
index 3bc3a4d7fe019bb30ee6b98bc50255572fe3bb6b..44b45ae1db032a1211088a866fd1f6f735c315ec 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: StoreMetaMD5.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
+ * $Id: StoreMetaMD5.cc,v 1.6 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapfile Metadata
  * AUTHOR: Kostas Anagnostakis
@@ -41,7 +41,7 @@
 bool
 StoreMetaMD5::validLength(int len) const
 {
-    return len == MD5_DIGEST_CHARS;
+    return len == SQUID_MD5_DIGEST_LENGTH;
 }
 
 int StoreMetaMD5::md5_mismatches = 0;
@@ -50,10 +50,10 @@ bool
 StoreMetaMD5::checkConsistency(StoreEntry *e) const
 {
     assert (getType() == STORE_META_KEY_MD5);
-    assert(length == MD5_DIGEST_CHARS);
+    assert(length == SQUID_MD5_DIGEST_LENGTH);
 
     if (!EBIT_TEST(e->flags, KEY_PRIVATE) &&
-            memcmp(value, e->key, MD5_DIGEST_CHARS)) {
+            memcmp(value, e->key, SQUID_MD5_DIGEST_LENGTH)) {
         debugs(20, 2, "storeClientReadHeader: swapin MD5 mismatch");
         // debugs(20, 2, "\t" << storeKeyText((const cache_key *)value));
         debugs(20, 2, "\t" << e->getMD5Text());
index 5babcaeedba695c4a838e425d70318217b586d3b..65e1a0127de8740f9dda04d9f8c97f617ac34e29 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: StoreSwapLogData.h,v 1.4 2007/08/13 17:20:51 hno Exp $
+ * $Id: StoreSwapLogData.h,v 1.5 2007/11/15 16:47:35 wessels Exp $
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
@@ -60,7 +60,7 @@ public:
     uint64_t swap_file_sz;
     u_short refcount;
     u_short flags;
-    unsigned char key[MD5_DIGEST_CHARS];
+    unsigned char key[SQUID_MD5_DIGEST_LENGTH];
 };
 
 MEMPROXY_CLASS_INLINE(StoreSwapLogData)
index 5b3ac4251546d86f16fe01f9e81214756a8e2c3d..e74aa99085a9abe35a91e396d79773f280eb15fe 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_diff.cc,v 1.20 2003/07/15 11:33:22 robertc Exp $
+ * $Id: cache_diff.cc,v 1.21 2007/11/15 16:47:35 wessels Exp $
  *
  * AUTHOR: Alex Rousskov
  *
@@ -59,7 +59,7 @@ typedef struct _CacheEntry
 
     struct _CacheEntry *next;
     /* StoreSwapLogData s; */
-    unsigned char key_arr[MD5_DIGEST_CHARS];
+    unsigned char key_arr[SQUID_MD5_DIGEST_LENGTH];
 }
 
 CacheEntry;
@@ -88,7 +88,7 @@ cacheEntryCreate(const StoreSwapLogData * s)
     CacheEntry *e = xcalloc(1, sizeof(CacheEntry));
     assert(s);
     /* e->s = *s; */
-    xmemcpy(e->key_arr, s->key, MD5_DIGEST_CHARS);
+    xmemcpy(e->key_arr, s->key, SQUID_MD5_DIGEST_LENGTH);
     e->key = &e->key_arr[0];
     return e;
 }
index dc3794aa1aa5272a9c9bcff96cb0ff4bac105519..43d17627e8fdc289cca0ed8b0295826c8f8feaa9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_coss.cc,v 1.76 2007/08/13 17:20:56 hno Exp $
+ * $Id: store_dir_coss.cc,v 1.77 2007/11/15 16:47:36 wessels Exp $
  * vim: set et : 
  *
  * DEBUG: section 47    Store COSS Directory Routines
@@ -793,7 +793,7 @@ CossCleanLog::write(StoreEntry const &e)
     s.swap_file_sz = e.swap_file_sz;
     s.refcount = e.refcount;
     s.flags = e.flags;
-    xmemcpy(&s.key, e.key, MD5_DIGEST_CHARS);
+    xmemcpy(&s.key, e.key, SQUID_MD5_DIGEST_LENGTH);
     xmemcpy(outbuf + outbuf_offset, &s, ss);
     outbuf_offset += ss;
     /* buffered write */
@@ -898,7 +898,7 @@ CossSwapDir::logEntry(const StoreEntry & e, int op) const
     s->swap_file_sz = e.swap_file_sz;
     s->refcount = e.refcount;
     s->flags = e.flags;
-    xmemcpy(s->key, e.key, MD5_DIGEST_CHARS);
+    xmemcpy(s->key, e.key, SQUID_MD5_DIGEST_LENGTH);
     file_write(swaplog_fd,
                -1,
                s,
index ea7d3c87011ade62ed493e492eaeb0e0d01bcfb3..f6cc16af32c1a6dfa9d70e8348ef0d85d4b3ecd4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_ufs.cc,v 1.85 2007/08/13 17:20:57 hno Exp $
+ * $Id: store_dir_ufs.cc,v 1.86 2007/11/15 16:47:38 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -934,7 +934,7 @@ UFSCleanLog::write(StoreEntry const &e)
     s.swap_file_sz = e.swap_file_sz;
     s.refcount = e.refcount;
     s.flags = e.flags;
-    xmemcpy(&s.key, e.key, MD5_DIGEST_CHARS);
+    xmemcpy(&s.key, e.key, SQUID_MD5_DIGEST_LENGTH);
     xmemcpy(outbuf + outbuf_offset, &s, ss);
     outbuf_offset += ss;
     /* buffered write */
@@ -1043,7 +1043,7 @@ UFSSwapDir::logEntry(const StoreEntry & e, int op) const
     s->swap_file_sz = e.swap_file_sz;
     s->refcount = e.refcount;
     s->flags = e.flags;
-    xmemcpy(s->key, e.key, MD5_DIGEST_CHARS);
+    xmemcpy(s->key, e.key, SQUID_MD5_DIGEST_LENGTH);
     file_write(swaplog_fd,
                -1,
                s,
index cc44aff3e35034a9cbb6c49ca2d65eaef0691126..fa47c99c530cfee7e12f7416a48124b510728614 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ufscommon.cc,v 1.14 2007/08/15 15:07:41 rousskov Exp $
+ * $Id: ufscommon.cc,v 1.15 2007/11/15 16:47:38 wessels Exp $
  * vim: set et : 
  *
  * DEBUG: section 47    Store Directory Routines
@@ -58,7 +58,7 @@ public:
        size_t swap_file_sz;
        u_short refcount;
        u_short flags;
-       unsigned char key[MD5_DIGEST_CHARS];
+       unsigned char key[SQUID_MD5_DIGEST_LENGTH];
     };
     UFSSwapLogParser_old(FILE *fp):UFSSwapLogParser(fp)
     {
@@ -86,7 +86,7 @@ bool UFSSwapLogParser_old::ReadRecord(StoreSwapLogData &swapData){
     swapData.swap_file_sz = readData.swap_file_sz;
     swapData.refcount = readData.refcount;
     swapData.flags = readData.flags;
-    xmemcpy(swapData.key, readData.key, MD5_DIGEST_CHARS);
+    xmemcpy(swapData.key, readData.key, SQUID_MD5_DIGEST_LENGTH);
     return true;
 }
 
@@ -241,8 +241,8 @@ struct InitStoreEntry : public unary_function<StoreMeta, void>
         switch (x.getType()) {
 
         case STORE_META_KEY:
-            assert(x.length == MD5_DIGEST_CHARS);
-            xmemcpy(index, x.value, MD5_DIGEST_CHARS);
+            assert(x.length == SQUID_MD5_DIGEST_LENGTH);
+            xmemcpy(index, x.value, SQUID_MD5_DIGEST_LENGTH);
             break;
 
         case STORE_META_STD:
@@ -285,7 +285,7 @@ RebuildState::rebuildFromDirectory()
 {
     LOCAL_ARRAY(char, hdr_buf, SM_PAGE_SIZE);
     currentEntry(NULL);
-    cache_key key[MD5_DIGEST_CHARS];
+    cache_key key[SQUID_MD5_DIGEST_LENGTH];
 
     struct stat sb;
     int swap_hdr_len;
@@ -360,7 +360,7 @@ RebuildState::rebuildFromDirectory()
         }
 
         debugs(47, 3, "commonUfsDirRebuildFromDirectory: successful swap meta unpacking");
-        memset(key, '\0', MD5_DIGEST_CHARS);
+        memset(key, '\0', SQUID_MD5_DIGEST_LENGTH);
 
         StoreEntry tmpe;
         InitStoreEntry visitor(&tmpe, key);
index 7f5e8c9dc89d9ede797534c4abc67f0eb6ef4d8f..6a9ce5455dd4c9b6ce4f39175fba6988b8ca9d38 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: htcp.cc,v 1.76 2007/04/30 16:56:09 wessels Exp $
+ * $Id: htcp.cc,v 1.77 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 31    Hypertext Caching Protocol
  * AUTHOR: Duane Wesssels
@@ -261,7 +261,7 @@ static int htcpInSocket = -1;
 static int htcpOutSocket = -1;
 #define N_QUERIED_KEYS 8192
 static u_int32_t queried_id[N_QUERIED_KEYS];
-static cache_key queried_keys[N_QUERIED_KEYS][MD5_DIGEST_CHARS];
+static cache_key queried_keys[N_QUERIED_KEYS][SQUID_MD5_DIGEST_LENGTH];
 
 static struct sockaddr_in queried_addr[N_QUERIED_KEYS];
 static MemAllocator *htcpDetailPool = NULL;
index bc27107475cef68aed1ad3e82b9990bda2e52f08..9ee1c1a9dff4ccc150bdf68431ad6d987ba46d69 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icp_v2.cc,v 1.100 2007/11/13 23:25:34 rousskov Exp $
+ * $Id: icp_v2.cc,v 1.101 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 12    Internet Cache Protocol
  * AUTHOR: Duane Wessels
@@ -832,7 +832,7 @@ icpCount(void *buf, int which, size_t len, int delay)
 
 #define N_QUERIED_KEYS 8192
 #define N_QUERIED_KEYS_MASK 8191
-static cache_key queried_keys[N_QUERIED_KEYS][MD5_DIGEST_CHARS];
+static cache_key queried_keys[N_QUERIED_KEYS][SQUID_MD5_DIGEST_LENGTH];
 
 int
 icpSetCacheKey(const cache_key * key)
index ca0db9963c5423260d8f0fcc57f4099b4887fa8e..8e253ec7da12b2fa9402ac39ab7b7a9decca6c78 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mem.cc,v 1.105 2007/05/22 16:40:06 rousskov Exp $
+ * $Id: mem.cc,v 1.106 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 13    High Level Memory Pool Management
  * AUTHOR: Harvest Derived
@@ -417,7 +417,7 @@ Mem::Init(void)
     memDataInit(MEM_NET_DB_NAME, "net_db_name", sizeof(net_db_name), 0);
     memDataInit(MEM_RELIST, "relist", sizeof(relist), 0);
     memDataInit(MEM_CLIENT_INFO, "ClientInfo", sizeof(ClientInfo), 0);
-    memDataInit(MEM_MD5_DIGEST, "MD5 digest", MD5_DIGEST_CHARS, 0);
+    memDataInit(MEM_MD5_DIGEST, "MD5 digest", SQUID_MD5_DIGEST_LENGTH, 0);
     MemPools[MEM_MD5_DIGEST]->setChunkSize(512 * 1024);
 
     /* init string pools */
index 6487980deacc7b6d69e915ea43f9df6fd9701687..1fdfed2ea5724c99d0a2e54419cbe921d9e02886 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_key_md5.cc,v 1.35 2007/11/15 09:18:12 amosjeffries Exp $
+ * $Id: store_key_md5.cc,v 1.36 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager MD5 Cache Keys
  * AUTHOR: Duane Wessels
 #include "squid.h"
 #include "HttpRequest.h"
 
-static cache_key null_key[MD5_DIGEST_CHARS];
+static cache_key null_key[SQUID_MD5_DIGEST_LENGTH];
 
 const char *
 storeKeyText(const cache_key *key)
 {
-    static char buf[MD5_DIGEST_CHARS * 2+1];
+    static char buf[SQUID_MD5_DIGEST_LENGTH * 2+1];
     int i;
 
-    for (i = 0; i < MD5_DIGEST_CHARS; i++)
+    for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; i++)
         snprintf(&buf[i*2],sizeof(buf) - i*2, "%02X", *(key + i));
 
     return buf;
@@ -53,12 +53,12 @@ storeKeyText(const cache_key *key)
 const cache_key *
 storeKeyScan(const char *buf)
 {
-    static unsigned char digest[MD5_DIGEST_CHARS];
+    static unsigned char digest[SQUID_MD5_DIGEST_LENGTH];
     int i;
     int j = 0;
     char t[3];
 
-    for (i = 0; i < MD5_DIGEST_CHARS; i++) {
+    for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; i++) {
         t[0] = *(buf + (j++));
         t[1] = *(buf + (j++));
         t[2] = '\0';
@@ -75,7 +75,7 @@ storeKeyHashCmp(const void *a, const void *b)
     const unsigned char *B = (const unsigned char *)b;
     int i;
 
-    for (i = 0; i < MD5_DIGEST_CHARS; i++) {
+    for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; i++) {
         if (A[i] < B[i])
             return -1;
 
@@ -101,28 +101,28 @@ storeKeyHashHash(const void *key, unsigned int n)
 const cache_key *
 storeKeyPrivate(const char *url, method_t method, int id)
 {
-    static cache_key digest[MD5_DIGEST_CHARS];
-    MD5_CTX M;
+    static cache_key digest[SQUID_MD5_DIGEST_LENGTH];
+    SquidMD5_CTX M;
     assert(id > 0);
     debugs(20, 3, "storeKeyPrivate: " << RequestMethodStr[method] << " " << url);
-    xMD5Init(&M);
-    xMD5Update(&M, (unsigned char *) &id, sizeof(id));
-    xMD5Update(&M, (unsigned char *) &method, sizeof(method));
-    xMD5Update(&M, (unsigned char *) url, strlen(url));
-    xMD5Final(digest, &M);
+    SquidMD5Init(&M);
+    SquidMD5Update(&M, (unsigned char *) &id, sizeof(id));
+    SquidMD5Update(&M, (unsigned char *) &method, sizeof(method));
+    SquidMD5Update(&M, (unsigned char *) url, strlen(url));
+    SquidMD5Final(digest, &M);
     return digest;
 }
 
 const cache_key *
 storeKeyPublic(const char *url, const method_t method)
 {
-    static cache_key digest[MD5_DIGEST_CHARS];
+    static cache_key digest[SQUID_MD5_DIGEST_LENGTH];
     unsigned char m = (unsigned char) method;
-    MD5_CTX M;
-    xMD5Init(&M);
-    xMD5Update(&M, &m, sizeof(m));
-    xMD5Update(&M, (unsigned char *) url, strlen(url));
-    xMD5Final(digest, &M);
+    SquidMD5_CTX M;
+    SquidMD5Init(&M);
+    SquidMD5Update(&M, &m, sizeof(m));
+    SquidMD5Update(&M, (unsigned char *) url, strlen(url));
+    SquidMD5Final(digest, &M);
     return digest;
 }
 
@@ -135,18 +135,18 @@ storeKeyPublicByRequest(HttpRequest * request)
 const cache_key *
 storeKeyPublicByRequestMethod(HttpRequest * request, const method_t method)
 {
-    static cache_key digest[MD5_DIGEST_CHARS];
+    static cache_key digest[SQUID_MD5_DIGEST_LENGTH];
     unsigned char m = (unsigned char) method;
     const char *url = urlCanonical(request);
-    MD5_CTX M;
-    xMD5Init(&M);
-    xMD5Update(&M, &m, sizeof(m));
-    xMD5Update(&M, (unsigned char *) url, strlen(url));
+    SquidMD5_CTX M;
+    SquidMD5Init(&M);
+    SquidMD5Update(&M, &m, sizeof(m));
+    SquidMD5Update(&M, (unsigned char *) url, strlen(url));
 
     if (request->vary_headers)
-        xMD5Update(&M, (unsigned char *) request->vary_headers, strlen(request->vary_headers));
+        SquidMD5Update(&M, (unsigned char *) request->vary_headers, strlen(request->vary_headers));
 
-    xMD5Final(digest, &M);
+    SquidMD5Final(digest, &M);
 
     return digest;
 }
@@ -155,14 +155,14 @@ cache_key *
 storeKeyDup(const cache_key * key)
 {
     cache_key *dup = (cache_key *)memAllocate(MEM_MD5_DIGEST);
-    xmemcpy(dup, key, MD5_DIGEST_CHARS);
+    xmemcpy(dup, key, SQUID_MD5_DIGEST_LENGTH);
     return dup;
 }
 
 cache_key *
 storeKeyCopy(cache_key * dst, const cache_key * src)
 {
-    xmemcpy(dst, src, MD5_DIGEST_CHARS);
+    xmemcpy(dst, src, SQUID_MD5_DIGEST_LENGTH);
     return dst;
 }
 
@@ -186,7 +186,7 @@ storeKeyHashBuckets(int nbuckets)
 int
 storeKeyNull(const cache_key * key)
 {
-    if (memcmp(key, null_key, MD5_DIGEST_CHARS) == 0)
+    if (memcmp(key, null_key, SQUID_MD5_DIGEST_LENGTH) == 0)
         return 1;
     else
         return 0;
@@ -195,5 +195,5 @@ storeKeyNull(const cache_key * key)
 void
 storeKeyInit(void)
 {
-    memset(null_key, '\0', MD5_DIGEST_CHARS);
+    memset(null_key, '\0', SQUID_MD5_DIGEST_LENGTH);
 }
index c8a95e9f5db9690d843c07bdffe2037c1fe5a457..5f8cca253217eecfb8401babf3510c74daad5b77 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapmeta.cc,v 1.26 2007/08/13 17:20:51 hno Exp $
+ * $Id: store_swapmeta.cc,v 1.27 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapfile Metadata
  * AUTHOR: Kostas Anagnostakis
@@ -65,7 +65,7 @@ storeSwapMetaBuild(StoreEntry * e)
     assert(e->swap_status == SWAPOUT_WRITING);
     url = e->url();
     debugs(20, 3, "storeSwapMetaBuild: " << url  );
-    tlv *t = StoreMeta::Factory (STORE_META_KEY,MD5_DIGEST_CHARS, e->key);
+    tlv *t = StoreMeta::Factory (STORE_META_KEY,SQUID_MD5_DIGEST_LENGTH, e->key);
 
     if (!t) {
         storeSwapTLVFree(TLV);
index 459813fc2bb2d02c3dee7713ea8a9825a7c1b72c..afb30573800ee7a1ccfbccff97dfccdf4a3aa711 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: test_cache_digest.cc,v 1.33 2004/12/20 16:30:36 robertc Exp $
+ * $Id: test_cache_digest.cc,v 1.34 2007/11/15 16:47:35 wessels Exp $
  *
  * AUTHOR: Alex Rousskov
  *
@@ -70,7 +70,7 @@ typedef struct _CacheEntry
     const cache_key *key;
 
     struct _CacheEntry *next;
-    unsigned char key_arr[MD5_DIGEST_CHARS];
+    unsigned char key_arr[SQUID_MD5_DIGEST_LENGTH];
     /* storeSwapLogData s; */
 }
 
@@ -80,7 +80,7 @@ CacheEntry;
 
 typedef struct
 {
-    cache_key key[MD5_DIGEST_CHARS];
+    cache_key key[SQUID_MD5_DIGEST_LENGTH];
     time_t timestamp;
     short int use_icp;         /* true/false */
 }
@@ -237,7 +237,7 @@ cacheEntryCreate(const storeSwapLogData * s)
     CacheEntry *e = (CacheEntry *)xcalloc(1, sizeof(CacheEntry));
     assert(s);
     /* e->s = *s; */
-    xmemcpy(e->key_arr, s->key, MD5_DIGEST_CHARS);
+    xmemcpy(e->key_arr, s->key, SQUID_MD5_DIGEST_LENGTH);
     e->key = &e->key_arr[0];
     return e;
 }
index 4f8ab804b23a15224e2e1e260df169eb31462f6e..9e0d0abcd6ddad32f02f433993d0ac46e556ecf8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ufsdump.cc,v 1.10 2007/08/13 17:20:51 hno Exp $
+ * $Id: ufsdump.cc,v 1.11 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 0     UFS Store Dump
  * AUTHOR: Robert Collins
@@ -148,9 +148,9 @@ main(int argc, char *argv[])
 
         metadata = aBuilder.createStoreMeta ();
 
-        cache_key key[MD5_DIGEST_CHARS];
+        cache_key key[SQUID_MD5_DIGEST_LENGTH];
 
-        memset(key, '\0', MD5_DIGEST_CHARS);
+        memset(key, '\0', SQUID_MD5_DIGEST_LENGTH);
 
         DumpStoreMeta dumper;
 
index fc4db161694a3cb3c370261553868517e7ece62a..98e214195b7cdd1a05f777d947323489f037f7eb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wccp2.cc,v 1.18 2007/11/15 09:18:12 amosjeffries Exp $
+ * $Id: wccp2.cc,v 1.19 2007/11/15 16:47:35 wessels Exp $
  *
  * DEBUG: section 80    WCCP Support
  * AUTHOR: Steven Wilton
@@ -536,7 +536,7 @@ wccp2_update_md5_security(char *password, char *ptr, char *packet, int len)
 {
     u_int8_t md5_digest[16];
     char pwd[WCCP2_PASSWORD_LEN];
-    MD5_CTX M;
+    SquidMD5_CTX M;
 
     struct wccp2_security_md5_t *ws;
 
@@ -564,13 +564,13 @@ wccp2_update_md5_security(char *password, char *ptr, char *packet, int len)
     /* XXX eventually we should be able to kill md5_digest and blit it directly in */
     memset(ws->security_implementation, 0, sizeof(ws->security_implementation));
 
-    xMD5Init(&M);
+    SquidMD5Init(&M);
 
-    xMD5Update(&M, pwd, 8);
+    SquidMD5Update(&M, pwd, 8);
 
-    xMD5Update(&M, packet, len);
+    SquidMD5Update(&M, packet, len);
 
-    xMD5Final(md5_digest, &M);
+    SquidMD5Final(md5_digest, &M);
 
     memcpy(ws->security_implementation, md5_digest, sizeof(md5_digest));
 
@@ -590,7 +590,7 @@ wccp2_check_security(struct wccp2_service_list_t *srv, char *security, char *pac
     struct wccp2_security_md5_t *ws = (struct wccp2_security_md5_t *) security;
     u_int8_t md5_digest[16], md5_challenge[16];
     char pwd[WCCP2_PASSWORD_LEN];
-    MD5_CTX M;
+    SquidMD5_CTX M;
 
     /* Make sure the security type matches what we expect */
 
@@ -623,13 +623,13 @@ wccp2_check_security(struct wccp2_service_list_t *srv, char *security, char *pac
 
     memset(ws->security_implementation, 0, sizeof(ws->security_implementation));
 
-    xMD5Init(&M);
+    SquidMD5Init(&M);
 
-    xMD5Update(&M, pwd, 8);
+    SquidMD5Update(&M, pwd, 8);
 
-    xMD5Update(&M, packet, len);
+    SquidMD5Update(&M, packet, len);
 
-    xMD5Final(md5_digest, &M);
+    SquidMD5Final(md5_digest, &M);
 
     return (memcmp(md5_digest, md5_challenge, 16) == 0);
 }