diff --git a/lib/libntp/COPYRIGHT b/lib/libntp/COPYRIGHT index beaf808ea8ea..f1c091848ee0 100644 --- a/lib/libntp/COPYRIGHT +++ b/lib/libntp/COPYRIGHT @@ -1,4 +1,4 @@ - + Copyright Notice @@ -52,6 +52,10 @@ Trimble PARSE support <br><li>Steve Clift (clift@ml.csiro.au): OMEGA clock driver +<br><li><a href="http://www.ee.uct.ac.za/~casey"> Casey Crellin </a> + <a href="mailto:casey@ccii.co.za"> (casey@ccii.co.za) </a> + vxWorks (Tornado) port and help with target configuration + <br><li>Torsten Duwe (duwe@immd4.informatik.uni-erlangen.de) Linux Port <br><li>John A. Dundas III (dundas@salt.jpl.nasa.gov) Apple A/UX port diff --git a/lib/libntp/Makefile b/lib/libntp/Makefile index 0de4a98145e8..227e9d252679 100644 --- a/lib/libntp/Makefile +++ b/lib/libntp/Makefile @@ -1,17 +1,18 @@ -# $NetBSD: Makefile,v 1.5 1997/10/23 02:50:18 lukem Exp $ +# $NetBSD: Makefile,v 1.6 1998/03/06 18:17:12 christos Exp $ LIB= ntp -SRCS= a_md512crypt.c a_md5decrypt.c a_md5encrypt.c adjtime.c atoint.c \ - atolfp.c atouint.c auth12crypt.c authdecrypt.c authdes.c authencrypt.c \ - authkeys.c authparity.c authreadkeys.c authusekey.c buftvtots.c \ - caljulian.c calleapwhen.c caltontp.c calyearstart.c clocktime.c \ - clocktypes.c decodenetnum.c dofptoa.c dolfptoa.c emalloc.c \ - findconfig.c fptoa.c fptoms.c getopt.c hextoint.c hextolfp.c \ - humandate.c inttoa.c lib_strbuf.c lib_strbuf.h machines.c memmove.c \ - mexit.c mfptoa.c mfptoms.c modetoa.c mstolfp.c msutotsf.c msyslog.c \ - netof.c numtoa.c numtohost.c octtoint.c prettydate.c ranny.c \ - refnumtoa.c statestr.c syssignal.c systime.c tsftomsu.c tstotv.c \ - tvtoa.c tvtots.c uglydate.c uinttoa.c utvtoa.c version.c +SRCS= utvtoa.c uinttoa.c uglydate.c tvtots.c tvtoa.c tstotv.c \ +tsftomsu.c systime.c syssignal.c statestr.c refnumtoa.c ranny.c \ +prettydate.c octtoint.c numtohost.c numtoa.c netof.c msyslog.c \ +msutotsf.c mstolfp.c modetoa.c mfptoms.c mfptoa.c mexit.c \ +memmove.c machines.c lib_strbuf.h lib_strbuf.c inttoa.c humandate.c \ +hextolfp.c hextoint.c getopt.c fptoms.c fptoa.c findconfig.c \ +emalloc.c dolfptoa.c dofptoa.c decodenetnum.c clocktypes.c clocktime.c \ +calyearstart.c caltontp.c calleapwhen.c caljulian.c buftvtots.c authusekey.c \ +authreadkeys.c authparity.c authkeys.c authencrypt.c authdes.c authdecrypt.c \ +auth12crypt.c atouint.c atolfp.c atoint.c adjtime.c a_md5encrypt.c \ +a_md5decrypt.c a_md512crypt.c +SRCS += version.c CPPFLAGS+=-DHAVE_CONFIG_H -I${.CURDIR}/../../usr.sbin/xntp/include diff --git a/lib/libntp/a_md512crypt.c b/lib/libntp/a_md512crypt.c index e57524935b5f..f8c59077e016 100644 --- a/lib/libntp/a_md512crypt.c +++ b/lib/libntp/a_md512crypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: a_md512crypt.c,v 1.3 1998/01/09 03:15:47 perry Exp $ */ +/* $NetBSD: a_md512crypt.c,v 1.4 1998/03/06 18:17:12 christos Exp $ */ /* * md5crypt - MD5 based authentication routines @@ -9,7 +9,7 @@ #include "md5.h" #include "ntp_stdlib.h" -extern u_long cache_keyid; +extern u_int32 cache_keyid; extern char *cache_key; extern int cache_keylen; @@ -46,7 +46,7 @@ static MD5_CTX ctx; void MD5auth1crypt(keyno, pkt, length) - u_long keyno; + u_int32 keyno; u_int32 *pkt; int length; /* length of all encrypted data */ { @@ -72,11 +72,13 @@ MD5auth1crypt(keyno, pkt, length) */ int MD5auth2crypt(keyno, pkt, length) - u_long keyno; + u_int32 keyno; u_int32 *pkt; int length; /* total length of encrypted area */ { - u_char hash[16]; +#ifdef __NetBSD__ + unsigned char hash[16]; +#endif /* * Don't bother checking the keys. The first stage would have * handled that. Finish up the generation by also including the @@ -84,10 +86,18 @@ MD5auth2crypt(keyno, pkt, length) */ MD5Update(&ctx, (unsigned const char *)(pkt) + length - 8, 8); +#ifdef __NetBSD__ MD5Final(hash, &ctx); +#else + MD5Final(&ctx); +#endif memmove((char *) &pkt[NOCRYPT_int32S + length/sizeof(u_int32)], - (char *) hash, +#ifdef __NetBSD__ + (char *) hash, +#else + (char *) ctx.digest, +#endif BLOCK_OCTETS); return (4 + BLOCK_OCTETS); } diff --git a/lib/libntp/a_md5decrypt.c b/lib/libntp/a_md5decrypt.c index 72807eedc3f5..8afd170255a9 100644 --- a/lib/libntp/a_md5decrypt.c +++ b/lib/libntp/a_md5decrypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: a_md5decrypt.c,v 1.3 1998/01/09 03:15:48 perry Exp $ */ +/* $NetBSD: a_md5decrypt.c,v 1.4 1998/03/06 18:17:12 christos Exp $ */ /* * md5crypt - MD5 based authentication routines @@ -9,7 +9,7 @@ #include "md5.h" #include "ntp_stdlib.h" -extern u_long cache_keyid; +extern u_int32 cache_keyid; extern char *cache_key; extern int cache_keylen; @@ -36,12 +36,14 @@ extern u_int32 authnokey; int MD5authdecrypt(keyno, pkt, length) - u_long keyno; + u_int32 keyno; const u_int32 *pkt; int length; /* length of variable data in octets */ { MD5_CTX ctx; - char hash[16]; +#ifdef __NetBSD__ + unsigned char hash[16]; +#endif authdecryptions++; @@ -54,9 +56,18 @@ MD5authdecrypt(keyno, pkt, length) MD5Init(&ctx); MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen); MD5Update(&ctx, (unsigned const char *)pkt, length); +#ifdef __NetBSD__ MD5Final(hash, &ctx); +#else + MD5Final(&ctx); +#endif - return (!memcmp((char *) hash, - (char *)pkt + length + 4, + return (!memcmp( +#ifdef __NetBSD__ + (const char *) hash, +#else + (const char *) ctx.digest, +#endif + (const char *)pkt + length + 4, BLOCK_OCTETS)); } diff --git a/lib/libntp/a_md5encrypt.c b/lib/libntp/a_md5encrypt.c index a8cceb63d708..e6869b20fd33 100644 --- a/lib/libntp/a_md5encrypt.c +++ b/lib/libntp/a_md5encrypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: a_md5encrypt.c,v 1.3 1998/01/09 03:15:49 perry Exp $ */ +/* $NetBSD: a_md5encrypt.c,v 1.4 1998/03/06 18:17:12 christos Exp $ */ /* * md5crypt - MD5 based authentication routines @@ -9,7 +9,7 @@ #include "md5.h" #include "ntp_stdlib.h" -extern u_long cache_keyid; +extern u_int32 cache_keyid; extern char *cache_key; extern int cache_keylen; @@ -41,13 +41,15 @@ extern u_int32 authnokey; int MD5authencrypt(keyno, pkt, length) - u_long keyno; + u_int32 keyno; u_int32 *pkt; int length; /* length of encrypted portion of packet */ { MD5_CTX ctx; - u_char hash[16]; int len; /* in 4 byte quantities */ +#ifdef __NetBSD__ + unsigned char hash[16]; +#endif authencryptions++; @@ -67,10 +69,18 @@ MD5authencrypt(keyno, pkt, length) MD5Init(&ctx); MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen); MD5Update(&ctx, (unsigned const char *)pkt, length); +#ifdef __NetBSD__ MD5Final(hash, &ctx); +#else + MD5Final(&ctx); +#endif memmove((char *)&pkt[NOCRYPT_int32S + len], +#ifdef __NetBSD__ (char *) hash, +#else + (char *) ctx.digest, +#endif BLOCK_OCTETS); return (4 + BLOCK_OCTETS); /* return size of key and MAC */ }