Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/ntp Fix MKCRYPTO=no build
details: https://anonhg.NetBSD.org/src/rev/6235889cb44d
branches: trunk
changeset: 346156:6235889cb44d
user: christos <christos%NetBSD.org@localhost>
date: Wed Jun 29 18:42:17 2016 +0000
description:
Fix MKCRYPTO=no build
diffstat:
external/bsd/ntp/Makefile.inc | 4 ++--
external/bsd/ntp/dist/include/ntp_md5.h | 8 ++++----
external/bsd/ntp/dist/libntp/a_md5encrypt.c | 16 +++-------------
external/bsd/ntp/dist/ntpd/ntp_control.c | 8 ++++++--
external/bsd/ntp/dist/ntpd/ntp_proto.c | 4 ++--
external/bsd/ntp/dist/sntp/crypto.c | 6 ++++--
external/bsd/ntp/include/config.h | 6 ++++--
7 files changed, 25 insertions(+), 27 deletions(-)
diffs (198 lines):
diff -r ae5608ad88f2 -r 6235889cb44d external/bsd/ntp/Makefile.inc
--- a/external/bsd/ntp/Makefile.inc Wed Jun 29 17:52:28 2016 +0000
+++ b/external/bsd/ntp/Makefile.inc Wed Jun 29 18:42:17 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.15 2014/12/23 19:11:14 christos Exp $
+# $NetBSD: Makefile.inc,v 1.16 2016/06/29 18:42:17 christos Exp $
.if !defined(NTP_MAKEFILE_INC)
NTP_MAKEFILE_INC=yes
@@ -58,7 +58,7 @@
.endif # defined(PROG)
.if ${MKCRYPTO:Uno} != "no"
-CPPFLAGS+=-DOPENSSL
+CPPFLAGS+=-DOPENSSL -DAUTOKEY -DUSE_OPENSSL_CRYPTO_RAND
.endif
.if ${MKINET6:Uno} != "no"
diff -r ae5608ad88f2 -r 6235889cb44d external/bsd/ntp/dist/include/ntp_md5.h
--- a/external/bsd/ntp/dist/include/ntp_md5.h Wed Jun 29 17:52:28 2016 +0000
+++ b/external/bsd/ntp/dist/include/ntp_md5.h Wed Jun 29 18:42:17 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_md5.h,v 1.5 2016/01/08 21:35:35 christos Exp $ */
+/* $NetBSD: ntp_md5.h,v 1.6 2016/06/29 18:42:17 christos Exp $ */
/*
* ntp_md5.h: deal with md5.h headers
@@ -25,12 +25,12 @@
# endif
typedef MD5_CTX EVP_MD_CTX;
-# define EVP_get_digestbynid(t) NULL
+# define EVP_get_digestbynid(t) ((t) ? NULL : NULL)
# define EVP_md5() NULL
# define EVP_MD_CTX_init(c)
# define EVP_MD_CTX_set_flags(c, f)
-# define EVP_DigestInit(c, dt) (MD5Init(c), 1)
-# define EVP_DigestInit_ex(c, dt, i) (MD5Init(c), 1)
+# define EVP_DigestInit(c, dt) (MD5Init(c), (dt ? 1 : 1))
+# define EVP_DigestInit_ex(c, dt, i) (MD5Init(c), (dt ? 1 : 1))
# define EVP_DigestUpdate(c, p, s) MD5Update(c, (const void *)(p), \
s)
# define EVP_DigestFinal(c, d, pdl) \
diff -r ae5608ad88f2 -r 6235889cb44d external/bsd/ntp/dist/libntp/a_md5encrypt.c
--- a/external/bsd/ntp/dist/libntp/a_md5encrypt.c Wed Jun 29 17:52:28 2016 +0000
+++ b/external/bsd/ntp/dist/libntp/a_md5encrypt.c Wed Jun 29 18:42:17 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: a_md5encrypt.c,v 1.5 2016/05/01 23:32:00 christos Exp $ */
+/* $NetBSD: a_md5encrypt.c,v 1.6 2016/06/29 18:42:17 christos Exp $ */
/*
* digest support for NTP, MD5 and with OpenSSL more
@@ -36,15 +36,11 @@
* was creaded.
*/
INIT_SSL();
-#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x0090700fL
if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(type))) {
msyslog(LOG_ERR,
"MAC encrypt: digest init failed");
return (0);
}
-#else
- EVP_DigestInit(&ctx, EVP_get_digestbynid(type));
-#endif
EVP_DigestUpdate(&ctx, key, cache_secretsize);
EVP_DigestUpdate(&ctx, (u_char *)pkt, length);
EVP_DigestFinal(&ctx, digest, &len);
@@ -77,15 +73,11 @@
* was created.
*/
INIT_SSL();
-#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x0090700fL
if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(type))) {
msyslog(LOG_ERR,
"MAC decrypt: digest init failed");
return (0);
}
-#else
- EVP_DigestInit(&ctx, EVP_get_digestbynid(type));
-#endif
EVP_DigestUpdate(&ctx, key, cache_secretsize);
EVP_DigestUpdate(&ctx, (u_char *)pkt, length);
EVP_DigestFinal(&ctx, digest, &len);
@@ -122,14 +114,12 @@
/* MD5 is not used as a crypto hash here. */
EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
#endif
- if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) {
+#endif
+ if (!EVP_DigestInit(&ctx, EVP_md5())) {
msyslog(LOG_ERR,
"MD5 init failed");
exit(1);
}
-#else
- EVP_DigestInit(&ctx, EVP_md5());
-#endif
EVP_DigestUpdate(&ctx, (u_char *)PSOCK_ADDR6(addr),
sizeof(struct in6_addr));
diff -r ae5608ad88f2 -r 6235889cb44d external/bsd/ntp/dist/ntpd/ntp_control.c
--- a/external/bsd/ntp/dist/ntpd/ntp_control.c Wed Jun 29 17:52:28 2016 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_control.c Wed Jun 29 18:42:17 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_control.c,v 1.16 2016/05/01 23:32:00 christos Exp $ */
+/* $NetBSD: ntp_control.c,v 1.17 2016/06/29 18:42:17 christos Exp $ */
/*
* ntp_control.c - respond to mode 6 control messages and send async
@@ -1653,6 +1653,7 @@
ctl_putdata(buffer, (unsigned)( cp - buffer ), 0);
}
+#ifdef AUTOKEY
/*
* ctl_putcal - write a decoded calendar data into the response
*/
@@ -1679,6 +1680,7 @@
return;
}
+#endif
/*
* ctl_putfs - write a decoded filestamp into the response
@@ -3662,7 +3664,9 @@
last_salt_update = current_time;
}
- EVP_DigestInit(&ctx, EVP_get_digestbynid(NID_md5));
+ if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(NID_md5))) {
+ msyslog(LOG_NOTICE, "Error in EVP_DigestInit");
+ }
EVP_DigestUpdate(&ctx, salt, sizeof(salt));
EVP_DigestUpdate(&ctx, &ts_i, sizeof(ts_i));
EVP_DigestUpdate(&ctx, &ts_f, sizeof(ts_f));
diff -r ae5608ad88f2 -r 6235889cb44d external/bsd/ntp/dist/ntpd/ntp_proto.c
--- a/external/bsd/ntp/dist/ntpd/ntp_proto.c Wed Jun 29 17:52:28 2016 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_proto.c Wed Jun 29 18:42:17 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_proto.c,v 1.12 2016/06/03 20:39:02 christos Exp $ */
+/* $NetBSD: ntp_proto.c,v 1.13 2016/06/29 18:42:17 christos Exp $ */
/*
* ntp_proto.c - NTP version 4 protocol machinery
@@ -3976,7 +3976,7 @@
ntoa(&peer->srcadr), peer->hmode, xkeyid, sendlen,
peer->keynumber));
#else /* !AUTOKEY follows */
- DPRINTF(1, ("peer_xmit: at %ld %s->%s mode %d keyid %08x len %d\n",
+ DPRINTF(1, ("peer_xmit: at %ld %s->%s mode %d keyid %08x len %zu\n",
current_time, peer->dstadr ?
ntoa(&peer->dstadr->sin) : "-",
ntoa(&peer->srcadr), peer->hmode, xkeyid, sendlen));
diff -r ae5608ad88f2 -r 6235889cb44d external/bsd/ntp/dist/sntp/crypto.c
--- a/external/bsd/ntp/dist/sntp/crypto.c Wed Jun 29 17:52:28 2016 +0000
+++ b/external/bsd/ntp/dist/sntp/crypto.c Wed Jun 29 18:42:17 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crypto.c,v 1.10 2016/05/01 23:32:01 christos Exp $ */
+/* $NetBSD: crypto.c,v 1.11 2016/06/29 18:42:17 christos Exp $ */
#include <config.h>
#include "crypto.h"
@@ -28,7 +28,9 @@
INIT_SSL();
key_type = keytype_from_text(cmp_key->type, NULL);
- EVP_DigestInit(&ctx, EVP_get_digestbynid(key_type));
+ if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(key_type))) {
+ msyslog(LOG_DEBUG, "EVP_DigestInit failed");
+ }
EVP_DigestUpdate(&ctx, (const u_char *)cmp_key->key_seq, (u_int)cmp_key->key_len);
EVP_DigestUpdate(&ctx, pkt_data, (u_int)pkt_size);
EVP_DigestFinal(&ctx, digest, &len);
diff -r ae5608ad88f2 -r 6235889cb44d external/bsd/ntp/include/config.h
--- a/external/bsd/ntp/include/config.h Wed Jun 29 17:52:28 2016 +0000
+++ b/external/bsd/ntp/include/config.h Wed Jun 29 18:42:17 2016 +0000
@@ -8,7 +8,8 @@
/* #undef ADJTIME_IS_ACCURATE */
/* Support NTP Autokey protocol? */
-#define AUTOKEY 1
+/* in the Makefile */
+/* #undef AUTOKEY */
/* why not HAVE_P_S? */
/* #undef CALL_PTHREAD_SETCONCURRENCY */
@@ -1611,7 +1612,8 @@
/* #undef USE_FSETOWNCTTY */
/* Use OpenSSL's crypto random functions */
-#define USE_OPENSSL_CRYPTO_RAND 1
+/* In Makefile */
+/* #undef USE_OPENSSL_CRYPTO_RAND */
/* OK to use snprintb()? */
#define USE_SNPRINTB 1
Home |
Main Index |
Thread Index |
Old Index