]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Solaris 10 appears to provide MD5 natively
authoramosjeffries <>
Sun, 11 Nov 2007 09:26:58 +0000 (09:26 +0000)
committeramosjeffries <>
Sun, 11 Nov 2007 09:26:58 +0000 (09:26 +0000)
* alter the MD5 logics to perform compile-time tests of
  whether the squid internal MD5 is needed.
* OpenSSL implementation primary as before with same configure options
* first backup is to use the OS-provided.
* final backup is to use squid internal code.

configure.in
include/md5.h
lib/Makefile.am
lib/md5.c

index 1b05ba169263880516227097a7a0dac45dc6c2fa..f568ffce04aea8f0ece2a34df62b1b4c1b9db805 100644 (file)
@@ -1,7 +1,7 @@
 
 dnl  Configuration input file for Squid
 dnl
-dnl  $Id: configure.in,v 1.483 2007/11/07 10:20:46 amosjeffries Exp $
+dnl  $Id: configure.in,v 1.484 2007/11/11 02:26:58 amosjeffries Exp $
 dnl
 dnl
 dnl
@@ -11,7 +11,7 @@ AM_CONFIG_HEADER(include/autoconf.h)
 AC_CONFIG_AUX_DIR(cfgaux)
 AC_CONFIG_SRCDIR([src/main.cc])
 AM_INIT_AUTOMAKE([tar-ustar])
-AC_REVISION($Revision: 1.483 $)dnl
+AC_REVISION($Revision: 1.484 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -862,8 +862,10 @@ if test x$USE_HTCP = xtrue; then
 fi
 AM_CONDITIONAL(ENABLE_HTCP, [test x$USE_HTCP = xtrue])
 
+dnl SSL is not enabled by default.
 AM_CONDITIONAL(ENABLE_SSL, false)
 
+dnl Default is to use OpenSSL when available
 AC_ARG_ENABLE(ssl,
 [  --enable-ssl            Enable ssl gatewaying support using OpenSSL],
 [ if test "$enableval" != "no"; then
@@ -883,8 +885,7 @@ AC_ARG_ENABLE(ssl,
   fi
 ])
 
-AM_CONDITIONAL(NEED_OWN_MD5, true)
-
+dnl User may specify OpenSSL is needed from a non-standard location
 AC_ARG_WITH(openssl,
 [  --with-openssl[=prefix]
                           Compile with the OpenSSL libraries. The path to
@@ -905,11 +906,9 @@ AC_ARG_WITH(openssl,
     USE_OPENSSL=1
   esac
 ])
-
 if test -n "$USE_OPENSSL"; then
   echo "Using OpenSSL MD5 implementation"
   AC_DEFINE(USE_OPENSSL,1,[Define this to make use of the OpenSSL libraries for MD5 calculation rather than Squid's own MD5 implementation or if building with SSL encryption (USE_SSL)])
-  AM_CONDITIONAL(NEED_OWN_MD5, false)
   if test -z "$SSLLIB"; then
     SSLLIB="-lcrypto" # for MD5 routines
   fi
@@ -925,6 +924,7 @@ if test -n "$SSLLIBDIR"; then
 fi
 AC_SUBST(SSLLIB)
 
+
 AC_ARG_ENABLE(forw-via-db,
 [  --enable-forw-via-db    Enable Forw/Via database],
 [ if test "$enableval" = "yes" ; then
@@ -1891,6 +1891,7 @@ AC_CHECK_HEADERS( \
        sys/ioctl.h \
        sys/param.h \
        sys/prctl.h \
+       sys/md5.h \
        sys/msg.h \
        sys/resource.h \
        sys/select.h\
@@ -2273,7 +2274,11 @@ esac
 dnl Check for libcrypt
 dnl Some of our helpers use crypt(3) which may be in libc, or in
 dnl libcrypt (eg FreeBSD)
-AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
+AC_CHECK_LIB(crypt, crypt, [CRYPTLIB=" -lcrypt "])
+
+dnl Solaris10 provides MD5 natively through libmd5
+AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB+=" -lmd5 "])
+
 AC_SUBST(CRYPTLIB)
 
 dnl Check for libdl, used by auth_modules/PAM
index bf72f001fcd0a77f390f243b9b19a1c7d84f7942..3dee87fa65c5770ef914e9b9a0f542a77d42eb2a 100644 (file)
@@ -1,18 +1,14 @@
 #ifndef SQUID_MD5_H
 #define SQUID_MD5_H
 
-#if USE_OPENSSL
-
 /*
  * 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 HAVE_OPENSSL_MD5_H
+#if USE_OPENSSL && HAVE_OPENSSL_MD5_H
 #include <openssl/md5.h>
-#else
-#error Cannot find OpenSSL headers
-#endif
 
 /* Hack to adopt Squid to the OpenSSL syntax */
 #define MD5_DIGEST_CHARS MD5_DIGEST_LENGTH
 #define MD5Update MD5_Update
 #define MD5Final MD5_Final
 
-#else /* USE_OPENSSL */
+#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.
+ */
+#include <sys/md5.h>
+
+/*
+ * They also define MD5_CTX with different field names
+ * fortunately we do not access it directly in the squid code.
+ */
+
+/* Hack to adopt Squid to the OpenSSL syntax */
+#define MD5_DIGEST_CHARS MD5_DIGEST_LENGTH
+
+#else /* NEED_OWN_MD5 */
+
+ /* Turn on internal MD5 code */
+#undef  USE_SQUID_MD5
+#define USE_SQUID_MD5 1
 
 /*
  * This is the header file for the MD5 message-digest algorithm.
index de05a32fdc190daefccf26de552b4dfc9bfc4431..75dce2d57cd81c90c5e26ffee8cf1c4a0e4e7745 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-#  $Id: Makefile.am,v 1.28 2007/08/27 13:14:20 hno Exp $
+#  $Id: Makefile.am,v 1.29 2007/11/11 02:26:59 amosjeffries Exp $
 #
 
 DIST_SUBDIRS = libTrie
@@ -33,11 +33,6 @@ STRTOLLSOURCE=strtoll.c
 else
 STRTOLLSOURCE=
 endif
-if NEED_OWN_MD5
-MD5SOURCE=md5.c
-else
-MD5SOURCE=
-endif
 
 if ENABLE_WIN32SPECIFIC
 LIBSSPWIN32=libsspwin32.a
@@ -70,7 +65,7 @@ libmiscutil_a_SOURCES = \
        heap.c \
        html_quote.c \
        iso3307.c \
-       $(MD5SOURCE) \
+       md5.c \
        radix.c \
        rfc1035.c \
        rfc1123.c \
index 4a57367260a7d57a867739c93025f476ea61582f..0b477028e6d361b0b0334e49f58ba6904981c17e 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
  */
 #include "config.h"
 
-/* MS VisualStudio Projects are monolithic, so we need the following
+#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
@@ -41,8 +52,6 @@
 #include <netinet/in.h>                /* for ntohl() */
 #endif
 
-#include "md5.h"
-
 #ifdef WORDS_BIGENDIAN
 void byteSwap(uint32_t *, unsigned);
 
@@ -257,5 +266,6 @@ MD5Transform(uint32_t buf[4], uint32_t const in[16])
     buf[3] += d;
 }
 
-#endif
-#endif
+#endif /* !ASM_MD5 */
+#endif /* !USE_SSL */
+#endif /* !USE_SQUID_MD5 */