]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 87] Use md5 from the OS if available.
authorHarlan Stenn <stenn@ntp.org>
Mon, 9 Jun 2003 08:35:19 +0000 (04:35 -0400)
committerHarlan Stenn <stenn@ntp.org>
Mon, 9 Jun 2003 08:35:19 +0000 (04:35 -0400)
bk: 3ee446c7mqPD1RFVBt5V-v3_Kt1AvQ

configure.in
include/Makefile.am
include/ntp_md5.h [new file with mode: 0644]
include/rsa_md5.h
libntp/Makefile.am
libntp/a_md5encrypt.c
libntp/md5c.c

index f2f09942715176a9d998a6203236f2732869eea5..ea6ed93b0efcb2a9f0102b57ebe826d808bb6f80 100644 (file)
@@ -226,6 +226,9 @@ AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent, , , -lsocket))
 AC_CHECK_FUNC(openlog, , 
   AC_CHECK_LIB(gen, openlog, , 
   AC_CHECK_LIB(syslog, openlog, , , -lsocket)))
+AC_CHECK_LIB(md5, MD5Init, , 
+  AC_CHECK_LIB(md, MD5Init))
+AC_CHECK_FUNCS(MD5Init)
 dnl HMS: What a hack...
 AC_CHECK_HEADERS(readline/history.h readline/readline.h)
 case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in
@@ -258,8 +261,9 @@ esac
 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
 
 AC_HEADER_STDC
-AC_CHECK_HEADERS(bstring.h errno.h fcntl.h ieeefp.h math.h memory.h netdb.h)
-AC_CHECK_HEADERS(poll.h)
+AC_CHECK_HEADERS(bstring.h errno.h fcntl.h ieeefp.h math.h)
+AC_CHECK_HEADERS(md5.h)
+AC_CHECK_HEADERS(memory.h netdb.h poll.h)
 AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h)
 AC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h)
 case "$host" in
index 1f92409bae8a83a4268bada59fb5b5b2b240c0bc..8f8b934afeb4cb22e6512ac26e483ce1bf258f6a 100644 (file)
@@ -34,6 +34,7 @@ noinst_HEADERS = \
        ntp_io.h \
        ntp_machine.h \
        ntp_malloc.h \
+       ntp_md5.h \
        ntp_proto.h \
        ntp_refclock.h \
        ntp_request.h \
diff --git a/include/ntp_md5.h b/include/ntp_md5.h
new file mode 100644 (file)
index 0000000..bb6985a
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * ntp_md5.h: deal with md5.h headers
+ */
+
+#ifdef HAVE_MD5_H
+# include <md5.h>
+#else
+# include "rsa_md5.h"
+#endif
index 63928dd4fdcf067ccea8a3dce0c94f2cfec73849..8241647601b3d54f105b6a1c16d3405e694ed8a2 100644 (file)
@@ -37,12 +37,12 @@ typedef struct {
   UINT4 state[4];                                   /* state (ABCD) */
   UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
   unsigned char buffer[64];                         /* input buffer */
-} ntp_MD5_CTX;
+} MD5_CTX;
 
-void MD5Init PROTO_LIST ((ntp_MD5_CTX *));
+void MD5Init PROTO_LIST ((MD5_CTX *));
 void MD5Update PROTO_LIST
-  ((ntp_MD5_CTX *, unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], ntp_MD5_CTX *));
+  ((MD5_CTX *, unsigned char *, unsigned int));
+void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
 
 #ifdef __cplusplus
 }
index 84a2adac40fc270fb3de9afc172c2e9d05ef2e6b..75b5505b1bf1269ad12b124a630fdb1afda15171 100644 (file)
@@ -33,4 +33,3 @@ noinst_HEADERS = lib_strbuf.h log.h
 
 EXTRA_DIST = README
 
-
index 0e279901667e8e6aa60c9ba1876cd650aadab155..ad7abf86ce18feaad79e6007a081ce160cea6401 100644 (file)
@@ -26,7 +26,7 @@
 #include "ntp_stdlib.h"
 #include "ntp.h"
 #include "global.h"
-#include "rsa_md5.h"
+#include "ntp_md5.h"
 
 /*
  * MD5authencrypt - generate MD5 message authenticator
@@ -40,7 +40,7 @@ MD5authencrypt(
        int length              /* packet length */
        )
 {
-       ntp_MD5_CTX md5;
+       MD5_CTX md5;
        u_char digest[16];
 
        /*
@@ -68,7 +68,7 @@ MD5authdecrypt(
        int size                /* MAC size */
        )
 {
-       ntp_MD5_CTX md5;
+       MD5_CTX md5;
        u_char digest[16];
 
        /*
@@ -91,7 +91,7 @@ MD5authdecrypt(
 u_int32
 addr2refid(struct sockaddr_storage *addr)
 {
-       ntp_MD5_CTX md5;
+       MD5_CTX md5;
        u_char digest[16];
        u_int32 addr_refid;
 
index e6327c9b6412c2c3be663887ec2a9940e16b63c7..07eec6c2f7485490cb393d8cb2bdca44017aba1c 100644 (file)
@@ -24,7 +24,8 @@
  */
 
 #include "global.h"
-#include "rsa_md5.h"
+#ifndef HAVE_MD5INIT
+#include "ntp_md5.h"
 
 /* Constants for MD5Transform routine.
  */
@@ -98,7 +99,7 @@ static unsigned char PADDING[64] = {
  */
 void
 MD5Init(
-       ntp_MD5_CTX *context                             /* context */
+       MD5_CTX *context                             /* context */
        )
 {
   context->count[0] = context->count[1] = 0;
@@ -117,7 +118,7 @@ MD5Init(
  */
 void
 MD5Update (
-       ntp_MD5_CTX *context,                               /* context */
+       MD5_CTX *context,                               /* context */
        unsigned char *input,                       /* input block */
        unsigned int inputLen             /* length of input block */
        )
@@ -162,7 +163,7 @@ MD5Update (
 void
 MD5Final (
        unsigned char digest[16],                /* message digest */
-       ntp_MD5_CTX *context                                /* context */
+       MD5_CTX *context                                /* context */
        )
 {
   unsigned char bits[8];
@@ -348,3 +349,6 @@ MD5_memset (
   for (i = 0; i < len; i++)
     ((char *)output)[i] = (char)value;
 }
+#else
+int md5_bs;
+#endif