Remove configure support for ISC UNIX ca. 1998.
Move NTP_OPENSSL and NTP_CRYPTO_RAND invocations from configure.ac files
to NTP_LIBNTP.
Move ENABLE_CMAC to ntp_openssl.m4, enabling sntp/tests CMAC unit tests.
Remove dead code: HAVE_U_INT32_ONLY_WITH_DNS.
Eliminate [v]snprintf redefinition warnings on macOS.
Fix clang 14 cast increases alignment warning on Linux.
Move ENABLE_CMAC to ntp_openssl.m4, reviving sntp/tests CMAC unit tests.
Use NTP_HARD_CPPFLAGS in libopts tearoff.
bk: 65d85c2dYeIoIL_Q7vglwfR09-t_Mg
* Provide ntpd thread names to debugger on Windows. <hart@ntp.org>
* Remove dead code libntp/numtohost.c and its unit tests. <hart@ntp.org>
* Remove class A, B, C IPv4 distinctions in netof(). <hart@ntp.org>
-* Use NONEMPTY_COMPILATION_UNIT in more conditionally-compiled files.
* Use @configure_input@ in various *.in files to include a comment that
the file is generated from another pointing to the *.in. <hart@ntp.org>
* Correct underquoting, indents in ntp_facilitynames.m4. <hart@ntp.org>
* Add configure --enable-verbose-ssl to trace SSL detection. <hart@ntp.org>
* Add build test coverage for --disable-saveconfig to flock-build script.
<hart@ntp.org>
+* Remove deprecated configure --with-arlib option. <hart@ntp.org>
+* Remove configure support for ISC UNIX ca. 1998. <hart@ntp.org>
+* Move NTP_OPENSSL and NTP_CRYPTO_RAND invocations from configure.ac files
+ to NTP_LIBNTP. <hart@ntp.org>
+* Move ENABLE_CMAC to ntp_openssl.m4, enabling sntp/tests CMAC unit tests.
+ <hart@ntp.org>
+* Remove dead code: HAVE_U_INT32_ONLY_WITH_DNS. <hart@ntp.org>
+* Eliminate [v]snprintf redefinition warnings on macOS. <hart@ntp.org>
+* Fix clang 14 cast increases alignment warning on Linux. <hart@ntp.org>
+* Move ENABLE_CMAC to ntp_openssl.m4, reviving sntp/tests CMAC unit tests.
+ <hart@ntp.org>
+* Use NTP_HARD_CPPFLAGS in libopts tearoff. <hart@ntp.org>
---
(4.2.8p17) 2023/06/06 Released by Harlan Stenn <stenn@ntp.org>
# the date YYYYMMDD optionally with -HHMM if there is more than one
# bump in a day.
-ntp_configure_cache_version=20240103
+ntp_configure_cache_version=20240218
# When the cache version of config.cache and configure do not
# match, NTP_CACHEVERSION will flush the cache.
NTP_LIBNTP
-AC_MSG_CHECKING([for deprecated --with-arlib])
-AC_ARG_WITH([arlib],
- AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
- [ans=$withval], [ans=no])
-AC_MSG_RESULT([$ans])
-
-case "$ans" in
- yes)
- AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included. In the future, --with-arlib will not be recognized.])
- ;;
-esac
-
dnl we need to check for cross compile tools for vxWorks here
AC_PROG_AWK
AS_UNSET([ac_cv_prog_AWK])
AC_PROG_MAKE_SET
AC_PROG_LN_S
-AC_ISC_POSIX
AC_PATH_PROG([PATH_PERL], [perl])
esac
AC_MSG_RESULT([$ans])
-NTP_OPENSSL
-
-AC_MSG_CHECKING([if we want to enable CMAC support])
-case "$ac_cv_header_openssl_cmac_h" in
- yes)
- AC_DEFINE([ENABLE_CMAC], [1], [Enable CMAC support?])
- ans="yes"
- ;;
- *) ans="no"
- ;;
-esac
-AC_MSG_RESULT([$ans])
-
-NTP_CRYPTO_RAND
-
-# if we are building Autokey (--with-autokey), by default Autokey is enabled
+# if we have crypto, by default Autokey is enabled
AC_ARG_ENABLE(
[autokey],
AS_HELP_STRING(
--- /dev/null
+/*
+ * ntp_c99_snprintf.h
+ *
+ * Included from config.h to deal with replacing [v]snprintf() on older
+ * systems. The #undef lines below cannot be directly in config.h as
+ * config.status modifies each #undef in config.h.in to either be a
+ * commented-out #undef or a functional #define. Here they are used
+ * to avoid redefinition warnings on systems such as macos ca. 2024
+ * where system headers define [v]snprintf as preprocessor macros.
+ *
+ * Do not include this file directly, leave it to config.h.
+ */
+
+#if !defined(_KERNEL) && !defined(PARSESTREAM)
+/*
+ * stdio.h must be included in config.h after _GNU_SOURCE is defined
+ * but before #define snprintf rpl_snprintf
+ */
+# include <stdio.h>
+#endif
+
+#ifdef HW_WANT_RPL_SNPRINTF
+# undef snprintf
+#endif
+#ifdef HW_WANT_RPL_VSNPRINTF
+# undef vsnprintf
+#endif
+
# include <netdb.h>
# endif
# include <resolv.h>
-# ifdef HAVE_INT32_ONLY_WITH_DNS
-# define HAVE_INT32
-# endif
-# ifdef HAVE_U_INT32_ONLY_WITH_DNS
-# define HAVE_U_INT32
-# endif
#endif
#include "ntp.h"
static void
process_routing_msgs(struct asyncio_reader *reader)
{
- static char * buffer;
+ static void * buffer;
static size_t buffsz = 8192;
int cnt, new, msg_type;
socklen_t len;
* process routing message
*/
#ifdef HAVE_RTNETLINK
- for (nh = UA_PTR(struct nlmsghdr, buffer);
- NLMSG_OK(nh, cnt);
- nh = NLMSG_NEXT(nh, cnt))
+ for (nh = buffer; NLMSG_OK(nh, cnt); nh = NLMSG_NEXT(nh, cnt))
{
msg_type = nh->nlmsg_type;
#else
return;
}
msg_type = rtm.rtm_type;
-#endif
+#endif /* !HAVE_RTNETLINK */
switch (msg_type) {
#ifdef RTM_NEWADDR
case RTM_NEWADDR:
# the date YYYYMMDD optionally with -HHMM if there is more than one
# bump in a day.
-sntp_configure_cache_version=20240103
+sntp_configure_cache_version=20240218
# When the version of config.cache and configure do not
# match, NTP_CACHEVERSION will flush the cache.
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
-NTP_OPENSSL
NTP_IPV6
###
noinst_LTLIBRARIES = libopts.la
endif
libopts_la_SOURCES = libopts.c
-libopts_la_CPPFLAGS = -I$(srcdir)
libopts_la_LDFLAGS = -version-info 42:1:17
EXTRA_DIST =
MOSTLYCLEANFILES =
AM_CFLAGS = $(NTP_HARD_CFLAGS) $(CC_NOFORMAT)
-AM_CPPFLAGS = $(NTP_HARD_CPPFLAGS)
-AM_LDFLAGS = $(NTP_HARD_LDFLAGS)
+AM_CPPFLAGS = $(NTP_HARD_CPPFLAGS) -I$(top_srcdir)/../include
libopts.c: $(BUILT_SOURCES)
@: do-nothing rule to avoid default SCCS get
AC_ARG_ENABLE(
[c99-snprintf],
[AS_HELP_STRING(
- [--enable-c99-snprintf],
+ [--enable-c99-snprintf],
[s use replacement printf family]
)],
[force_c99_snprintf=$enableval],
esac
AH_VERBATIM(
[snprinte],dnl sorted in config.h just before #define snprintf
- [
- #if !defined(_KERNEL) && !defined(PARSESTREAM)
- /*
- * stdio.h must be included after _GNU_SOURCE is defined
- * but before #define snprintf rpl_snprintf
- */
- # include <stdio.h>
- #endif
- ])
+ [#include "c99_snprintf.h"]
+ )
AH_BOTTOM([
#if !defined(_KERNEL) && !defined(PARSESTREAM)
# if defined(HW_WANT_RPL_VSNPRINTF)
#define HAVE_UINTPTR_T 1
#endif])
-case "$ac_cv_type_int32::$ac_cv_header_resolv_h" in
- no::yes)
- AC_CACHE_CHECK(
- [for int32 with DNS headers included],
- [ntp_cv_type_int32_with_dns],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_ARPA_NAMESER_H
- # include <arpa/nameser.h>
- #endif
- #include <resolv.h>
- ]],
- [[
- size_t cb = sizeof(int32);
- ]]
- )],
- [ntp_cv_type_int32_with_dns=yes],
- [ntp_cv_type_int32_with_dns=no]
- )]
- )
- case "$ntp_cv_type_int32_with_dns" in
- yes)
- AC_DEFINE([HAVE_INT32_ONLY_WITH_DNS], [1],
- [int32 type in DNS headers, not others.])
- esac
-esac
-
-case "$ac_cv_type_u_int32::$ac_cv_header_resolv_h" in
- no::yes)
- AC_CACHE_CHECK(
- [for u_int32 with DNS headers included],
- [ntp_cv_type_u_int32_with_dns],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_ARPA_NAMESER_H
- # include <arpa/nameser.h>
- #endif
- #include <resolv.h>
- ]],
- [[
- size_t cb = sizeof(u_int32);
- ]]
- )],
- [ntp_cv_type_u_int32_with_dns=yes],
- [ntp_cv_type_u_int32_with_dns=no]
- )]
- )
- case "$ntp_cv_type_u_int32_with_dns" in
- yes)
- AC_DEFINE([HAVE_U_INT32_ONLY_WITH_DNS], [1],
- [u_int32 type in DNS headers, not others.])
- esac
-esac
-
AC_CHECK_HEADERS(
[sys/timepps.h],
[],
dnl and rebuilding in a client subdir rather than the whole package.
AM_CONDITIONAL([LIBNTP_SUBMAKES], [test x"$enable_dependency_tracking" = x"yes"])
+NTP_OPENSSL
+NTP_CRYPTO_RAND
+
dnl add to LDADD_LIBNTP set by ntp_compiler.m4
LDADD_LIBNTP="$LDADD_LIBNTP $LIBS"
LIBS=$SAVED_LIBS
'')
dnl ### set ntp_ssl_libdir ###
+ dnl unconventional, using AC_CHECK_LIB repeatedly, clear cached result.
+ AS_UNSET([ac_cv_lib_crypto_EVP_MD_CTX_new])
AC_MSG_NOTICE([Searching for libcrypto without -L])
AC_CHECK_LIB(
[crypto],
case "$ntp_openssl" in
yes)
VER_SUFFIX=o
- AC_CHECK_HEADERS([openssl/cmac.h openssl/hmac.h])
+ AC_CHECK_HEADERS(
+ [openssl/cmac.h],
+ [ntp_enable_cmac=yes],
+ [ntp_enable_cmac=no]
+ )
+ case "$ntp_enable_cmac" in
+ yes)
+ AC_DEFINE([ENABLE_CMAC], [1], [Enable CMAC support?])
+ esac
AC_DEFINE([OPENSSL], [], [Use OpenSSL?])
dnl OpenSSL 3 deprecates a bunch of functions used by Autokey.
dnl Adapting our code to the bold new way is not a priority
AS_UNSET([NTPSSL_SAVED_CPPFLAGS])
AS_UNSET([NTPSSL_SAVED_LIBS])
AS_UNSET([NTPSSL_SAVED_LDFLAGS])
+AS_UNSET([ntp_enable_cmac])
AS_UNSET([ntp_use_Wstrict_prototypes])
AS_UNSET([ntp_openssl_from_pkg_config])
AS_UNSET([ntp_openssl_version])
memcpy(&md5.key_seq, "md5seq", md5.key_len);
strlcpy(md5.typen, "MD5", sizeof(md5.typen));
md5.typei = keytype_from_text(md5.typen, NULL);
-
+
TEST_ASSERT_EQUAL(MD5_LENGTH,
make_mac(PKT_DATA, PKT_LEN, MD5_LENGTH, &md5, actual));
make_mac(PKT_DATA, PKT_LEN, SHA1_LENGTH, &sha1, actual));
TEST_ASSERT_EQUAL_MEMORY(EXPECTED_DIGEST, actual, SHA1_LENGTH);
-
+
#else
-
+
TEST_IGNORE_MESSAGE("OpenSSL not found, skipping...");
-
+
#endif /* OPENSSL */
}
"\xdd\x35\xd5\xf5\x14\x23\xd9\xd6"
"\x38\x5d\x29\x80\xfe\x51\xb9\x6b";
char actual[CMAC_LENGTH];
-
struct key cmac;
+
cmac.next = NULL;
cmac.key_id = 30;
cmac.key_len = CMAC_LENGTH;
make_mac(PKT_DATA, PKT_LEN, CMAC_LENGTH, &cmac, actual));
TEST_ASSERT_EQUAL_MEMORY(EXPECTED_DIGEST, actual, CMAC_LENGTH);
-
+
#else
-
- TEST_IGNORE_MESSAGE("OpenSSL not found, skipping...");
-
+
+ TEST_IGNORE_MESSAGE("CMAC not enabled, skipping...");
+
#endif /* OPENSSL */
}
"\xc7\x58\x99\xdd\x99\x32\x0f\x71" /* MAC */
"\x2b\x7b\xfe\x4f\xa2\x32\xcf\xac";
const int PKT_LEN = 12;
-
struct key md5;
+
md5.next = NULL;
md5.key_id = 0;
md5.key_len = 6;
"\xad\x07\xde\x36\x39\xa6\x77\xfa\x5b\xce" /* MAC */
"\x2d\x8a\x7d\x06\x96\xe6\x0c\xbc\xed\xe1";
const int PKT_LEN = 12;
-
struct key sha1;
+
sha1.next = NULL;
sha1.key_id = 0;
sha1.key_len = 7;
memcpy(&sha1.key_seq, "sha1key", sha1.key_len);
- strlcpy(sha1.typen, "SHA1", sizeof(sha1.typen));
+ strlcpy(sha1.typen, "SHA1", sizeof(sha1.typen));
sha1.typei = keytype_from_text(sha1.typen, NULL);
TEST_ASSERT_TRUE(auth_md5(PKT_DATA, PKT_LEN, SHA1_LENGTH, &sha1));
-
+
#else
-
+
TEST_IGNORE_MESSAGE("OpenSSL not found, skipping...");
-
+
#endif /* OPENSSL */
}
TEST_IGNORE_MESSAGE("VerifyOpenSSLCMAC needs to be implemented, skipping...");
#else
-
- TEST_IGNORE_MESSAGE("OpenSSL not found, skipping...");
-
+
+ TEST_IGNORE_MESSAGE("CMAC not enabled, skipping...");
+
#endif /* OPENSSL */
return;
}
"\xc7\x58\x99\xdd\x99\x32\x0f\x71" /* MAC */
"\x2b\x7b\xfe\x4f\xa2\x32\xcf\x00"; /* Last byte is wrong! */
const int PKT_LEN = 12;
-
struct key md5;
+
md5.next = NULL;
md5.key_id = 0;
md5.key_len = 6;
const char* PKT_DATA = "123456";
const int PKT_LEN = 6;
char actual[MD5_LENGTH];
-
struct key md5;
+
md5.next = NULL;
md5.key_id = 10;
md5.key_len = 6;
#else
- TEST_IGNORE_MESSAGE("OpenSSL CMAC not used, skipping...");
+ TEST_IGNORE_MESSAGE("CMAC not enabled, skipping...");
#endif /* OPENSSL */
}
progname = argv[0];
suite_setup();
UnityBegin("packetProcessing.c");
- RUN_TEST(test_TooShortLength, 23);
- RUN_TEST(test_LengthNotMultipleOfFour, 24);
- RUN_TEST(test_TooShortExtensionFieldLength, 25);
- RUN_TEST(test_UnauthenticatedPacketReject, 26);
- RUN_TEST(test_CryptoNAKPacketReject, 27);
- RUN_TEST(test_AuthenticatedPacketInvalid, 28);
- RUN_TEST(test_AuthenticatedPacketUnknownKey, 29);
- RUN_TEST(test_ServerVersionTooOld, 30);
- RUN_TEST(test_ServerVersionTooNew, 31);
- RUN_TEST(test_NonWantedMode, 32);
- RUN_TEST(test_KoDRate, 33);
- RUN_TEST(test_KoDDeny, 34);
- RUN_TEST(test_RejectUnsyncedServer, 35);
- RUN_TEST(test_RejectWrongResponseServerMode, 36);
- RUN_TEST(test_AcceptNoSentPacketBroadcastMode, 37);
- RUN_TEST(test_CorrectUnauthenticatedPacket, 38);
- RUN_TEST(test_CorrectAuthenticatedPacketMD5, 39);
- RUN_TEST(test_CorrectAuthenticatedPacketSHA1, 40);
- RUN_TEST(test_CorrectAuthenticatedPacketCMAC, 41);
+ RUN_TEST(test_TooShortLength, 21);
+ RUN_TEST(test_LengthNotMultipleOfFour, 22);
+ RUN_TEST(test_TooShortExtensionFieldLength, 23);
+ RUN_TEST(test_UnauthenticatedPacketReject, 24);
+ RUN_TEST(test_CryptoNAKPacketReject, 25);
+ RUN_TEST(test_AuthenticatedPacketInvalid, 26);
+ RUN_TEST(test_AuthenticatedPacketUnknownKey, 27);
+ RUN_TEST(test_ServerVersionTooOld, 28);
+ RUN_TEST(test_ServerVersionTooNew, 29);
+ RUN_TEST(test_NonWantedMode, 30);
+ RUN_TEST(test_KoDRate, 31);
+ RUN_TEST(test_KoDDeny, 32);
+ RUN_TEST(test_RejectUnsyncedServer, 33);
+ RUN_TEST(test_RejectWrongResponseServerMode, 34);
+ RUN_TEST(test_AcceptNoSentPacketBroadcastMode, 35);
+ RUN_TEST(test_CorrectUnauthenticatedPacket, 36);
+ RUN_TEST(test_CorrectAuthenticatedPacketMD5, 37);
+ RUN_TEST(test_CorrectAuthenticatedPacketSHA1, 38);
+ RUN_TEST(test_CorrectAuthenticatedPacketCMAC, 39);
return (UnityEnd());
}