[xserver] add libc as a choice for SHA1 implementation
Matthieu Herrb
matthieu.herrb at laas.fr
Sun Nov 1 09:34:35 PST 2009
Hi,
As promised here's the patch that probes for SHA1 implementation in libc,
as found on BSD systems.
From: Matthieu Herrb <matthieu.herrb at laas.fr>
Date: Sun, 1 Nov 2009 18:19:27 +0100
Subject: [PATCH] Add a probe for SHA1 functions in libc in *BSD.
The interface is the same as the one in libmd.
---
configure.ac | 14 +++++++++++++-
include/dix-config.h.in | 3 +++
os/xsha1.c | 3 ++-
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7d87b29..9119a03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1297,8 +1297,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_FUNCS([SHA1Init], [HAVE_LIBC_SHA1=yes])
+if test "x$with_sha1" = x && test "x$HAVE_LIBC_SHA1" = xyes; then
+ with_sha1=libc
+fi
+if test "x$with_sha1" = xlibc && test "x$HAVE_LIBC_SHA1" != 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 e2bc18e..a57d9b6 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -160,6 +160,9 @@
/* Define to 1 if you have the <rpcsvc/dbm.h> 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 94092ca..229ce89 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 <sha1.h>
--
1.6.5.1
More information about the xorg-devel
mailing list