aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/util
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2024-05-27 01:41:22 +0000
committerCy Schubert <cy@FreeBSD.org>2024-05-30 01:42:54 +0000
commit6f3fd5d45e98738a3035abc2d179d457f29bc541 (patch)
tree09dadd026116ac7ee639b6382d0fd92ebf4ce4ac /contrib/ntp/util
parent4010c267a55c5bdb8f752f023d147de3021f9d75 (diff)
ntp: Vendor import of ntp-4.2.8p18
Merge commit '1f833b3fc9968c3dd7ed79ccf0525ebf16c891ad' into main (cherry picked from commit f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
Diffstat (limited to 'contrib/ntp/util')
-rw-r--r--contrib/ntp/util/Makefile.am4
-rw-r--r--contrib/ntp/util/Makefile.in62
-rw-r--r--contrib/ntp/util/invoke-ntp-keygen.texi4
-rw-r--r--contrib/ntp/util/lsf-times.c220
-rw-r--r--contrib/ntp/util/ntp-keygen-opts.c20
-rw-r--r--contrib/ntp/util/ntp-keygen-opts.h8
-rw-r--r--contrib/ntp/util/ntp-keygen.1ntp-keygenman6
-rw-r--r--contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc6
-rw-r--r--contrib/ntp/util/ntp-keygen.c55
-rw-r--r--contrib/ntp/util/ntp-keygen.html4
-rw-r--r--contrib/ntp/util/ntp-keygen.man.in6
-rw-r--r--contrib/ntp/util/ntp-keygen.mdoc.in6
12 files changed, 327 insertions, 74 deletions
diff --git a/contrib/ntp/util/Makefile.am b/contrib/ntp/util/Makefile.am
index cef623c592d0..db0e8e65d747 100644
--- a/contrib/ntp/util/Makefile.am
+++ b/contrib/ntp/util/Makefile.am
@@ -4,7 +4,8 @@ bin_PROGRAMS= $(NTP_KEYGEN_DB) $(NTPTIME_DB) $(TICKADJ_DB) $(TIMETRIM_DB)
libexec_PROGRAMS= $(NTP_KEYGEN_DL) $(NTPTIME_DL) $(TICKADJ_DL) $(TIMETRIM_DL)
sbin_PROGRAMS= $(NTP_KEYGEN_DS) $(NTPTIME_DS) $(TICKADJ_DS) $(TIMETRIM_DS)
-EXTRA_PROGRAMS= audio-pcm byteorder hist jitter kern longsize ntp-keygen \
+EXTRA_PROGRAMS= audio-pcm byteorder hist jitter kern longsize lsf-times \
+ ntp-keygen \
ntptime pps-api precision sht testrs6000 tg tg2 tickadj timetrim
AM_CFLAGS = $(CFLAGS_NTP)
@@ -32,6 +33,7 @@ tickadj_LDADD= ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS) $(LDAD
EXTRA_DIST= \
invoke-ntp-keygen.menu \
invoke-ntp-keygen.texi \
+ lsf-times.c \
ntp-keygen-opts.def \
ntp-keygen.1ntp-keygenman \
ntp-keygen.1ntp-keygenmdoc \
diff --git a/contrib/ntp/util/Makefile.in b/contrib/ntp/util/Makefile.in
index bfc308c6cc5f..f98e15193aa4 100644
--- a/contrib/ntp/util/Makefile.in
+++ b/contrib/ntp/util/Makefile.in
@@ -95,9 +95,11 @@ build_triplet = @build@
host_triplet = @host@
EXTRA_PROGRAMS = audio-pcm$(EXEEXT) byteorder$(EXEEXT) hist$(EXEEXT) \
jitter$(EXEEXT) kern$(EXEEXT) longsize$(EXEEXT) \
- ntp-keygen$(EXEEXT) ntptime$(EXEEXT) pps-api$(EXEEXT) \
- precision$(EXEEXT) sht$(EXEEXT) testrs6000$(EXEEXT) \
- tg$(EXEEXT) tg2$(EXEEXT) tickadj$(EXEEXT) timetrim$(EXEEXT)
+ lsf-times$(EXEEXT) ntp-keygen$(EXEEXT) ntptime$(EXEEXT) \
+ pps-api$(EXEEXT) precision$(EXEEXT) sht$(EXEEXT) \
+ testrs6000$(EXEEXT) tg$(EXEEXT) tg2$(EXEEXT) tickadj$(EXEEXT) \
+ timetrim$(EXEEXT)
+@LIBNTP_SUBMAKES_TRUE@am__append_1 = check-libntp
subdir = util
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
@@ -184,6 +186,11 @@ longsize_OBJECTS = longsize.$(OBJEXT)
longsize_LDADD = $(LDADD)
longsize_DEPENDENCIES = ../libntp/libntp.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+lsf_times_SOURCES = lsf-times.c
+lsf_times_OBJECTS = lsf-times.$(OBJEXT)
+lsf_times_LDADD = $(LDADD)
+lsf_times_DEPENDENCIES = ../libntp/libntp.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_ntp_keygen_OBJECTS = ntp-keygen.$(OBJEXT) ntp-keygen-opts.$(OBJEXT)
nodist_ntp_keygen_OBJECTS = version.$(OBJEXT)
ntp_keygen_OBJECTS = $(am_ntp_keygen_OBJECTS) \
@@ -254,12 +261,13 @@ am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/audio-pcm.Po \
./$(DEPDIR)/byteorder.Po ./$(DEPDIR)/hist.Po \
./$(DEPDIR)/jitter.Po ./$(DEPDIR)/kern.Po \
- ./$(DEPDIR)/longsize.Po ./$(DEPDIR)/ntp-keygen-opts.Po \
- ./$(DEPDIR)/ntp-keygen.Po ./$(DEPDIR)/ntptime.Po \
- ./$(DEPDIR)/pps-api.Po ./$(DEPDIR)/precision.Po \
- ./$(DEPDIR)/sht.Po ./$(DEPDIR)/testrs6000.Po ./$(DEPDIR)/tg.Po \
- ./$(DEPDIR)/tg2.Po ./$(DEPDIR)/tickadj.Po \
- ./$(DEPDIR)/timetrim.Po ./$(DEPDIR)/version.Po
+ ./$(DEPDIR)/longsize.Po ./$(DEPDIR)/lsf-times.Po \
+ ./$(DEPDIR)/ntp-keygen-opts.Po ./$(DEPDIR)/ntp-keygen.Po \
+ ./$(DEPDIR)/ntptime.Po ./$(DEPDIR)/pps-api.Po \
+ ./$(DEPDIR)/precision.Po ./$(DEPDIR)/sht.Po \
+ ./$(DEPDIR)/testrs6000.Po ./$(DEPDIR)/tg.Po ./$(DEPDIR)/tg2.Po \
+ ./$(DEPDIR)/tickadj.Po ./$(DEPDIR)/timetrim.Po \
+ ./$(DEPDIR)/version.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -280,12 +288,13 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = audio-pcm.c byteorder.c hist.c $(jitter_SOURCES) kern.c \
- longsize.c $(ntp_keygen_SOURCES) $(nodist_ntp_keygen_SOURCES) \
- ntptime.c pps-api.c precision.c sht.c testrs6000.c tg.c tg2.c \
- tickadj.c timetrim.c
+ longsize.c lsf-times.c $(ntp_keygen_SOURCES) \
+ $(nodist_ntp_keygen_SOURCES) ntptime.c pps-api.c precision.c \
+ sht.c testrs6000.c tg.c tg2.c tickadj.c timetrim.c
DIST_SOURCES = audio-pcm.c byteorder.c hist.c $(jitter_SOURCES) kern.c \
- longsize.c $(ntp_keygen_SOURCES) ntptime.c pps-api.c \
- precision.c sht.c testrs6000.c tg.c tg2.c tickadj.c timetrim.c
+ longsize.c lsf-times.c $(ntp_keygen_SOURCES) ntptime.c \
+ pps-api.c precision.c sht.c testrs6000.c tg.c tg2.c tickadj.c \
+ timetrim.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -513,6 +522,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_NET_SNMP_CONFIG = @PATH_NET_SNMP_CONFIG@
+PATH_OPENSSL = @PATH_OPENSSL@
PATH_PERL = @PATH_PERL@
PATH_RUBY = @PATH_RUBY@
PATH_SEPARATOR = @PATH_SEPARATOR@
@@ -632,6 +642,7 @@ tickadj_LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS) $(LDA
EXTRA_DIST = \
invoke-ntp-keygen.menu \
invoke-ntp-keygen.texi \
+ lsf-times.c \
ntp-keygen-opts.def \
ntp-keygen.1ntp-keygenman \
ntp-keygen.1ntp-keygenmdoc \
@@ -642,9 +653,9 @@ EXTRA_DIST = \
ntp-keygen.texi \
$(NULL)
-BUILT_SOURCES = ntp-keygen-opts.c ntp-keygen-opts.h check-libntp \
+BUILT_SOURCES = ntp-keygen-opts.c ntp-keygen-opts.h $(am__append_1) \
check-libopts .deps-ver
-CLEANFILES = .version version.c check-libntp check-libopts .deps-ver
+CLEANFILES = .version version.c check-libopts .deps-ver
DISTCLEANFILES = config.log $(man_MANS) $(DEPDIR)/deps-ver
html_DATA = \
$(srcdir)/ntp-keygen.html \
@@ -886,6 +897,10 @@ longsize$(EXEEXT): $(longsize_OBJECTS) $(longsize_DEPENDENCIES) $(EXTRA_longsize
@rm -f longsize$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(longsize_OBJECTS) $(longsize_LDADD) $(LIBS)
+lsf-times$(EXEEXT): $(lsf_times_OBJECTS) $(lsf_times_DEPENDENCIES) $(EXTRA_lsf_times_DEPENDENCIES)
+ @rm -f lsf-times$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(lsf_times_OBJECTS) $(lsf_times_LDADD) $(LIBS)
+
ntp-keygen$(EXEEXT): $(ntp_keygen_OBJECTS) $(ntp_keygen_DEPENDENCIES) $(EXTRA_ntp_keygen_DEPENDENCIES)
@rm -f ntp-keygen$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(ntp_keygen_OBJECTS) $(ntp_keygen_LDADD) $(LIBS)
@@ -938,6 +953,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jitter.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kern.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/longsize.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsf-times.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntp-keygen-opts.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntp-keygen.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntptime.Po@am__quote@ # am--include-marker
@@ -1233,6 +1249,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/jitter.Po
-rm -f ./$(DEPDIR)/kern.Po
-rm -f ./$(DEPDIR)/longsize.Po
+ -rm -f ./$(DEPDIR)/lsf-times.Po
-rm -f ./$(DEPDIR)/ntp-keygen-opts.Po
-rm -f ./$(DEPDIR)/ntp-keygen.Po
-rm -f ./$(DEPDIR)/ntptime.Po
@@ -1298,6 +1315,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/jitter.Po
-rm -f ./$(DEPDIR)/kern.Po
-rm -f ./$(DEPDIR)/longsize.Po
+ -rm -f ./$(DEPDIR)/lsf-times.Po
-rm -f ./$(DEPDIR)/ntp-keygen-opts.Po
-rm -f ./$(DEPDIR)/ntp-keygen.Po
-rm -f ./$(DEPDIR)/ntptime.Po
@@ -1418,11 +1436,10 @@ install-exec-hook:
#
-check-libntp: $(top_builddir)/libntp/libntp.a
- @: avoid default SCCS get by some make implementations
+.PHONY: check-libntp
-$(top_builddir)/libntp/libntp.a:
- cd $(top_builddir)/libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
+@LIBNTP_SUBMAKES_TRUE@check-libntp:
+@LIBNTP_SUBMAKES_TRUE@ cd $(top_builddir)/libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
check-libopts: ../sntp/libopts/libopts.la
@echo stamp > $@
@@ -1432,10 +1449,9 @@ check-libopts: ../sntp/libopts/libopts.la
$(top_srcdir)/sntp/scm-rev: FRC.scm-rev
$(AM_V_GEN)cd $(top_builddir)/sntp && $(MAKE) $(AM_MAKEFLAGS) check-scm-rev
+.PHONY: FRC.scm-rev
FRC.scm-rev:
- @: FRC.scm-rev "force" depends on nothing and is not a file, so is \
- always out-of-date causing targets which depend on it to also \
- be outdated so their rules to fire each time they are built.
+ @: FRC.scm-rev is always out of date, triggering the check every make invocation.
$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
@[ -f $@ ] || \
cp $(top_srcdir)/deps-ver $@
diff --git a/contrib/ntp/util/invoke-ntp-keygen.texi b/contrib/ntp/util/invoke-ntp-keygen.texi
index 2ee45b30970c..a4571231a4f6 100644
--- a/contrib/ntp/util/invoke-ntp-keygen.texi
+++ b/contrib/ntp/util/invoke-ntp-keygen.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp-keygen.texi)
#
-# It has been AutoGen-ed June 6, 2023 at 04:38:29 AM by AutoGen 5.18.16
+# It has been AutoGen-ed May 25, 2024 at 12:04:48 AM by AutoGen 5.18.16
# From the definitions ntp-keygen-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -1056,7 +1056,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p17
+ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p18
Usage: ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
Flg Arg Option-Name Description
-b Num imbits identity modulus bits
diff --git a/contrib/ntp/util/lsf-times.c b/contrib/ntp/util/lsf-times.c
new file mode 100644
index 000000000000..5b719e13360f
--- /dev/null
+++ b/contrib/ntp/util/lsf-times.c
@@ -0,0 +1,220 @@
+#include "config.h"
+#include "ntp_calendar.h"
+
+#include <stdlib.h>
+#include <errno.h>
+
+#include "ntp_types.h"
+#include "ntp_fp.h"
+#include "vint64ops.h"
+
+/*
+ * If we're called with 1 arg, it's a u_long timestamp.
+ * If we're called with 3 args, we're expecting YYYY MM DD,
+ * and MM must be 6 or 12, and DD must be 28,
+ * If we're called with 2 args, we're expecting YYYY MM, and
+ * MM mst be 6 or 12, and we assume DD is 28.
+ */
+
+char *progname;
+static const char *MONTHS[] =
+ { "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November",
+ "December" };
+
+void usage(void);
+
+void
+usage(void)
+{
+ printf("Usage:\n");
+ printf(" %s nnnnnn\n", progname);
+ printf(" %s YYYY [6|12]\n", progname);
+ printf(" %s YYYY [6|12] 28\n", progname);
+
+ return;
+}
+
+
+int
+main(
+ int argc, /* command line options */
+ char **argv /* poiniter to list of tokens */
+ )
+{
+ int err = 0;
+ vint64 expires;
+ unsigned int year = 0;
+ unsigned int mon = 0;
+ unsigned int dom = 0;
+ int scount;
+ char *ep;
+ struct calendar cal = {0};
+
+ progname = argv[0];
+
+ switch(argc) {
+ case 2: /* 1 arg, must be a string of digits */
+ expires = strtouv64(argv[1], &ep, 10);
+
+ if (0 == *ep) {
+ ntpcal_ntp64_to_date(&cal, &expires);
+
+ printf("%02u %s %04u %02u:%02u:%02u\n"
+ , cal.monthday
+ , MONTHS[cal.month - 1]
+ , cal.year
+ , cal.hour
+ , cal.minute
+ , cal.second
+ );
+
+ exit(0);
+ } else {
+ printf("1 arg, but not a string of digits: <%s>\n",
+ argv[1]);
+ err = 1;
+ }
+ break;
+ ;;
+ case 3: /* 2 args, must be YY MM, where MM is 6 or 12 */
+ dom = 28;
+ scount = sscanf(argv[1], "%u", &year);
+ if (1 == scount) {
+ // printf("2 args: year %u\n", year);
+ } else {
+ printf("2 args, but #1 is not a string of digits: <%s>\n", argv[1]);
+ err = 1;
+ }
+
+ scount = sscanf(argv[2], "%u", &mon);
+ if (1 == scount) {
+ if (6 == mon || 12 == mon) {
+ // printf("2 args: month %u\n", mon);
+ } else {
+ printf("2 arg, but #2 is not 6 or 12: <%d>\n", mon);
+ err = 1;
+ }
+ } else {
+ printf("2 arg, but #2 is not a string of digits: <%s>\n", argv[2]);
+ err = 1;
+ }
+
+ break;
+ ;;
+ case 4: /* 3 args, YY MM DD, where MM is 6 or 12, DD is 28 */
+ scount = sscanf(argv[1], "%u", &year);
+ if (1 == scount) {
+ // printf("3 args: year %u\n", year);
+ } else {
+ printf("3 args, but #1 is not a string of digits: <%s>\n", argv[1]);
+ err = 1;
+ }
+
+ scount = sscanf(argv[2], "%u", &mon);
+ if (1 == scount) {
+ if (6 == mon || 12 == mon) {
+ // printf("3 args: month %u\n", mon);
+ } else {
+ printf("3 arg, but #2 is not 6 or 12: <%d>\n", mon);
+ err = 1;
+ }
+ } else {
+ printf("3 arg, but #2 is not a string of digits: <%s>\n", argv[2]);
+ err = 1;
+ }
+
+ scount = sscanf(argv[3], "%u", &dom);
+ if (1 == scount) {
+ if (28 == dom) {
+ // printf("3 args: dom %u\n", dom);
+ } else {
+ printf("3 arg, but #3 is not 28: <%d>\n", dom);
+ err = 1;
+ }
+ } else {
+ printf("3 arg, but #3 is not a string of digits: <%s>\n", argv[2]);
+ err = 1;
+ }
+
+ break;
+ ;;
+ default:
+ err = 1;
+ break;
+ ;;
+ }
+
+ if (err) {
+ usage();
+ exit(err);
+ }
+
+ cal.year = year;
+ cal.month = mon;
+ cal.monthday = dom;
+ cal.hour = 0;
+ cal.minute = 0;
+ cal.second = 0;
+
+ printf("%u ", ntpcal_date_to_ntp(&cal));
+
+ printf("%02d %s %04d "
+ , cal.monthday
+ , MONTHS[cal.month - 1]
+ , cal.year
+ );
+ printf("\n");
+
+ exit(err);
+}
+
+#if 0
+
+
+void
+test_DateGivenMonthDay(void) {
+ // 2010-06-24 12:50:00
+ struct calendar input = {2010, 0, 6, 24, 12, 50, 0};
+
+ u_long expected = 3486372600UL; // This is the timestamp above.
+
+ TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input));
+}
+
+void
+test_DateGivenYearDay(void) {
+ // 2010-06-24 12:50:00
+ // This is the 175th day of 2010.
+ struct calendar input = {2010, 175, 0, 0, 12, 50, 0};
+
+ u_long expected = 3486372600UL; // This is the timestamp above.
+
+ TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input));
+}
+
+void
+test_DateLeapYear(void) {
+ // 2012-06-24 12:00:00
+ // This is the 176th day of 2012 (since 2012 is a leap year).
+ struct calendar inputYd = {2012, 176, 0, 0, 12, 00, 00};
+ struct calendar inputMd = {2012, 0, 6, 24, 12, 00, 00};
+
+ u_long expected = 3549528000UL;
+
+ TEST_ASSERT_EQUAL_UINT(expected, caltontp(&inputYd));
+ TEST_ASSERT_EQUAL_UINT(expected, caltontp(&inputMd));
+}
+
+void
+test_WraparoundDateIn2036(void) {
+ // 2036-02-07 06:28:16
+ // This is (one) wrapping boundary where we go from ULONG_MAX to 0.
+ struct calendar input = {2036, 0, 2, 7, 6, 28, 16};
+
+ u_long expected = 0UL;
+
+ TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input));
+}
+
+#endif
diff --git a/contrib/ntp/util/ntp-keygen-opts.c b/contrib/ntp/util/ntp-keygen-opts.c
index fb3c78fdff51..6d532651e3b2 100644
--- a/contrib/ntp/util/ntp-keygen-opts.c
+++ b/contrib/ntp/util/ntp-keygen-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
*
- * It has been AutoGen-ed June 6, 2023 at 04:38:24 AM by AutoGen 5.18.16
+ * It has been AutoGen-ed May 25, 2024 at 12:04:43 AM by AutoGen 5.18.16
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntp-keygen program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1992-2023 The University of Delaware and Network Time Foundation, all rights reserved.
+ * Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -76,8 +76,8 @@ extern FILE * option_usage_fp;
* static const strings for ntp-keygen options
*/
static char const ntp_keygen_opt_strs[2443] =
-/* 0 */ "ntp-keygen (ntp) 4.2.8p17\n"
- "Copyright (C) 1992-2023 The University of Delaware and Network Time Foundation, all rights reserved.\n"
+/* 0 */ "ntp-keygen (ntp) 4.2.8p18\n"
+ "Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
"can be seen at:\n"
@@ -169,14 +169,14 @@ static char const ntp_keygen_opt_strs[2443] =
/* 2223 */ "no-load-opts\0"
/* 2236 */ "no\0"
/* 2239 */ "NTP_KEYGEN\0"
-/* 2250 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p17\n"
+/* 2250 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p18\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
/* 2365 */ "$HOME\0"
/* 2371 */ ".\0"
/* 2373 */ ".ntprc\0"
/* 2380 */ "https://bugs.ntp.org, bugs@ntp.org\0"
/* 2415 */ "\n\0"
-/* 2417 */ "ntp-keygen (ntp) 4.2.8p17";
+/* 2417 */ "ntp-keygen (ntp) 4.2.8p18";
/**
* imbits option description:
@@ -1314,8 +1314,8 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntp_keygenOptions.pzCopyright */
- puts(_("ntp-keygen (ntp) 4.2.8p17\n\
-Copyright (C) 1992-2023 The University of Delaware and Network Time Foundation, all rights reserved.\n\
+ puts(_("ntp-keygen (ntp) 4.2.8p18\n\
+Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
can be seen at:\n"));
@@ -1413,14 +1413,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntp_keygenOptions.pzUsageTitle */
- puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p17\n\
+ puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p18\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
/* referenced via ntp_keygenOptions.pzExplain */
puts(_("\n"));
/* referenced via ntp_keygenOptions.pzFullVersion */
- puts(_("ntp-keygen (ntp) 4.2.8p17"));
+ puts(_("ntp-keygen (ntp) 4.2.8p18"));
/* referenced via ntp_keygenOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/util/ntp-keygen-opts.h b/contrib/ntp/util/ntp-keygen-opts.h
index 9e266d2b164f..a2cb606e0af2 100644
--- a/contrib/ntp/util/ntp-keygen-opts.h
+++ b/contrib/ntp/util/ntp-keygen-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h)
*
- * It has been AutoGen-ed June 6, 2023 at 04:38:23 AM by AutoGen 5.18.16
+ * It has been AutoGen-ed May 25, 2024 at 12:04:42 AM by AutoGen 5.18.16
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntp-keygen program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1992-2023 The University of Delaware and Network Time Foundation, all rights reserved.
+ * Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -102,9 +102,9 @@ typedef enum {
/** count of all options for ntp-keygen */
#define OPTION_CT 26
/** ntp-keygen version */
-#define NTP_KEYGEN_VERSION "4.2.8p17"
+#define NTP_KEYGEN_VERSION "4.2.8p18"
/** Full ntp-keygen version text */
-#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p17"
+#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p18"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/util/ntp-keygen.1ntp-keygenman b/contrib/ntp/util/ntp-keygen.1ntp-keygenman
index f96a7689b17c..23fb3e1dc5cd 100644
--- a/contrib/ntp/util/ntp-keygen.1ntp-keygenman
+++ b/contrib/ntp/util/ntp-keygen.1ntp-keygenman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-keygen 1ntp-keygenman "06 Jun 2023" "ntp (4.2.8p17)" "User Commands"
+.TH ntp-keygen 1ntp-keygenman "25 May 2024" "ntp (4.2.8p18)" "User Commands"
.\"
.\" EDIT THIS FILE WITH CAUTION (in-mem file)
.\"
-.\" It has been AutoGen-ed June 6, 2023 at 04:38:32 AM by AutoGen 5.18.16
+.\" It has been AutoGen-ed May 25, 2024 at 12:04:51 AM by AutoGen 5.18.16
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1351,7 +1351,7 @@ it to autogen-users@lists.sourceforge.net. Thank you.
.SH "AUTHORS"
The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1992-2023 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.SH BUGS
It can take quite a while to generate some cryptographic values.
diff --git a/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc b/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
index ce6b988d7670..9ac815e24657 100644
--- a/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
+++ b/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
@@ -1,9 +1,9 @@
-.Dd June 6 2023
+.Dd May 25 2024
.Dt NTP_KEYGEN 1ntp-keygenmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed June 6, 2023 at 04:38:27 AM by AutoGen 5.18.16
+.\" It has been AutoGen-ed May 25, 2024 at 12:04:46 AM by AutoGen 5.18.16
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -1208,7 +1208,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh "AUTHORS"
The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1992\-2023 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992\-2024 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.Sh BUGS
It can take quite a while to generate some cryptographic values.
diff --git a/contrib/ntp/util/ntp-keygen.c b/contrib/ntp/util/ntp-keygen.c
index ff9d6cad8980..c9c0ff9ef75f 100644
--- a/contrib/ntp/util/ntp-keygen.c
+++ b/contrib/ntp/util/ntp-keygen.c
@@ -409,11 +409,11 @@ main(
iffkey++;
if (HAVE_OPT( MV_PARAMS )) {
- mvkey++;
+ mvkey++; /* DLH are these two swapped? */
nkeys = OPT_VALUE_MV_PARAMS;
}
if (HAVE_OPT( MV_KEYS )) {
- mvpar++;
+ mvpar++; /* not used! */ /* DLH are these two swapped? */
nkeys = OPT_VALUE_MV_KEYS;
}
@@ -642,12 +642,13 @@ main(
}
}
if (pkey_gqkey != NULL) {
- RSA *rsa;
- const BIGNUM *q;
+ RSA *rsa;
+ const BIGNUM *q;
- rsa = EVP_PKEY_get0_RSA(pkey_gqkey);
+ rsa = EVP_PKEY_get1_RSA(pkey_gqkey);
RSA_get0_factors(rsa, NULL, &q);
grpkey = BN_bn2hex(q);
+ RSA_free(rsa);
}
/*
@@ -664,17 +665,19 @@ main(
filename);
fprintf(stdout, "# %s\n# %s\n", filename,
ctime(&epoch));
- /* XXX: This modifies the private key and should probably use a
- * copy of it instead. */
- rsa = EVP_PKEY_get0_RSA(pkey_gqkey);
+ rsa = EVP_PKEY_get1_RSA(pkey_gqkey);
RSA_set0_factors(rsa, BN_dup(BN_value_one()), BN_dup(BN_value_one()));
pkey = EVP_PKEY_new();
EVP_PKEY_assign_RSA(pkey, rsa);
PEM_write_PKCS8PrivateKey(stdout, pkey, NULL, NULL, 0,
NULL, NULL);
fflush(stdout);
- if (debug)
+ if (debug) {
RSA_print_fp(stderr, rsa, 0);
+ }
+ EVP_PKEY_free(pkey);
+ pkey = NULL;
+ RSA_free(rsa);
}
/*
@@ -689,14 +692,18 @@ main(
filename);
fprintf(stdout, "# %s\n# %s\n", filename,
ctime(&epoch));
- rsa = EVP_PKEY_get0_RSA(pkey_gqkey);
+ rsa = EVP_PKEY_get1_RSA(pkey_gqkey);
pkey = EVP_PKEY_new();
EVP_PKEY_assign_RSA(pkey, rsa);
PEM_write_PKCS8PrivateKey(stdout, pkey, cipher, NULL, 0,
NULL, passwd2);
fflush(stdout);
- if (debug)
+ if (debug) {
RSA_print_fp(stderr, rsa, 0);
+ }
+ EVP_PKEY_free(pkey);
+ pkey = NULL;
+ RSA_free(rsa);
}
/*
@@ -730,17 +737,19 @@ main(
filename);
fprintf(stdout, "# %s\n# %s\n", filename,
ctime(&epoch));
- /* XXX: This modifies the private key and should probably use a
- * copy of it instead. */
- dsa = EVP_PKEY_get0_DSA(pkey_iffkey);
+ dsa = EVP_PKEY_get1_DSA(pkey_iffkey);
DSA_set0_key(dsa, NULL, BN_dup(BN_value_one()));
pkey = EVP_PKEY_new();
EVP_PKEY_assign_DSA(pkey, dsa);
PEM_write_PKCS8PrivateKey(stdout, pkey, NULL, NULL, 0,
NULL, NULL);
fflush(stdout);
- if (debug)
+ if (debug) {
DSA_print_fp(stderr, dsa, 0);
+ }
+ EVP_PKEY_free(pkey);
+ pkey = NULL;
+ DSA_free(dsa);
}
/*
@@ -755,14 +764,18 @@ main(
filename);
fprintf(stdout, "# %s\n# %s\n", filename,
ctime(&epoch));
- dsa = EVP_PKEY_get0_DSA(pkey_iffkey);
+ dsa = EVP_PKEY_get1_DSA(pkey_iffkey);
pkey = EVP_PKEY_new();
EVP_PKEY_assign_DSA(pkey, dsa);
PEM_write_PKCS8PrivateKey(stdout, pkey, cipher, NULL, 0,
NULL, passwd2);
fflush(stdout);
- if (debug)
+ if (debug) {
DSA_print_fp(stderr, dsa, 0);
+ }
+ EVP_PKEY_free(pkey);
+ pkey = NULL;
+ DSA_free(dsa);
}
/*
@@ -799,8 +812,9 @@ main(
PEM_write_PKCS8PrivateKey(stdout, pkey, NULL, NULL, 0,
NULL, NULL);
fflush(stdout);
- if (debug)
+ if (debug) {
DSA_print_fp(stderr, EVP_PKEY_get0_DSA(pkey), 0);
+ }
}
/*
@@ -817,8 +831,9 @@ main(
PEM_write_PKCS8PrivateKey(stdout, pkey, cipher, NULL, 0,
NULL, passwd2);
fflush(stdout);
- if (debug)
+ if (debug) {
DSA_print_fp(stderr, EVP_PKEY_get0_DSA(pkey), 0);
+ }
}
/*
@@ -830,7 +845,7 @@ main(
fprintf(stderr,
"Invalid digest/signature combination %s\n",
scheme);
- exit (-1);
+ exit (-1);
}
x509(pkey_sign, ectx, grpkey, exten, certname);
#endif /* AUTOKEY */
diff --git a/contrib/ntp/util/ntp-keygen.html b/contrib/ntp/util/ntp-keygen.html
index 0d16b09b5b46..4027f108af31 100644
--- a/contrib/ntp/util/ntp-keygen.html
+++ b/contrib/ntp/util/ntp-keygen.html
@@ -84,7 +84,7 @@ All other files are in PEM-encoded
printable ASCII format so they can be embedded as MIME attachments in
mail to other sites.
</p>
-<p>This document applies to version 4.2.8p17 of <code>ntp-keygen</code>.
+<p>This document applies to version 4.2.8p18 of <code>ntp-keygen</code>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Description" accesskey="1">Description</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
@@ -1380,7 +1380,7 @@ used to select the program, defaulting to <samp>more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
-<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p17
+<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p18
Usage: ntp-keygen [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
Flg Arg Option-Name Description
-b Num imbits identity modulus bits
diff --git a/contrib/ntp/util/ntp-keygen.man.in b/contrib/ntp/util/ntp-keygen.man.in
index 1495530155b6..284d52409bcb 100644
--- a/contrib/ntp/util/ntp-keygen.man.in
+++ b/contrib/ntp/util/ntp-keygen.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-keygen @NTP_KEYGEN_MS@ "06 Jun 2023" "ntp (4.2.8p17)" "User Commands"
+.TH ntp-keygen @NTP_KEYGEN_MS@ "25 May 2024" "ntp (4.2.8p18)" "User Commands"
.\"
.\" EDIT THIS FILE WITH CAUTION (in-mem file)
.\"
-.\" It has been AutoGen-ed June 6, 2023 at 04:38:32 AM by AutoGen 5.18.16
+.\" It has been AutoGen-ed May 25, 2024 at 12:04:51 AM by AutoGen 5.18.16
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1351,7 +1351,7 @@ it to autogen-users@lists.sourceforge.net. Thank you.
.SH "AUTHORS"
The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1992-2023 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.SH BUGS
It can take quite a while to generate some cryptographic values.
diff --git a/contrib/ntp/util/ntp-keygen.mdoc.in b/contrib/ntp/util/ntp-keygen.mdoc.in
index 44b1954cc648..c0feb670e118 100644
--- a/contrib/ntp/util/ntp-keygen.mdoc.in
+++ b/contrib/ntp/util/ntp-keygen.mdoc.in
@@ -1,9 +1,9 @@
-.Dd June 6 2023
+.Dd May 25 2024
.Dt NTP_KEYGEN @NTP_KEYGEN_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed June 6, 2023 at 04:38:27 AM by AutoGen 5.18.16
+.\" It has been AutoGen-ed May 25, 2024 at 12:04:46 AM by AutoGen 5.18.16
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -1208,7 +1208,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh "AUTHORS"
The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1992\-2023 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992\-2024 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.Sh BUGS
It can take quite a while to generate some cryptographic values.