diff --git a/configure.ac b/configure.ac index bdbbc7a1b..8e1edbad0 100644 --- a/configure.ac +++ b/configure.ac @@ -1287,8 +1287,20 @@ CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include' # SHA1 hashing AC_ARG_WITH([sha1], - [AS_HELP_STRING([--with-sha1=libmd|libgcrypt|libcrypto|libsha1], + [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1], [choose SHA1 implementation])]) +AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes]) +if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then + with_sha1=libc +fi +if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then + AC_MSG_ERROR([libc requested but not found]) +fi +if test "x$with_sha1" = xlibc; then + AC_DEFINE([HAVE_SHA1_IN_LIBC], [1], + [Use libc SHA1 functions]) + SHA1_LIBS="" +fi AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes]) if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then with_sha1=libmd diff --git a/include/dix-config.h.in b/include/dix-config.h.in index ebf373392..274ce89f9 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -160,6 +160,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_RPCSVC_DBM_H +/* Define to use libc SHA1 functions */ +#undef HAVE_SHA1_IN_LIBC + /* Define to use libmd SHA1 functions */ #undef HAVE_SHA1_IN_LIBMD diff --git a/os/xsha1.c b/os/xsha1.c index 94092caa7..229ce896d 100644 --- a/os/xsha1.c +++ b/os/xsha1.c @@ -5,7 +5,8 @@ #include "os.h" #include "xsha1.h" -#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */ +#if defined(HAVE_SHA1_IN_LIBMD) /* Use libmd for SHA1 */ \ + || defined(HAVE_SHA1_IN_LIBC) /* Use libc for SHA1 */ # include