--- include/md5.h 2007-11-14 14:21:46.000000000 +1300 +++ include/md5.h-freebsd-fix 2007-11-14 15:00:17.000000000 +1300 @@ -5,14 +5,10 @@ * 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.. */ -#define USE_SQUID_MD5 0 #if USE_OPENSSL && HAVE_OPENSSL_MD5_H #include -/* Hack to adopt Squid to the OpenSSL syntax */ -#define MD5_DIGEST_CHARS MD5_DIGEST_LENGTH - #define MD5Init MD5_Init #define MD5Update MD5_Update #define MD5Final MD5_Final @@ -23,21 +19,24 @@ #elif HAVE_SYS_MD5_H /* * Solaris 10 provides MD5 as part of the system. + * So does FreeBSD - BUT without MD5_DIGEST_LENGTH defined. */ #include -/* - * They also define MD5_CTX with different field names - * fortunately we do not access it directly in the squid code. - */ +#endif -/* Hack to adopt Squid to the OpenSSL syntax */ +/* according to CacheDigest.cc squid REQUIRES 16-byte here for hash keys */ +#if defined(MD5_DIGEST_LENGTH) && MD5_DIGEST_LENGTH == 16 + + /* We found a nice usable version. No need for ours */ +#define USE_SQUID_MD5 0 + +/* adopt Squid to the OpenSSL syntax and define */ #define MD5_DIGEST_CHARS MD5_DIGEST_LENGTH -#else /* NEED_OWN_MD5 */ +#else /* NEED squid bundled version */ /* Turn on internal MD5 code */ -#undef USE_SQUID_MD5 #define USE_SQUID_MD5 1 /* @@ -80,7 +79,7 @@ SQUIDCEXTERN void MD5Final(uint8_t digest[16], struct MD5Context *context); SQUIDCEXTERN void MD5Transform(uint32_t buf[4], uint32_t const in[16]); -#define MD5_DIGEST_CHARS 16 +#endif /* MD5_DIGEST_CHARS != 16 */ + -#endif /* USE_OPENSSL */ #endif /* SQUID_MD5_H */