summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/Makefile.am3
-rw-r--r--util/Makefile.in24
-rw-r--r--util/ansi2knr.136
-rw-r--r--util/ansi2knr.c739
-rw-r--r--util/invoke-ntp-keygen.texi4
-rw-r--r--util/jitter.c3
-rw-r--r--util/jitter.h401
-rw-r--r--util/ntp-keygen-opts.c368
-rw-r--r--util/ntp-keygen-opts.h10
-rw-r--r--util/ntp-keygen.1ntp-keygenman10
-rw-r--r--util/ntp-keygen.1ntp-keygenmdoc8
-rw-r--r--util/ntp-keygen.c89
-rw-r--r--util/ntp-keygen.html4
-rw-r--r--util/ntp-keygen.man.in10
-rw-r--r--util/ntp-keygen.mdoc.in8
-rw-r--r--util/ntptime.c9
16 files changed, 1069 insertions, 657 deletions
diff --git a/util/Makefile.am b/util/Makefile.am
index 4265e0b..8a47a3c 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -19,6 +19,7 @@ AM_LDFLAGS = $(LDFLAGS_NTP)
LDADD= ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
tg2_LDADD= ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
ntp_keygen_LDADD = version.o $(LIBOPTS_LDADD) ../libntp/libntp.a
+ntp_keygen_LDADD += $(LDADD_LIBEVENT)
ntp_keygen_LDADD += $(LDADD_LIBNTP) $(PTHREAD_LIBS) $(LDADD_NTP) $(LIBM)
ntp_keygen_SOURCES = ntp-keygen.c ntp-keygen-opts.c ntp-keygen-opts.h
@@ -111,7 +112,7 @@ $(srcdir)/ntp-keygen.html: $(srcdir)/ntp-keygen.texi $(top_srcdir)/sntp/include/
cd $(srcdir) && ( makeinfo --force --html --no-split -o ntp-keygen.html ntp-keygen.texi || true )
-jitter_SOURCES= jitter.c jitter.h
+jitter_SOURCES= jitter.c
jitter_LDADD=
kern.o: kern.c
diff --git a/util/Makefile.in b/util/Makefile.in
index 06293ac..f4fc712 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -47,13 +47,12 @@ EXTRA_PROGRAMS = audio-pcm$(EXEEXT) byteorder$(EXEEXT) hist$(EXEEXT) \
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/bincheck.mf $(top_srcdir)/check-libopts.mf \
$(top_srcdir)/depsver.mf $(top_srcdir)/includes.mf \
- $(top_srcdir)/sntp/check-libntp.mf
+ $(top_srcdir)/sntp/check-libntp.mf ansi2knr.1 ansi2knr.c
subdir = util
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/libopts/m4/stdnoreturn.m4 \
- $(top_srcdir)/sntp/libevent/m4/openldap-thread-check.m4 \
- $(top_srcdir)/sntp/libevent/m4/openldap.m4 \
+ $(top_srcdir)/sntp/m4/ax_c99_struct_init.m4 \
$(top_srcdir)/sntp/m4/define_dir.m4 \
$(top_srcdir)/sntp/m4/hms_search_lib.m4 \
$(top_srcdir)/sntp/m4/libtool.m4 \
@@ -64,6 +63,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_cacheversion.m4 \
$(top_srcdir)/sntp/m4/ntp_compiler.m4 \
$(top_srcdir)/sntp/m4/ntp_crosscompile.m4 \
+ $(top_srcdir)/sntp/m4/ntp_crypto_rand.m4 \
$(top_srcdir)/sntp/m4/ntp_debug.m4 \
$(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
$(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
@@ -81,6 +81,8 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
$(top_srcdir)/sntp/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/sntp/m4/ntp_vpathhack.m4 \
+ $(top_srcdir)/sntp/m4/openldap-thread-check.m4 \
+ $(top_srcdir)/sntp/m4/openldap.m4 \
$(top_srcdir)/sntp/m4/os_cflags.m4 \
$(top_srcdir)/sntp/m4/snprintf.m4 \
$(top_srcdir)/sntp/m4/version.m4 $(top_srcdir)/configure.ac
@@ -130,7 +132,8 @@ am_ntp_keygen_OBJECTS = ntp-keygen.$(OBJEXT) ntp-keygen-opts.$(OBJEXT)
ntp_keygen_OBJECTS = $(am_ntp_keygen_OBJECTS)
ntp_keygen_DEPENDENCIES = version.o $(am__DEPENDENCIES_1) \
../libntp/libntp.a $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
ntptime_SOURCES = ntptime.c
ntptime_OBJECTS = ntptime.$(OBJEXT)
ntptime_LDADD = $(LDADD)
@@ -258,6 +261,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -292,7 +296,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
@@ -431,6 +437,11 @@ TIMETRIM_DL = @TIMETRIM_DL@
TIMETRIM_DS = @TIMETRIM_DS@
TIMETRIM_MS = @TIMETRIM_MS@
TIMETRIM_NI = @TIMETRIM_NI@
+UPDATE_LEAP_DB = @UPDATE_LEAP_DB@
+UPDATE_LEAP_DL = @UPDATE_LEAP_DL@
+UPDATE_LEAP_DS = @UPDATE_LEAP_DS@
+UPDATE_LEAP_MS = @UPDATE_LEAP_MS@
+UPDATE_LEAP_NI = @UPDATE_LEAP_NI@
VERSION = @VERSION@
VER_SUFFIX = @VER_SUFFIX@
YACC = @YACC@
@@ -501,7 +512,8 @@ AM_LDFLAGS = $(LDFLAGS_NTP)
LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
tg2_LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
ntp_keygen_LDADD = version.o $(LIBOPTS_LDADD) ../libntp/libntp.a \
- $(LDADD_LIBNTP) $(PTHREAD_LIBS) $(LDADD_NTP) $(LIBM)
+ $(LDADD_LIBEVENT) $(LDADD_LIBNTP) $(PTHREAD_LIBS) $(LDADD_NTP) \
+ $(LIBM)
ntp_keygen_SOURCES = ntp-keygen.c ntp-keygen-opts.c ntp-keygen-opts.h
tickadj_LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS) $(LDADD_NLIST)
EXTRA_DIST = \
@@ -548,7 +560,7 @@ std_def_list = \
$(top_srcdir)/sntp/include/version.def \
$(NULL)
-jitter_SOURCES = jitter.c jitter.h
+jitter_SOURCES = jitter.c
jitter_LDADD =
NTP_INCS = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
-I$(top_srcdir)/lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/include \
diff --git a/util/ansi2knr.1 b/util/ansi2knr.1
new file mode 100644
index 0000000..f9ee5a6
--- /dev/null
+++ b/util/ansi2knr.1
@@ -0,0 +1,36 @@
+.TH ANSI2KNR 1 "19 Jan 1996"
+.SH NAME
+ansi2knr \- convert ANSI C to Kernighan & Ritchie C
+.SH SYNOPSIS
+.I ansi2knr
+[--varargs] input_file [output_file]
+.SH DESCRIPTION
+If no output_file is supplied, output goes to stdout.
+.br
+There are no error messages.
+.sp
+.I ansi2knr
+recognizes function definitions by seeing a non-keyword identifier at the left
+margin, followed by a left parenthesis, with a right parenthesis as the last
+character on the line, and with a left brace as the first token on the
+following line (ignoring possible intervening comments). It will recognize a
+multi-line header provided that no intervening line ends with a left or right
+brace or a semicolon. These algorithms ignore whitespace and comments, except
+that the function name must be the first thing on the line.
+.sp
+The following constructs will confuse it:
+.br
+ - Any other construct that starts at the left margin and follows the
+above syntax (such as a macro or function call).
+.br
+ - Some macros that tinker with the syntax of the function header.
+.sp
+The --varargs switch is obsolete, and is recognized only for
+backwards compatibility. The present version of
+.I ansi2knr
+will always attempt to convert a ... argument to va_alist and va_dcl.
+.SH AUTHOR
+L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
+continues to maintain the current version; most of the code in the current
+version is his work. ansi2knr also includes contributions by Francois
+Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
diff --git a/util/ansi2knr.c b/util/ansi2knr.c
new file mode 100644
index 0000000..a042674
--- /dev/null
+++ b/util/ansi2knr.c
@@ -0,0 +1,739 @@
+/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */
+
+/*$Id: ansi2knr.c,v 1.3 2000/04/13 03:41:48 lpd Exp $*/
+/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
+
+/*
+ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY. No author or distributor accepts responsibility to anyone for the
+consequences of using it or for whether it serves any particular purpose or
+works at all, unless he says so in writing. Refer to the GNU General Public
+License (the "GPL") for full details.
+
+Everyone is granted permission to copy, modify and redistribute ansi2knr,
+but only under the conditions described in the GPL. A copy of this license
+is supposed to have been given to you along with ansi2knr so you can know
+your rights and responsibilities. It should be in a file named COPYLEFT,
+or, if there is no file named COPYLEFT, a file named COPYING. Among other
+things, the copyright notice and this notice must be preserved on all
+copies.
+
+We explicitly state here what we believe is already implied by the GPL: if
+the ansi2knr program is distributed as a separate set of sources and a
+separate executable file which are aggregated on a storage medium together
+with another program, this in itself does not bring the other program under
+the GPL, nor does the mere fact that such a program or the procedures for
+constructing it invoke the ansi2knr executable bring any other part of the
+program under the GPL.
+*/
+
+/*
+ * Usage:
+ ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
+ * --filename provides the file name for the #line directive in the output,
+ * overriding input_file (if present).
+ * If no input_file is supplied, input is read from stdin.
+ * If no output_file is supplied, output goes to stdout.
+ * There are no error messages.
+ *
+ * ansi2knr recognizes function definitions by seeing a non-keyword
+ * identifier at the left margin, followed by a left parenthesis, with a
+ * right parenthesis as the last character on the line, and with a left
+ * brace as the first token on the following line (ignoring possible
+ * intervening comments and/or preprocessor directives), except that a line
+ * consisting of only
+ * identifier1(identifier2)
+ * will not be considered a function definition unless identifier2 is
+ * the word "void", and a line consisting of
+ * identifier1(identifier2, <<arbitrary>>)
+ * will not be considered a function definition.
+ * ansi2knr will recognize a multi-line header provided that no intervening
+ * line ends with a left or right brace or a semicolon. These algorithms
+ * ignore whitespace, comments, and preprocessor directives, except that
+ * the function name must be the first thing on the line. The following
+ * constructs will confuse it:
+ * - Any other construct that starts at the left margin and
+ * follows the above syntax (such as a macro or function call).
+ * - Some macros that tinker with the syntax of function headers.
+ */
+
+/*
+ * The original and principal author of ansi2knr is L. Peter Deutsch
+ * <ghost@aladdin.com>. Other authors are noted in the change history
+ * that follows (in reverse chronological order):
+
+ lpd 2000-04-12 backs out Eggert's changes because of bugs:
+ - concatlits didn't declare the type of its bufend argument;
+ - concatlits didn't recognize when it was inside a comment;
+ - scanstring could scan backward past the beginning of the string; when
+ - the check for \ + newline in scanstring was unnecessary.
+
+ 2000-03-05 Paul Eggert <eggert@twinsun.com>
+
+ Add support for concatenated string literals.
+ * ansi2knr.c (concatlits): New decl.
+ (main): Invoke concatlits to concatenate string literals.
+ (scanstring): Handle backslash-newline correctly. Work with
+ character constants. Fix bug when scanning backwards through
+ backslash-quote. Check for unterminated strings.
+ (convert1): Parse character constants, too.
+ (appendline, concatlits): New functions.
+ * ansi2knr.1: Document this.
+
+ lpd 1999-08-17 added code to allow preprocessor directives
+ wherever comments are allowed
+ lpd 1999-04-12 added minor fixes from Pavel Roskin
+ <pavel_roskin@geocities.com> for clean compilation with
+ gcc -W -Wall
+ lpd 1999-03-22 added hack to recognize lines consisting of
+ identifier1(identifier2, xxx) as *not* being procedures
+ lpd 1999-02-03 made indentation of preprocessor commands consistent
+ lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
+ endless loop; quoted strings within an argument list
+ confused the parser
+ lpd 1999-01-24 added a check for write errors on the output,
+ suggested by Jim Meyering <meyering@ascend.com>
+ lpd 1998-11-09 added further hack to recognize identifier(void)
+ as being a procedure
+ lpd 1998-10-23 added hack to recognize lines consisting of
+ identifier1(identifier2) as *not* being procedures
+ lpd 1997-12-08 made input_file optional; only closes input and/or
+ output file if not stdin or stdout respectively; prints
+ usage message on stderr rather than stdout; adds
+ --filename switch (changes suggested by
+ <ceder@lysator.liu.se>)
+ lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
+ compilers that don't understand void, as suggested by
+ Tom Lane
+ lpd 1996-01-15 changed to require that the first non-comment token
+ on the line following a function header be a left brace,
+ to reduce sensitivity to macros, as suggested by Tom Lane
+ <tgl@sss.pgh.pa.us>
+ lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
+ undefined preprocessor symbols as 0; changed all #ifdefs
+ for configuration symbols to #ifs
+ lpd 1995-04-05 changed copyright notice to make it clear that
+ including ansi2knr in a program does not bring the entire
+ program under the GPL
+ lpd 1994-12-18 added conditionals for systems where ctype macros
+ don't handle 8-bit characters properly, suggested by
+ Francois Pinard <pinard@iro.umontreal.ca>;
+ removed --varargs switch (this is now the default)
+ lpd 1994-10-10 removed CONFIG_BROKETS conditional
+ lpd 1994-07-16 added some conditionals to help GNU `configure',
+ suggested by Francois Pinard <pinard@iro.umontreal.ca>;
+ properly erase prototype args in function parameters,
+ contributed by Jim Avera <jima@netcom.com>;
+ correct error in writeblanks (it shouldn't erase EOLs)
+ lpd 1989-xx-xx original version
+ */
+
+/* Most of the conditionals here are to make ansi2knr work with */
+/* or without the GNU configure machinery. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_CONFIG_H
+
+/*
+ For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
+ This will define HAVE_CONFIG_H and so, activate the following lines.
+ */
+
+# if STDC_HEADERS || HAVE_STRING_H
+# include <string.h>
+# else
+# include <strings.h>
+# endif
+
+#else /* not HAVE_CONFIG_H */
+
+/* Otherwise do it the hard way */
+
+# ifdef BSD
+# include <strings.h>
+# else
+# ifdef VMS
+ extern int strlen(), strncmp();
+# else
+# include <string.h>
+# endif
+# endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#if STDC_HEADERS
+# include <stdlib.h>
+#else
+/*
+ malloc and free should be declared in stdlib.h,
+ but if you've got a K&R compiler, they probably aren't.
+ */
+# ifdef MSDOS
+# include <malloc.h>
+# else
+# ifdef VMS
+ extern char *malloc();
+ extern void free();
+# else
+ extern char *malloc();
+ extern int free();
+# endif
+# endif
+
+#endif
+
+/* Define NULL (for *very* old compilers). */
+#ifndef NULL
+# define NULL (0)
+#endif
+
+/*
+ * The ctype macros don't always handle 8-bit characters correctly.
+ * Compensate for this here.
+ */
+#ifdef isascii
+# undef HAVE_ISASCII /* just in case */
+# define HAVE_ISASCII 1
+#else
+#endif
+#if STDC_HEADERS || !HAVE_ISASCII
+# define is_ascii(c) 1
+#else
+# define is_ascii(c) isascii(c)
+#endif
+
+#define is_space(c) (is_ascii(c) && isspace(c))
+#define is_alpha(c) (is_ascii(c) && isalpha(c))
+#define is_alnum(c) (is_ascii(c) && isalnum(c))
+
+/* Scanning macros */
+#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
+#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
+
+/* Forward references */
+char *ppdirforward();
+char *ppdirbackward();
+char *skipspace();
+char *scanstring();
+int writeblanks();
+int test1();
+int convert1();
+
+/* The main program */
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{ FILE *in = stdin;
+ FILE *out = stdout;
+ char *filename = 0;
+ char *program_name = argv[0];
+ char *output_name = 0;
+#define bufsize 5000 /* arbitrary size */
+ char *buf;
+ char *line;
+ char *more;
+ char *usage =
+ "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
+ /*
+ * In previous versions, ansi2knr recognized a --varargs switch.
+ * If this switch was supplied, ansi2knr would attempt to convert
+ * a ... argument to va_alist and va_dcl; if this switch was not
+ * supplied, ansi2knr would simply drop any such arguments.
+ * Now, ansi2knr always does this conversion, and we only
+ * check for this switch for backward compatibility.
+ */
+ int convert_varargs = 1;
+ int output_error;
+
+ while ( argc > 1 && argv[1][0] == '-' ) {
+ if ( !strcmp(argv[1], "--varargs") ) {
+ convert_varargs = 1;
+ argc--;
+ argv++;
+ continue;
+ }
+ if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
+ filename = argv[2];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name,
+ argv[1]);
+ fprintf(stderr, usage);
+ exit(1);
+ }
+ switch ( argc )
+ {
+ default:
+ fprintf(stderr, usage);
+ exit(0);
+ case 3:
+ output_name = argv[2];
+ out = fopen(output_name, "w");
+ if ( out == NULL ) {
+ fprintf(stderr, "%s: Cannot open output file %s\n",
+ program_name, output_name);
+ exit(1);
+ }
+ /* falls through */
+ case 2:
+ in = fopen(argv[1], "r");
+ if ( in == NULL ) {
+ fprintf(stderr, "%s: Cannot open input file %s\n",
+ program_name, argv[1]);
+ exit(1);
+ }
+ if ( filename == 0 )
+ filename = argv[1];
+ /* falls through */
+ case 1:
+ break;
+ }
+ if ( filename )
+ fprintf(out, "#line 1 \"%s\"\n", filename);
+ buf = malloc(bufsize);
+ if ( buf == NULL )
+ {
+ fprintf(stderr, "Unable to allocate read buffer!\n");
+ exit(1);
+ }
+ line = buf;
+ while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+ {
+test: line += strlen(line);
+ switch ( test1(buf) )
+ {
+ case 2: /* a function header */
+ convert1(buf, out, 1, convert_varargs);
+ break;
+ case 1: /* a function */
+ /* Check for a { at the start of the next line. */
+ more = ++line;
+f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
+ goto wl;
+ if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
+ goto wl;
+ switch ( *skipspace(ppdirforward(more), 1) )
+ {
+ case '{':
+ /* Definitely a function header. */
+ convert1(buf, out, 0, convert_varargs);
+ fputs(more, out);
+ break;
+ case 0:
+ /* The next line was blank or a comment: */
+ /* keep scanning for a non-comment. */
+ line += strlen(line);
+ goto f;
+ default:
+ /* buf isn't a function header, but */
+ /* more might be. */
+ fputs(buf, out);
+ strcpy(buf, more);
+ line = buf;
+ goto test;
+ }
+ break;
+ case -1: /* maybe the start of a function */
+ if ( line != buf + (bufsize - 1) ) /* overflow check */
+ continue;
+ /* falls through */
+ default: /* not a function */
+wl: fputs(buf, out);
+ break;
+ }
+ line = buf;
+ }
+ if ( line != buf )
+ fputs(buf, out);
+ free(buf);
+ if ( output_name ) {
+ output_error = ferror(out);
+ output_error |= fclose(out);
+ } else { /* out == stdout */
+ fflush(out);
+ output_error = ferror(out);
+ }
+ if ( output_error ) {
+ fprintf(stderr, "%s: error writing to %s\n", program_name,
+ (output_name ? output_name : "stdout"));
+ exit(1);
+ }
+ if ( in != stdin )
+ fclose(in);
+ return 0;
+}
+
+/*
+ * Skip forward or backward over one or more preprocessor directives.
+ */
+char *
+ppdirforward(p)
+ char *p;
+{
+ for (; *p == '#'; ++p) {
+ for (; *p != '\r' && *p != '\n'; ++p)
+ if (*p == 0)
+ return p;
+ if (*p == '\r' && p[1] == '\n')
+ ++p;
+ }
+ return p;
+}
+char *
+ppdirbackward(p, limit)
+ char *p;
+ char *limit;
+{
+ char *np = p;
+
+ for (;; p = --np) {
+ if (*np == '\n' && np[-1] == '\r')
+ --np;
+ for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np)
+ if (np[-1] == 0)
+ return np;
+ if (*np != '#')
+ return p;
+ }
+}
+
+/*
+ * Skip over whitespace, comments, and preprocessor directives,
+ * in either direction.
+ */
+char *
+skipspace(p, dir)
+ char *p;
+ int dir; /* 1 for forward, -1 for backward */
+{
+ for ( ; ; ) {
+ while ( is_space(*p) )
+ p += dir;
+ if ( !(*p == '/' && p[dir] == '*') )
+ break;
+ p += dir; p += dir;
+ while ( !(*p == '*' && p[dir] == '/') ) {
+ if ( *p == 0 )
+ return p; /* multi-line comment?? */
+ p += dir;
+ }
+ p += dir; p += dir;
+ }
+ return p;
+}
+
+/* Scan over a quoted string, in either direction. */
+char *
+scanstring(p, dir)
+ char *p;
+ int dir;
+{
+ for (p += dir; ; p += dir)
+ if (*p == '"' && p[-dir] != '\\')
+ return p + dir;
+}
+
+/*
+ * Write blanks over part of a string.
+ * Don't overwrite end-of-line characters.
+ */
+int
+writeblanks(start, end)
+ char *start;
+ char *end;
+{ char *p;
+ for ( p = start; p < end; p++ )
+ if ( *p != '\r' && *p != '\n' )
+ *p = ' ';
+ return 0;
+}
+
+/*
+ * Test whether the string in buf is a function definition.
+ * The string may contain and/or end with a newline.
+ * Return as follows:
+ * 0 - definitely not a function definition;
+ * 1 - definitely a function definition;
+ * 2 - definitely a function prototype (NOT USED);
+ * -1 - may be the beginning of a function definition,
+ * append another line and look again.
+ * The reason we don't attempt to convert function prototypes is that
+ * Ghostscript's declaration-generating macros look too much like
+ * prototypes, and confuse the algorithms.
+ */
+int
+test1(buf)
+ char *buf;
+{ char *p = buf;
+ char *bend;
+ char *endfn;
+ int contin;
+
+ if ( !isidfirstchar(*p) )
+ return 0; /* no name at left margin */
+ bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1);
+ switch ( *bend )
+ {
+ case ';': contin = 0 /*2*/; break;
+ case ')': contin = 1; break;
+ case '{': return 0; /* not a function */
+ case '}': return 0; /* not a function */
+ default: contin = -1;
+ }
+ while ( isidchar(*p) )
+ p++;
+ endfn = p;
+ p = skipspace(p, 1);
+ if ( *p++ != '(' )
+ return 0; /* not a function */
+ p = skipspace(p, 1);
+ if ( *p == ')' )
+ return 0; /* no parameters */
+ /* Check that the apparent function name isn't a keyword. */
+ /* We only need to check for keywords that could be followed */
+ /* by a left parenthesis (which, unfortunately, is most of them). */
+ { static char *words[] =
+ { "asm", "auto", "case", "char", "const", "double",
+ "extern", "float", "for", "if", "int", "long",
+ "register", "return", "short", "signed", "sizeof",
+ "static", "switch", "typedef", "unsigned",
+ "void", "volatile", "while", 0
+ };
+ char **key = words;
+ char *kp;
+ unsigned len = endfn - buf;
+
+ while ( (kp = *key) != 0 )
+ { if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+ return 0; /* name is a keyword */
+ key++;
+ }
+ }
+ {
+ char *id = p;
+ int len;
+ /*
+ * Check for identifier1(identifier2) and not
+ * identifier1(void), or identifier1(identifier2, xxxx).
+ */
+
+ while ( isidchar(*p) )
+ p++;
+ len = p - id;
+ p = skipspace(p, 1);
+ if (*p == ',' ||
+ (*p == ')' && (len != 4 || strncmp(id, "void", 4)))
+ )
+ return 0; /* not a function */
+ }
+ /*
+ * If the last significant character was a ), we need to count
+ * parentheses, because it might be part of a formal parameter
+ * that is a procedure.
+ */
+ if (contin > 0) {
+ int level = 0;
+
+ for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
+ level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
+ if (level > 0)
+ contin = -1;
+ }
+ return contin;
+}
+
+/* Convert a recognized function definition or header to K&R syntax. */
+int
+convert1(buf, out, header, convert_varargs)
+ char *buf;
+ FILE *out;
+ int header; /* Boolean */
+ int convert_varargs; /* Boolean */
+{ char *endfn;
+ char *p;
+ /*
+ * The breaks table contains pointers to the beginning and end
+ * of each argument.
+ */
+ char **breaks;
+ unsigned num_breaks = 2; /* for testing */
+ char **btop;
+ char **bp;
+ char **ap;
+ char *vararg = 0;
+
+ /* Pre-ANSI implementations don't agree on whether strchr */
+ /* is called strchr or index, so we open-code it here. */
+ for ( endfn = buf; *(endfn++) != '('; )
+ ;
+top: p = endfn;
+ breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+ if ( breaks == NULL )
+ { /* Couldn't allocate break table, give up */
+ fprintf(stderr, "Unable to allocate break table!\n");
+ fputs(buf, out);
+ return -1;
+ }
+ btop = breaks + num_breaks * 2 - 2;
+ bp = breaks;
+ /* Parse the argument list */
+ do
+ { int level = 0;
+ char *lp = NULL;
+ char *rp = NULL;
+ char *end = NULL;
+
+ if ( bp >= btop )
+ { /* Filled up break table. */
+ /* Allocate a bigger one and start over. */
+ free((char *)breaks);
+ num_breaks <<= 1;
+ goto top;
+ }
+ *bp++ = p;
+ /* Find the end of the argument */
+ for ( ; end == NULL; p++ )
+ { switch(*p)
+ {
+ case ',':
+ if ( !level ) end = p;
+ break;
+ case '(':
+ if ( !level ) lp = p;
+ level++;
+ break;
+ case ')':
+ if ( --level < 0 ) end = p;
+ else rp = p;
+ break;
+ case '/':
+ if (p[1] == '*')
+ p = skipspace(p, 1) - 1;
+ break;
+ case '"':
+ p = scanstring(p, 1) - 1;
+ break;
+ default:
+ ;
+ }
+ }
+ /* Erase any embedded prototype parameters. */
+ if ( lp && rp )
+ writeblanks(lp + 1, rp);
+ p--; /* back up over terminator */
+ /* Find the name being declared. */
+ /* This is complicated because of procedure and */
+ /* array modifiers. */
+ for ( ; ; )
+ { p = skipspace(p - 1, -1);
+ switch ( *p )
+ {
+ case ']': /* skip array dimension(s) */
+ case ')': /* skip procedure args OR name */
+ { int level = 1;
+ while ( level )
+ switch ( *--p )
+ {
+ case ']': case ')':
+ level++;
+ break;
+ case '[': case '(':
+ level--;
+ break;
+ case '/':
+ if (p > buf && p[-1] == '*')
+ p = skipspace(p, -1) + 1;
+ break;
+ case '"':
+ p = scanstring(p, -1) + 1;
+ break;
+ default: ;
+ }
+ }
+ if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+ { /* We found the name being declared */
+ while ( !isidfirstchar(*p) )
+ p = skipspace(p, 1) + 1;
+ goto found;
+ }
+ break;
+ default:
+ goto found;
+ }
+ }
+found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+ { if ( convert_varargs )
+ { *bp++ = "va_alist";
+ vararg = p-2;
+ }
+ else
+ { p++;
+ if ( bp == breaks + 1 ) /* sole argument */
+ writeblanks(breaks[0], p);
+ else
+ writeblanks(bp[-1] - 1, p);
+ bp--;
+ }
+ }
+ else
+ { while ( isidchar(*p) ) p--;
+ *bp++ = p+1;
+ }
+ p = end;
+ }
+ while ( *p++ == ',' );
+ *bp = p;
+ /* Make a special check for 'void' arglist */
+ if ( bp == breaks+2 )
+ { p = skipspace(breaks[0], 1);
+ if ( !strncmp(p, "void", 4) )
+ { p = skipspace(p+4, 1);
+ if ( p == breaks[2] - 1 )
+ { bp = breaks; /* yup, pretend arglist is empty */
+ writeblanks(breaks[0], p + 1);
+ }
+ }
+ }
+ /* Put out the function name and left parenthesis. */
+ p = buf;
+ while ( p != endfn ) putc(*p, out), p++;
+ /* Put out the declaration. */
+ if ( header )
+ { fputs(");", out);
+ for ( p = breaks[0]; *p; p++ )
+ if ( *p == '\r' || *p == '\n' )
+ putc(*p, out);
+ }
+ else
+ { for ( ap = breaks+1; ap < bp; ap += 2 )
+ { p = *ap;
+ while ( isidchar(*p) )
+ putc(*p, out), p++;
+ if ( ap < bp - 1 )
+ fputs(", ", out);
+ }
+ fputs(") ", out);
+ /* Put out the argument declarations */
+ for ( ap = breaks+2; ap <= bp; ap += 2 )
+ (*ap)[-1] = ';';
+ if ( vararg != 0 )
+ { *vararg = 0;
+ fputs(breaks[0], out); /* any prior args */
+ fputs("va_dcl", out); /* the final arg */
+ fputs(bp[0], out);
+ }
+ else
+ fputs(breaks[0], out);
+ }
+ free((char *)breaks);
+ return 0;
+}
diff --git a/util/invoke-ntp-keygen.texi b/util/invoke-ntp-keygen.texi
index 99266fa..0412485 100644
--- a/util/invoke-ntp-keygen.texi
+++ b/util/invoke-ntp-keygen.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp-keygen.texi)
#
-# It has been AutoGen-ed December 2, 2014 at 08:58:48 AM by AutoGen 5.18.5pre4
+# It has been AutoGen-ed April 7, 2015 at 04:27:46 AM by AutoGen 5.18.5pre4
# From the definitions ntp-keygen-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -886,7 +886,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.7p482
+ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p2
Usage: ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
Flg Arg Option-Name Description
-b Num imbits identity modulus bits
diff --git a/util/jitter.c b/util/jitter.c
index 62a84ad..c0050fc 100644
--- a/util/jitter.c
+++ b/util/jitter.c
@@ -14,10 +14,9 @@
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>
-#include "jitter.h"
+#include "ntp_fp.h"
#define NBUF 800002
-#define FRAC 4294967296. /* a bbbbillion */
#define JAN_1970 2208988800UL /* Unix base epoch */
#define CLOCK_GETTIME /* Solaris hires clock */
diff --git a/util/jitter.h b/util/jitter.h
deleted file mode 100644
index 8c774b0..0000000
--- a/util/jitter.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * ntp_types.h - defines how int32 and u_int32 are treated.
- * For 64 bit systems like the DEC Alpha, they have to be defined
- * as int and u_int.
- * For 32 bit systems, define them as long and u_long
- */
-#define SIZEOF_INT 4
-
-/*
- * VMS DECC (v4.1), {u_char,u_short,u_long} are only in SOCKET.H,
- * and u_int isn't defined anywhere
- */
-#if defined(VMS)
-#include <socket.h>
-typedef unsigned int u_int;
-/*
- * Note: VMS DECC has long == int (even on __alpha),
- * so the distinction below doesn't matter
- */
-#endif /* VMS */
-
-#if (SIZEOF_INT == 4)
-# ifndef int32
-# define int32 int
-# endif
-# ifndef u_int32
-# define u_int32 unsigned int
-# endif
-#else /* not sizeof(int) == 4 */
-# if (SIZEOF_LONG == 4)
-# else /* not sizeof(long) == 4 */
-# ifndef int32
-# define int32 long
-# endif
-# ifndef u_int32
-# define u_int32 unsigned long
-# endif
-# endif /* not sizeof(long) == 4 */
-# include "Bletch: what's 32 bits on this machine?"
-#endif /* not sizeof(int) == 4 */
-
-typedef unsigned short associd_t; /* association ID */
-typedef u_int32 keyid_t; /* cryptographic key ID */
-typedef u_int32 tstamp_t; /* NTP seconds timestamp */
-
-/*
- * NTP uses two fixed point formats. The first (l_fp) is the "long"
- * format and is 64 bits long with the decimal between bits 31 and 32.
- * This is used for time stamps in the NTP packet header (in network
- * byte order) and for internal computations of offsets (in local host
- * byte order). We use the same structure for both signed and unsigned
- * values, which is a big hack but saves rewriting all the operators
- * twice. Just to confuse this, we also sometimes just carry the
- * fractional part in calculations, in both signed and unsigned forms.
- * Anyway, an l_fp looks like:
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Integral Part |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Fractional Part |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- */
-typedef struct {
- union {
- u_int32 Xl_ui;
- int32 Xl_i;
- } Ul_i;
- union {
- u_int32 Xl_uf;
- int32 Xl_f;
- } Ul_f;
-} l_fp;
-
-#define l_ui Ul_i.Xl_ui /* unsigned integral part */
-#define l_i Ul_i.Xl_i /* signed integral part */
-#define l_uf Ul_f.Xl_uf /* unsigned fractional part */
-#define l_f Ul_f.Xl_f /* signed fractional part */
-
-/*
- * Fractional precision (of an l_fp) is actually the number of
- * bits in a long.
- */
-#define FRACTION_PREC (32)
-
-
-/*
- * The second fixed point format is 32 bits, with the decimal between
- * bits 15 and 16. There is a signed version (s_fp) and an unsigned
- * version (u_fp). This is used to represent synchronizing distance
- * and synchronizing dispersion in the NTP packet header (again, in
- * network byte order) and internally to hold both distance and
- * dispersion values (in local byte order). In network byte order
- * it looks like:
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Integer Part | Fraction Part |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- */
-typedef int32 s_fp;
-typedef u_int32 u_fp;
-
-/*
- * A unit second in fp format. Actually 2**(half_the_bits_in_a_long)
- */
-#define FP_SECOND (0x10000)
-
-/*
- * Byte order conversions
- */
-#define HTONS_FP(x) (htonl(x))
-#define HTONL_FP(h, n) do { (n)->l_ui = htonl((h)->l_ui); \
- (n)->l_uf = htonl((h)->l_uf); } while (0)
-#define NTOHS_FP(x) (ntohl(x))
-#define NTOHL_FP(n, h) do { (h)->l_ui = ntohl((n)->l_ui); \
- (h)->l_uf = ntohl((n)->l_uf); } while (0)
-#define NTOHL_MFP(ni, nf, hi, hf) \
- do { (hi) = ntohl(ni); (hf) = ntohl(nf); } while (0)
-#define HTONL_MFP(hi, hf, ni, nf) \
- do { (ni) = ntohl(hi); (nf) = ntohl(hf); } while (0)
-
-/* funny ones. Converts ts fractions to net order ts */
-#define HTONL_UF(uf, nts) \
- do { (nts)->l_ui = 0; (nts)->l_uf = htonl(uf); } while (0)
-#define HTONL_F(f, nts) do { (nts)->l_uf = htonl(f); \
- if ((f) & 0x80000000) \
- (nts)->l_i = -1; \
- else \
- (nts)->l_i = 0; \
- } while (0)
-
-/*
- * Conversions between the two fixed point types
- */
-#define MFPTOFP(x_i, x_f) (((x_i) >= 0x00010000) ? 0x7fffffff : \
- (((x_i) <= -0x00010000) ? 0x80000000 : \
- (((x_i)<<16) | (((x_f)>>16)&0xffff))))
-#define LFPTOFP(v) MFPTOFP((v)->l_i, (v)->l_f)
-
-#define UFPTOLFP(x, v) ((v)->l_ui = (u_fp)(x)>>16, (v)->l_uf = (x)<<16)
-#define FPTOLFP(x, v) (UFPTOLFP((x), (v)), (x) < 0 ? (v)->l_ui -= 0x10000 : 0)
-
-#define MAXLFP(v) ((v)->l_ui = 0x7fffffff, (v)->l_uf = 0xffffffff)
-#define MINLFP(v) ((v)->l_ui = 0x80000000, (v)->l_uf = 0)
-
-/*
- * Primitive operations on long fixed point values. If these are
- * reminiscent of assembler op codes it's only because some may
- * be replaced by inline assembler for particular machines someday.
- * These are the (kind of inefficient) run-anywhere versions.
- */
-#define M_NEG(v_i, v_f) /* v = -v */ \
- do { \
- if ((v_f) == 0) \
- (v_i) = -((s_fp)(v_i)); \
- else { \
- (v_f) = -((s_fp)(v_f)); \
- (v_i) = ~(v_i); \
- } \
- } while(0)
-
-#define M_NEGM(r_i, r_f, a_i, a_f) /* r = -a */ \
- do { \
- if ((a_f) == 0) { \
- (r_f) = 0; \
- (r_i) = -(a_i); \
- } else { \
- (r_f) = -(a_f); \
- (r_i) = ~(a_i); \
- } \
- } while(0)
-
-#define M_ADD(r_i, r_f, a_i, a_f) /* r += a */ \
- do { \
- register u_int32 lo_tmp; \
- register u_int32 hi_tmp; \
- \
- lo_tmp = ((r_f) & 0xffff) + ((a_f) & 0xffff); \
- hi_tmp = (((r_f) >> 16) & 0xffff) + (((a_f) >> 16) & 0xffff); \
- if (lo_tmp & 0x10000) \
- hi_tmp++; \
- (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \
- \
- (r_i) += (a_i); \
- if (hi_tmp & 0x10000) \
- (r_i)++; \
- } while (0)
-
-#define M_ADD3(r_ovr, r_i, r_f, a_ovr, a_i, a_f) /* r += a, three word */ \
- do { \
- register u_int32 lo_tmp; \
- register u_int32 hi_tmp; \
- \
- lo_tmp = ((r_f) & 0xffff) + ((a_f) & 0xffff); \
- hi_tmp = (((r_f) >> 16) & 0xffff) + (((a_f) >> 16) & 0xffff); \
- if (lo_tmp & 0x10000) \
- hi_tmp++; \
- (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \
- \
- lo_tmp = ((r_i) & 0xffff) + ((a_i) & 0xffff); \
- if (hi_tmp & 0x10000) \
- lo_tmp++; \
- hi_tmp = (((r_i) >> 16) & 0xffff) + (((a_i) >> 16) & 0xffff); \
- if (lo_tmp & 0x10000) \
- hi_tmp++; \
- (r_i) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \
- \
- (r_ovr) += (a_ovr); \
- if (hi_tmp & 0x10000) \
- (r_ovr)++; \
- } while (0)
-
-#define M_SUB(r_i, r_f, a_i, a_f) /* r -= a */ \
- do { \
- register u_int32 lo_tmp; \
- register u_int32 hi_tmp; \
- \
- if ((a_f) == 0) { \
- (r_i) -= (a_i); \
- } else { \
- lo_tmp = ((r_f) & 0xffff) + ((-((s_fp)(a_f))) & 0xffff); \
- hi_tmp = (((r_f) >> 16) & 0xffff) \
- + (((-((s_fp)(a_f))) >> 16) & 0xffff); \
- if (lo_tmp & 0x10000) \
- hi_tmp++; \
- (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \
- \
- (r_i) += ~(a_i); \
- if (hi_tmp & 0x10000) \
- (r_i)++; \
- } \
- } while (0)
-
-#define M_RSHIFTU(v_i, v_f) /* v >>= 1, v is unsigned */ \
- do { \
- (v_f) = (u_int32)(v_f) >> 1; \
- if ((v_i) & 01) \
- (v_f) |= 0x80000000; \
- (v_i) = (u_int32)(v_i) >> 1; \
- } while (0)
-
-#define M_RSHIFT(v_i, v_f) /* v >>= 1, v is signed */ \
- do { \
- (v_f) = (u_int32)(v_f) >> 1; \
- if ((v_i) & 01) \
- (v_f) |= 0x80000000; \
- if ((v_i) & 0x80000000) \
- (v_i) = ((v_i) >> 1) | 0x80000000; \
- else \
- (v_i) = (v_i) >> 1; \
- } while (0)
-
-#define M_LSHIFT(v_i, v_f) /* v <<= 1 */ \
- do { \
- (v_i) <<= 1; \
- if ((v_f) & 0x80000000) \
- (v_i) |= 0x1; \
- (v_f) <<= 1; \
- } while (0)
-
-#define M_LSHIFT3(v_ovr, v_i, v_f) /* v <<= 1, with overflow */ \
- do { \
- (v_ovr) <<= 1; \
- if ((v_i) & 0x80000000) \
- (v_ovr) |= 0x1; \
- (v_i) <<= 1; \
- if ((v_f) & 0x80000000) \
- (v_i) |= 0x1; \
- (v_f) <<= 1; \
- } while (0)
-
-#define M_ADDUF(r_i, r_f, uf) /* r += uf, uf is u_int32 fraction */ \
- M_ADD((r_i), (r_f), 0, (uf)) /* let optimizer worry about it */
-
-#define M_SUBUF(r_i, r_f, uf) /* r -= uf, uf is u_int32 fraction */ \
- M_SUB((r_i), (r_f), 0, (uf)) /* let optimizer worry about it */
-
-#define M_ADDF(r_i, r_f, f) /* r += f, f is a int32 fraction */ \
- do { \
- if ((f) > 0) \
- M_ADD((r_i), (r_f), 0, (f)); \
- else if ((f) < 0) \
- M_ADD((r_i), (r_f), (-1), (f));\
- } while(0)
-
-#define M_ISNEG(v_i, v_f) /* v < 0 */ \
- (((v_i) & 0x80000000) != 0)
-
-#define M_ISHIS(a_i, a_f, b_i, b_f) /* a >= b unsigned */ \
- (((u_int32)(a_i)) > ((u_int32)(b_i)) || \
- ((a_i) == (b_i) && ((u_int32)(a_f)) >= ((u_int32)(b_f))))
-
-#define M_ISGEQ(a_i, a_f, b_i, b_f) /* a >= b signed */ \
- (((int32)(a_i)) > ((int32)(b_i)) || \
- ((a_i) == (b_i) && ((u_int32)(a_f)) >= ((u_int32)(b_f))))
-
-#define M_ISEQU(a_i, a_f, b_i, b_f) /* a == b unsigned */ \
- ((a_i) == (b_i) && (a_f) == (b_f))
-
-/*
- * Operations on the long fp format
- */
-#define L_ADD(r, a) M_ADD((r)->l_ui, (r)->l_uf, (a)->l_ui, (a)->l_uf)
-#define L_SUB(r, a) M_SUB((r)->l_ui, (r)->l_uf, (a)->l_ui, (a)->l_uf)
-#define L_NEG(v) M_NEG((v)->l_ui, (v)->l_uf)
-#define L_ADDUF(r, uf) M_ADDUF((r)->l_ui, (r)->l_uf, (uf))
-#define L_SUBUF(r, uf) M_SUBUF((r)->l_ui, (r)->l_uf, (uf))
-#define L_ADDF(r, f) M_ADDF((r)->l_ui, (r)->l_uf, (f))
-#define L_RSHIFT(v) M_RSHIFT((v)->l_i, (v)->l_uf)
-#define L_RSHIFTU(v) M_RSHIFT((v)->l_ui, (v)->l_uf)
-#define L_LSHIFT(v) M_LSHIFT((v)->l_ui, (v)->l_uf)
-#define L_CLR(v) ((v)->l_ui = (v)->l_uf = 0)
-
-#define L_ISNEG(v) (((v)->l_ui & 0x80000000) != 0)
-#define L_ISZERO(v) ((v)->l_ui == 0 && (v)->l_uf == 0)
-#define L_ISHIS(a, b) ((a)->l_ui > (b)->l_ui || \
- ((a)->l_ui == (b)->l_ui && (a)->l_uf >= (b)->l_uf))
-#define L_ISGEQ(a, b) ((a)->l_i > (b)->l_i || \
- ((a)->l_i == (b)->l_i && (a)->l_uf >= (b)->l_uf))
-#define L_ISEQU(a, b) M_ISEQU((a)->l_ui, (a)->l_uf, (b)->l_ui, (b)->l_uf)
-
-/*
- * s_fp/double and u_fp/double conversions
- */
-#define FRIC 65536. /* 2^16 as a double */
-#define DTOFP(r) ((s_fp)((r) * FRIC))
-#define DTOUFP(r) ((u_fp)((r) * FRIC))
-#define FPTOD(r) ((double)(r) / FRIC)
-
-/*
- * l_fp/double conversions
- */
-#define FRAC 4294967296. /* 2^32 as a double */
-#define M_DTOLFP(d, r_i, r_uf) /* double to l_fp */ \
- do { \
- register double d_tmp; \
- \
- d_tmp = (d); \
- if (d_tmp < 0) { \
- d_tmp = -d_tmp; \
- (r_i) = (int32)(d_tmp); \
- (r_uf) = (u_int32)(((d_tmp) - (double)(r_i)) * FRAC); \
- M_NEG((r_i), (r_uf)); \
- } else { \
- (r_i) = (int32)(d_tmp); \
- (r_uf) = (u_int32)(((d_tmp) - (double)(r_i)) * FRAC); \
- } \
- } while (0)
-#define M_LFPTOD(r_i, r_uf, d) /* l_fp to double */ \
- do { \
- register l_fp l_tmp; \
- \
- l_tmp.l_i = (r_i); \
- l_tmp.l_f = (r_uf); \
- if (l_tmp.l_i < 0) { \
- M_NEG(l_tmp.l_i, l_tmp.l_uf); \
- (d) = -((double)l_tmp.l_i + ((double)l_tmp.l_uf) / FRAC); \
- } else { \
- (d) = (double)l_tmp.l_i + ((double)l_tmp.l_uf) / FRAC; \
- } \
- } while (0)
-#define DTOLFP(d, v) M_DTOLFP((d), (v)->l_ui, (v)->l_uf)
-#define LFPTOD(v, d) M_LFPTOD((v)->l_ui, (v)->l_uf, (d))
-
-/*
- * Prototypes
- */
-#if 0
-extern char * dofptoa (u_fp, int, short, int);
-extern char * dolfptoa (u_long, u_long, int, short, int);
-#endif
-
-extern int atolfp (const char *, l_fp *);
-extern int buftvtots (const char *, l_fp *);
-extern char * fptoa (s_fp, short);
-extern char * fptoms (s_fp, short);
-extern int hextolfp (const char *, l_fp *);
-extern void gpstolfp (int, int, unsigned long, l_fp *);
-extern int mstolfp (const char *, l_fp *);
-extern char * prettydate (l_fp *);
-extern char * gmprettydate (l_fp *);
-extern char * uglydate (l_fp *);
-extern void mfp_mul (int32 *, u_int32 *, int32, u_int32, int32, u_int32);
-
-extern void get_systime (l_fp *);
-extern int step_systime (double);
-extern int adj_systime (double);
-
-#define lfptoa(_fpv, _ndec) mfptoa((_fpv)->l_ui, (_fpv)->l_uf, (_ndec))
-#define lfptoms(_fpv, _ndec) mfptoms((_fpv)->l_ui, (_fpv)->l_uf, (_ndec))
-
-#define ufptoa(_fpv, _ndec) dofptoa((_fpv), 0, (_ndec), 0)
-#define ufptoms(_fpv, _ndec) dofptoa((_fpv), 0, (_ndec), 1)
-#define ulfptoa(_fpv, _ndec) dolfptoa((_fpv)->l_ui, (_fpv)->l_uf, 0, (_ndec), 0)
-#define ulfptoms(_fpv, _ndec) dolfptoa((_fpv)->l_ui, (_fpv)->l_uf, 0, (_ndec), 1)
-#define umfptoa(_fpi, _fpf, _ndec) dolfptoa((_fpi), (_fpf), 0, (_ndec), 0)
diff --git a/util/ntp-keygen-opts.c b/util/ntp-keygen-opts.c
index 718588f..8521861 100644
--- a/util/ntp-keygen-opts.c
+++ b/util/ntp-keygen-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
*
- * It has been AutoGen-ed December 2, 2014 at 08:58:32 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed April 7, 2015 at 04:27:30 AM by AutoGen 5.18.5pre4
* 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) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 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:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -51,7 +51,7 @@ extern "C" {
#endif
extern FILE * option_usage_fp;
#define zCopyright (ntp_keygen_opt_strs+0)
-#define zLicenseDescrip (ntp_keygen_opt_strs+326)
+#define zLicenseDescrip (ntp_keygen_opt_strs+352)
/*
* global included definitions
@@ -71,117 +71,118 @@ extern FILE * option_usage_fp;
/**
* static const strings for ntp-keygen options
*/
-static char const ntp_keygen_opt_strs[2369] =
-/* 0 */ "ntp-keygen (ntp) 4.2.7p482\n"
- "Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n"
+static char const ntp_keygen_opt_strs[2419] =
+/* 0 */ "ntp-keygen (ntp) 4.2.8p2\n"
+ "Copyright (C) 1992-2015 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"
" <http://ntp.org/license>\n"
" <http://opensource.org/licenses/ntp-license.php>\n\0"
-/* 326 */ "Permission to use, copy, modify, and distribute this software and its\n"
+/* 352 */ "Permission to use, copy, modify, and distribute this software and its\n"
"documentation for any purpose with or without fee is hereby granted,\n"
"provided that the above copyright notice appears in all copies and that\n"
"both the copyright notice and this permission notice appear in supporting\n"
"documentation, and that the name The University of Delaware not be used in\n"
"advertising or publicity pertaining to distribution of the software without\n"
- "specific, written prior permission. The University of Delaware makes no\n"
- "representations about the suitability this software for any purpose. It is\n"
- "provided \"as is\" without express or implied warranty.\n\0"
-/* 966 */ "identity modulus bits\0"
-/* 988 */ "IMBITS\0"
-/* 995 */ "imbits\0"
-/* 1002 */ "certificate scheme\0"
-/* 1021 */ "CERTIFICATE\0"
-/* 1033 */ "certificate\0"
-/* 1045 */ "privatekey cipher\0"
-/* 1063 */ "CIPHER\0"
-/* 1070 */ "cipher\0"
-/* 1077 */ "Increase debug verbosity level\0"
-/* 1108 */ "DEBUG_LEVEL\0"
-/* 1120 */ "debug-level\0"
-/* 1132 */ "Set the debug verbosity level\0"
-/* 1162 */ "SET_DEBUG_LEVEL\0"
-/* 1178 */ "set-debug-level\0"
-/* 1194 */ "Write IFF or GQ identity keys\0"
-/* 1224 */ "ID_KEY\0"
-/* 1231 */ "id-key\0"
-/* 1238 */ "Generate GQ parameters and keys\0"
-/* 1270 */ "GQ_PARAMS\0"
-/* 1280 */ "gq-params\0"
-/* 1290 */ "generate RSA host key\0"
-/* 1312 */ "HOST_KEY\0"
-/* 1321 */ "host-key\0"
-/* 1330 */ "generate IFF parameters\0"
-/* 1354 */ "IFFKEY\0"
-/* 1361 */ "iffkey\0"
-/* 1368 */ "set Autokey group name\0"
-/* 1391 */ "IDENT\0"
-/* 1397 */ "ident\0"
-/* 1403 */ "set certificate lifetime\0"
-/* 1428 */ "LIFETIME\0"
-/* 1437 */ "lifetime\0"
-/* 1446 */ "generate MD5 keys\0"
-/* 1464 */ "MD5KEY\0"
-/* 1471 */ "md5key\0"
-/* 1478 */ "modulus\0"
-/* 1486 */ "MODULUS\0"
-/* 1494 */ "generate PC private certificate\0"
-/* 1526 */ "PVT_CERT\0"
-/* 1535 */ "pvt-cert\0"
-/* 1544 */ "local private password\0"
-/* 1567 */ "PASSWORD\0"
-/* 1576 */ "password\0"
-/* 1585 */ "export IFF or GQ group keys with password\0"
-/* 1627 */ "EXPORT_PASSWD\0"
-/* 1641 */ "export-passwd\0"
-/* 1655 */ "generate sign key (RSA or DSA)\0"
-/* 1686 */ "SIGN_KEY\0"
-/* 1695 */ "sign-key\0"
-/* 1704 */ "set host and optionally group name\0"
-/* 1739 */ "SUBJECT_NAME\0"
-/* 1752 */ "subject-name\0"
-/* 1765 */ "trusted certificate (TC scheme)\0"
-/* 1797 */ "TRUSTED_CERT\0"
-/* 1810 */ "trusted-cert\0"
-/* 1823 */ "generate <num> MV parameters\0"
-/* 1852 */ "MV_PARAMS\0"
-/* 1862 */ "mv-params\0"
-/* 1872 */ "update <num> MV keys\0"
-/* 1893 */ "MV_KEYS\0"
-/* 1901 */ "mv-keys\0"
-/* 1909 */ "display extended usage information and exit\0"
-/* 1953 */ "help\0"
-/* 1958 */ "extended usage information passed thru pager\0"
-/* 2003 */ "more-help\0"
-/* 2013 */ "output version information and exit\0"
-/* 2049 */ "version\0"
-/* 2057 */ "save the option state to a config file\0"
-/* 2096 */ "save-opts\0"
-/* 2106 */ "load options from a config file\0"
-/* 2138 */ "LOAD_OPTS\0"
-/* 2148 */ "no-load-opts\0"
-/* 2161 */ "no\0"
-/* 2164 */ "NTP_KEYGEN\0"
-/* 2175 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.7p482\n"
+ "specific, written prior permission. The University of Delaware and Network\n"
+ "Time Foundation makes no representations about the suitability this\n"
+ "software for any purpose. It is provided \"as is\" without express or\n"
+ "implied warranty.\n\0"
+/* 1020 */ "identity modulus bits\0"
+/* 1042 */ "IMBITS\0"
+/* 1049 */ "imbits\0"
+/* 1056 */ "certificate scheme\0"
+/* 1075 */ "CERTIFICATE\0"
+/* 1087 */ "certificate\0"
+/* 1099 */ "privatekey cipher\0"
+/* 1117 */ "CIPHER\0"
+/* 1124 */ "cipher\0"
+/* 1131 */ "Increase debug verbosity level\0"
+/* 1162 */ "DEBUG_LEVEL\0"
+/* 1174 */ "debug-level\0"
+/* 1186 */ "Set the debug verbosity level\0"
+/* 1216 */ "SET_DEBUG_LEVEL\0"
+/* 1232 */ "set-debug-level\0"
+/* 1248 */ "Write IFF or GQ identity keys\0"
+/* 1278 */ "ID_KEY\0"
+/* 1285 */ "id-key\0"
+/* 1292 */ "Generate GQ parameters and keys\0"
+/* 1324 */ "GQ_PARAMS\0"
+/* 1334 */ "gq-params\0"
+/* 1344 */ "generate RSA host key\0"
+/* 1366 */ "HOST_KEY\0"
+/* 1375 */ "host-key\0"
+/* 1384 */ "generate IFF parameters\0"
+/* 1408 */ "IFFKEY\0"
+/* 1415 */ "iffkey\0"
+/* 1422 */ "set Autokey group name\0"
+/* 1445 */ "IDENT\0"
+/* 1451 */ "ident\0"
+/* 1457 */ "set certificate lifetime\0"
+/* 1482 */ "LIFETIME\0"
+/* 1491 */ "lifetime\0"
+/* 1500 */ "generate MD5 keys\0"
+/* 1518 */ "MD5KEY\0"
+/* 1525 */ "md5key\0"
+/* 1532 */ "modulus\0"
+/* 1540 */ "MODULUS\0"
+/* 1548 */ "generate PC private certificate\0"
+/* 1580 */ "PVT_CERT\0"
+/* 1589 */ "pvt-cert\0"
+/* 1598 */ "local private password\0"
+/* 1621 */ "PASSWORD\0"
+/* 1630 */ "password\0"
+/* 1639 */ "export IFF or GQ group keys with password\0"
+/* 1681 */ "EXPORT_PASSWD\0"
+/* 1695 */ "export-passwd\0"
+/* 1709 */ "generate sign key (RSA or DSA)\0"
+/* 1740 */ "SIGN_KEY\0"
+/* 1749 */ "sign-key\0"
+/* 1758 */ "set host and optionally group name\0"
+/* 1793 */ "SUBJECT_NAME\0"
+/* 1806 */ "subject-name\0"
+/* 1819 */ "trusted certificate (TC scheme)\0"
+/* 1851 */ "TRUSTED_CERT\0"
+/* 1864 */ "trusted-cert\0"
+/* 1877 */ "generate <num> MV parameters\0"
+/* 1906 */ "MV_PARAMS\0"
+/* 1916 */ "mv-params\0"
+/* 1926 */ "update <num> MV keys\0"
+/* 1947 */ "MV_KEYS\0"
+/* 1955 */ "mv-keys\0"
+/* 1963 */ "display extended usage information and exit\0"
+/* 2007 */ "help\0"
+/* 2012 */ "extended usage information passed thru pager\0"
+/* 2057 */ "more-help\0"
+/* 2067 */ "output version information and exit\0"
+/* 2103 */ "version\0"
+/* 2111 */ "save the option state to a config file\0"
+/* 2150 */ "save-opts\0"
+/* 2160 */ "load options from a config file\0"
+/* 2192 */ "LOAD_OPTS\0"
+/* 2202 */ "no-load-opts\0"
+/* 2215 */ "no\0"
+/* 2218 */ "NTP_KEYGEN\0"
+/* 2229 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p2\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
-/* 2291 */ "$HOME\0"
-/* 2297 */ ".\0"
-/* 2299 */ ".ntprc\0"
-/* 2306 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/* 2340 */ "\n\0"
-/* 2342 */ "ntp-keygen (ntp) 4.2.7p482";
+/* 2343 */ "$HOME\0"
+/* 2349 */ ".\0"
+/* 2351 */ ".ntprc\0"
+/* 2358 */ "http://bugs.ntp.org, bugs@ntp.org\0"
+/* 2392 */ "\n\0"
+/* 2394 */ "ntp-keygen (ntp) 4.2.8p2";
/**
* imbits option description:
*/
#ifdef AUTOKEY
/** Descriptive text for the imbits option */
-#define IMBITS_DESC (ntp_keygen_opt_strs+966)
+#define IMBITS_DESC (ntp_keygen_opt_strs+1020)
/** Upper-cased name for the imbits option */
-#define IMBITS_NAME (ntp_keygen_opt_strs+988)
+#define IMBITS_NAME (ntp_keygen_opt_strs+1042)
/** Name string for the imbits option */
-#define IMBITS_name (ntp_keygen_opt_strs+995)
+#define IMBITS_name (ntp_keygen_opt_strs+1049)
/** Compiled in flag settings for the imbits option */
#define IMBITS_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -198,11 +199,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the certificate option */
-#define CERTIFICATE_DESC (ntp_keygen_opt_strs+1002)
+#define CERTIFICATE_DESC (ntp_keygen_opt_strs+1056)
/** Upper-cased name for the certificate option */
-#define CERTIFICATE_NAME (ntp_keygen_opt_strs+1021)
+#define CERTIFICATE_NAME (ntp_keygen_opt_strs+1075)
/** Name string for the certificate option */
-#define CERTIFICATE_name (ntp_keygen_opt_strs+1033)
+#define CERTIFICATE_name (ntp_keygen_opt_strs+1087)
/** Compiled in flag settings for the certificate option */
#define CERTIFICATE_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -219,11 +220,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the cipher option */
-#define CIPHER_DESC (ntp_keygen_opt_strs+1045)
+#define CIPHER_DESC (ntp_keygen_opt_strs+1099)
/** Upper-cased name for the cipher option */
-#define CIPHER_NAME (ntp_keygen_opt_strs+1063)
+#define CIPHER_NAME (ntp_keygen_opt_strs+1117)
/** Name string for the cipher option */
-#define CIPHER_name (ntp_keygen_opt_strs+1070)
+#define CIPHER_name (ntp_keygen_opt_strs+1124)
/** Compiled in flag settings for the cipher option */
#define CIPHER_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -239,11 +240,11 @@ static char const ntp_keygen_opt_strs[2369] =
* debug-level option description:
*/
/** Descriptive text for the debug-level option */
-#define DEBUG_LEVEL_DESC (ntp_keygen_opt_strs+1077)
+#define DEBUG_LEVEL_DESC (ntp_keygen_opt_strs+1131)
/** Upper-cased name for the debug-level option */
-#define DEBUG_LEVEL_NAME (ntp_keygen_opt_strs+1108)
+#define DEBUG_LEVEL_NAME (ntp_keygen_opt_strs+1162)
/** Name string for the debug-level option */
-#define DEBUG_LEVEL_name (ntp_keygen_opt_strs+1120)
+#define DEBUG_LEVEL_name (ntp_keygen_opt_strs+1174)
/** Compiled in flag settings for the debug-level option */
#define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
@@ -251,11 +252,11 @@ static char const ntp_keygen_opt_strs[2369] =
* set-debug-level option description:
*/
/** Descriptive text for the set-debug-level option */
-#define SET_DEBUG_LEVEL_DESC (ntp_keygen_opt_strs+1132)
+#define SET_DEBUG_LEVEL_DESC (ntp_keygen_opt_strs+1186)
/** Upper-cased name for the set-debug-level option */
-#define SET_DEBUG_LEVEL_NAME (ntp_keygen_opt_strs+1162)
+#define SET_DEBUG_LEVEL_NAME (ntp_keygen_opt_strs+1216)
/** Name string for the set-debug-level option */
-#define SET_DEBUG_LEVEL_name (ntp_keygen_opt_strs+1178)
+#define SET_DEBUG_LEVEL_name (ntp_keygen_opt_strs+1232)
/** Compiled in flag settings for the set-debug-level option */
#define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -265,11 +266,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the id-key option */
-#define ID_KEY_DESC (ntp_keygen_opt_strs+1194)
+#define ID_KEY_DESC (ntp_keygen_opt_strs+1248)
/** Upper-cased name for the id-key option */
-#define ID_KEY_NAME (ntp_keygen_opt_strs+1224)
+#define ID_KEY_NAME (ntp_keygen_opt_strs+1278)
/** Name string for the id-key option */
-#define ID_KEY_name (ntp_keygen_opt_strs+1231)
+#define ID_KEY_name (ntp_keygen_opt_strs+1285)
/** Compiled in flag settings for the id-key option */
#define ID_KEY_FLAGS (OPTST_DISABLED)
@@ -285,11 +286,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the gq-params option */
-#define GQ_PARAMS_DESC (ntp_keygen_opt_strs+1238)
+#define GQ_PARAMS_DESC (ntp_keygen_opt_strs+1292)
/** Upper-cased name for the gq-params option */
-#define GQ_PARAMS_NAME (ntp_keygen_opt_strs+1270)
+#define GQ_PARAMS_NAME (ntp_keygen_opt_strs+1324)
/** Name string for the gq-params option */
-#define GQ_PARAMS_name (ntp_keygen_opt_strs+1280)
+#define GQ_PARAMS_name (ntp_keygen_opt_strs+1334)
/** Compiled in flag settings for the gq-params option */
#define GQ_PARAMS_FLAGS (OPTST_DISABLED)
@@ -305,11 +306,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the host-key option */
-#define HOST_KEY_DESC (ntp_keygen_opt_strs+1290)
+#define HOST_KEY_DESC (ntp_keygen_opt_strs+1344)
/** Upper-cased name for the host-key option */
-#define HOST_KEY_NAME (ntp_keygen_opt_strs+1312)
+#define HOST_KEY_NAME (ntp_keygen_opt_strs+1366)
/** Name string for the host-key option */
-#define HOST_KEY_name (ntp_keygen_opt_strs+1321)
+#define HOST_KEY_name (ntp_keygen_opt_strs+1375)
/** Compiled in flag settings for the host-key option */
#define HOST_KEY_FLAGS (OPTST_DISABLED)
@@ -325,11 +326,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the iffkey option */
-#define IFFKEY_DESC (ntp_keygen_opt_strs+1330)
+#define IFFKEY_DESC (ntp_keygen_opt_strs+1384)
/** Upper-cased name for the iffkey option */
-#define IFFKEY_NAME (ntp_keygen_opt_strs+1354)
+#define IFFKEY_NAME (ntp_keygen_opt_strs+1408)
/** Name string for the iffkey option */
-#define IFFKEY_name (ntp_keygen_opt_strs+1361)
+#define IFFKEY_name (ntp_keygen_opt_strs+1415)
/** Compiled in flag settings for the iffkey option */
#define IFFKEY_FLAGS (OPTST_DISABLED)
@@ -345,11 +346,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the ident option */
-#define IDENT_DESC (ntp_keygen_opt_strs+1368)
+#define IDENT_DESC (ntp_keygen_opt_strs+1422)
/** Upper-cased name for the ident option */
-#define IDENT_NAME (ntp_keygen_opt_strs+1391)
+#define IDENT_NAME (ntp_keygen_opt_strs+1445)
/** Name string for the ident option */
-#define IDENT_name (ntp_keygen_opt_strs+1397)
+#define IDENT_name (ntp_keygen_opt_strs+1451)
/** Compiled in flag settings for the ident option */
#define IDENT_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -366,11 +367,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the lifetime option */
-#define LIFETIME_DESC (ntp_keygen_opt_strs+1403)
+#define LIFETIME_DESC (ntp_keygen_opt_strs+1457)
/** Upper-cased name for the lifetime option */
-#define LIFETIME_NAME (ntp_keygen_opt_strs+1428)
+#define LIFETIME_NAME (ntp_keygen_opt_strs+1482)
/** Name string for the lifetime option */
-#define LIFETIME_name (ntp_keygen_opt_strs+1437)
+#define LIFETIME_name (ntp_keygen_opt_strs+1491)
/** Compiled in flag settings for the lifetime option */
#define LIFETIME_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -386,11 +387,11 @@ static char const ntp_keygen_opt_strs[2369] =
* md5key option description:
*/
/** Descriptive text for the md5key option */
-#define MD5KEY_DESC (ntp_keygen_opt_strs+1446)
+#define MD5KEY_DESC (ntp_keygen_opt_strs+1500)
/** Upper-cased name for the md5key option */
-#define MD5KEY_NAME (ntp_keygen_opt_strs+1464)
+#define MD5KEY_NAME (ntp_keygen_opt_strs+1518)
/** Name string for the md5key option */
-#define MD5KEY_name (ntp_keygen_opt_strs+1471)
+#define MD5KEY_name (ntp_keygen_opt_strs+1525)
/** Compiled in flag settings for the md5key option */
#define MD5KEY_FLAGS (OPTST_DISABLED)
@@ -399,11 +400,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the modulus option */
-#define MODULUS_DESC (ntp_keygen_opt_strs+1478)
+#define MODULUS_DESC (ntp_keygen_opt_strs+1532)
/** Upper-cased name for the modulus option */
-#define MODULUS_NAME (ntp_keygen_opt_strs+1486)
+#define MODULUS_NAME (ntp_keygen_opt_strs+1540)
/** Name string for the modulus option */
-#define MODULUS_name (ntp_keygen_opt_strs+1478)
+#define MODULUS_name (ntp_keygen_opt_strs+1532)
/** Compiled in flag settings for the modulus option */
#define MODULUS_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -420,11 +421,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the pvt-cert option */
-#define PVT_CERT_DESC (ntp_keygen_opt_strs+1494)
+#define PVT_CERT_DESC (ntp_keygen_opt_strs+1548)
/** Upper-cased name for the pvt-cert option */
-#define PVT_CERT_NAME (ntp_keygen_opt_strs+1526)
+#define PVT_CERT_NAME (ntp_keygen_opt_strs+1580)
/** Name string for the pvt-cert option */
-#define PVT_CERT_name (ntp_keygen_opt_strs+1535)
+#define PVT_CERT_name (ntp_keygen_opt_strs+1589)
/** Compiled in flag settings for the pvt-cert option */
#define PVT_CERT_FLAGS (OPTST_DISABLED)
@@ -440,11 +441,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the password option */
-#define PASSWORD_DESC (ntp_keygen_opt_strs+1544)
+#define PASSWORD_DESC (ntp_keygen_opt_strs+1598)
/** Upper-cased name for the password option */
-#define PASSWORD_NAME (ntp_keygen_opt_strs+1567)
+#define PASSWORD_NAME (ntp_keygen_opt_strs+1621)
/** Name string for the password option */
-#define PASSWORD_name (ntp_keygen_opt_strs+1576)
+#define PASSWORD_name (ntp_keygen_opt_strs+1630)
/** Compiled in flag settings for the password option */
#define PASSWORD_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -461,11 +462,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the export-passwd option */
-#define EXPORT_PASSWD_DESC (ntp_keygen_opt_strs+1585)
+#define EXPORT_PASSWD_DESC (ntp_keygen_opt_strs+1639)
/** Upper-cased name for the export-passwd option */
-#define EXPORT_PASSWD_NAME (ntp_keygen_opt_strs+1627)
+#define EXPORT_PASSWD_NAME (ntp_keygen_opt_strs+1681)
/** Name string for the export-passwd option */
-#define EXPORT_PASSWD_name (ntp_keygen_opt_strs+1641)
+#define EXPORT_PASSWD_name (ntp_keygen_opt_strs+1695)
/** Compiled in flag settings for the export-passwd option */
#define EXPORT_PASSWD_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -482,11 +483,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the sign-key option */
-#define SIGN_KEY_DESC (ntp_keygen_opt_strs+1655)
+#define SIGN_KEY_DESC (ntp_keygen_opt_strs+1709)
/** Upper-cased name for the sign-key option */
-#define SIGN_KEY_NAME (ntp_keygen_opt_strs+1686)
+#define SIGN_KEY_NAME (ntp_keygen_opt_strs+1740)
/** Name string for the sign-key option */
-#define SIGN_KEY_name (ntp_keygen_opt_strs+1695)
+#define SIGN_KEY_name (ntp_keygen_opt_strs+1749)
/** Compiled in flag settings for the sign-key option */
#define SIGN_KEY_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -503,11 +504,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the subject-name option */
-#define SUBJECT_NAME_DESC (ntp_keygen_opt_strs+1704)
+#define SUBJECT_NAME_DESC (ntp_keygen_opt_strs+1758)
/** Upper-cased name for the subject-name option */
-#define SUBJECT_NAME_NAME (ntp_keygen_opt_strs+1739)
+#define SUBJECT_NAME_NAME (ntp_keygen_opt_strs+1793)
/** Name string for the subject-name option */
-#define SUBJECT_NAME_name (ntp_keygen_opt_strs+1752)
+#define SUBJECT_NAME_name (ntp_keygen_opt_strs+1806)
/** Compiled in flag settings for the subject-name option */
#define SUBJECT_NAME_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -524,11 +525,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the trusted-cert option */
-#define TRUSTED_CERT_DESC (ntp_keygen_opt_strs+1765)
+#define TRUSTED_CERT_DESC (ntp_keygen_opt_strs+1819)
/** Upper-cased name for the trusted-cert option */
-#define TRUSTED_CERT_NAME (ntp_keygen_opt_strs+1797)
+#define TRUSTED_CERT_NAME (ntp_keygen_opt_strs+1851)
/** Name string for the trusted-cert option */
-#define TRUSTED_CERT_name (ntp_keygen_opt_strs+1810)
+#define TRUSTED_CERT_name (ntp_keygen_opt_strs+1864)
/** Compiled in flag settings for the trusted-cert option */
#define TRUSTED_CERT_FLAGS (OPTST_DISABLED)
@@ -544,11 +545,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the mv-params option */
-#define MV_PARAMS_DESC (ntp_keygen_opt_strs+1823)
+#define MV_PARAMS_DESC (ntp_keygen_opt_strs+1877)
/** Upper-cased name for the mv-params option */
-#define MV_PARAMS_NAME (ntp_keygen_opt_strs+1852)
+#define MV_PARAMS_NAME (ntp_keygen_opt_strs+1906)
/** Name string for the mv-params option */
-#define MV_PARAMS_name (ntp_keygen_opt_strs+1862)
+#define MV_PARAMS_name (ntp_keygen_opt_strs+1916)
/** Compiled in flag settings for the mv-params option */
#define MV_PARAMS_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -565,11 +566,11 @@ static char const ntp_keygen_opt_strs[2369] =
*/
#ifdef AUTOKEY
/** Descriptive text for the mv-keys option */
-#define MV_KEYS_DESC (ntp_keygen_opt_strs+1872)
+#define MV_KEYS_DESC (ntp_keygen_opt_strs+1926)
/** Upper-cased name for the mv-keys option */
-#define MV_KEYS_NAME (ntp_keygen_opt_strs+1893)
+#define MV_KEYS_NAME (ntp_keygen_opt_strs+1947)
/** Name string for the mv-keys option */
-#define MV_KEYS_name (ntp_keygen_opt_strs+1901)
+#define MV_KEYS_name (ntp_keygen_opt_strs+1955)
/** Compiled in flag settings for the mv-keys option */
#define MV_KEYS_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -584,11 +585,11 @@ static char const ntp_keygen_opt_strs[2369] =
/*
* Help/More_Help/Version option descriptions:
*/
-#define HELP_DESC (ntp_keygen_opt_strs+1909)
-#define HELP_name (ntp_keygen_opt_strs+1953)
+#define HELP_DESC (ntp_keygen_opt_strs+1963)
+#define HELP_name (ntp_keygen_opt_strs+2007)
#ifdef HAVE_WORKING_FORK
-#define MORE_HELP_DESC (ntp_keygen_opt_strs+1958)
-#define MORE_HELP_name (ntp_keygen_opt_strs+2003)
+#define MORE_HELP_DESC (ntp_keygen_opt_strs+2012)
+#define MORE_HELP_name (ntp_keygen_opt_strs+2057)
#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
#else
#define MORE_HELP_DESC HELP_DESC
@@ -601,14 +602,14 @@ static char const ntp_keygen_opt_strs[2369] =
# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
#endif
-#define VER_DESC (ntp_keygen_opt_strs+2013)
-#define VER_name (ntp_keygen_opt_strs+2049)
-#define SAVE_OPTS_DESC (ntp_keygen_opt_strs+2057)
-#define SAVE_OPTS_name (ntp_keygen_opt_strs+2096)
-#define LOAD_OPTS_DESC (ntp_keygen_opt_strs+2106)
-#define LOAD_OPTS_NAME (ntp_keygen_opt_strs+2138)
-#define NO_LOAD_OPTS_name (ntp_keygen_opt_strs+2148)
-#define LOAD_OPTS_pfx (ntp_keygen_opt_strs+2161)
+#define VER_DESC (ntp_keygen_opt_strs+2067)
+#define VER_name (ntp_keygen_opt_strs+2103)
+#define SAVE_OPTS_DESC (ntp_keygen_opt_strs+2111)
+#define SAVE_OPTS_name (ntp_keygen_opt_strs+2150)
+#define LOAD_OPTS_DESC (ntp_keygen_opt_strs+2160)
+#define LOAD_OPTS_NAME (ntp_keygen_opt_strs+2192)
+#define NO_LOAD_OPTS_name (ntp_keygen_opt_strs+2202)
+#define LOAD_OPTS_pfx (ntp_keygen_opt_strs+2215)
#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
/**
* Declare option callback procedures
@@ -959,24 +960,24 @@ static tOptDesc optDesc[OPTION_CT] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** Reference to the upper cased version of ntp-keygen. */
-#define zPROGNAME (ntp_keygen_opt_strs+2164)
+#define zPROGNAME (ntp_keygen_opt_strs+2218)
/** Reference to the title line for ntp-keygen usage. */
-#define zUsageTitle (ntp_keygen_opt_strs+2175)
+#define zUsageTitle (ntp_keygen_opt_strs+2229)
/** ntp-keygen configuration file name. */
-#define zRcName (ntp_keygen_opt_strs+2299)
+#define zRcName (ntp_keygen_opt_strs+2351)
/** Directories to search for ntp-keygen config files. */
static char const * const apzHomeList[3] = {
- ntp_keygen_opt_strs+2291,
- ntp_keygen_opt_strs+2297,
+ ntp_keygen_opt_strs+2343,
+ ntp_keygen_opt_strs+2349,
NULL };
/** The ntp-keygen program bug email address. */
-#define zBugsAddr (ntp_keygen_opt_strs+2306)
+#define zBugsAddr (ntp_keygen_opt_strs+2358)
/** Clarification/explanation of what ntp-keygen does. */
-#define zExplain (ntp_keygen_opt_strs+2340)
+#define zExplain (ntp_keygen_opt_strs+2392)
/** Extra detail explaining what ntp-keygen does. */
#define zDetail (NULL)
/** The full version string for ntp-keygen. */
-#define zFullVersion (ntp_keygen_opt_strs+2342)
+#define zFullVersion (ntp_keygen_opt_strs+2394)
/* extracted from optcode.tlib near line 364 */
#if defined(ENABLE_NLS)
@@ -1308,8 +1309,8 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntp_keygenOptions.pzCopyright */
- puts(_("ntp-keygen (ntp) 4.2.7p482\n\
-Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n\
+ puts(_("ntp-keygen (ntp) 4.2.8p2\n\
+Copyright (C) 1992-2015 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"));
@@ -1323,9 +1324,10 @@ provided that the above copyright notice appears in all copies and that\n\
both the copyright notice and this permission notice appear in supporting\n\
documentation, and that the name The University of Delaware not be used in\n\
advertising or publicity pertaining to distribution of the software without\n\
-specific, written prior permission. The University of Delaware makes no\n\
-representations about the suitability this software for any purpose. It is\n\
-provided \"as is\" without express or implied warranty.\n"));
+specific, written prior permission. The University of Delaware and Network\n\
+Time Foundation makes no representations about the suitability this\n\
+software for any purpose. It is provided \"as is\" without express or\n\
+implied warranty.\n"));
/* referenced via ntp_keygenOptions.pOptDesc->pzText */
puts(_("identity modulus bits"));
@@ -1406,14 +1408,14 @@ provided \"as is\" without express or 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.7p482\n\
+ puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p2\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.7p482"));
+ puts(_("ntp-keygen (ntp) 4.2.8p2"));
/* referenced via ntp_keygenOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/util/ntp-keygen-opts.h b/util/ntp-keygen-opts.h
index 48a9998..54f1ac4 100644
--- a/util/ntp-keygen-opts.h
+++ b/util/ntp-keygen-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h)
*
- * It has been AutoGen-ed December 2, 2014 at 08:58:31 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed April 7, 2015 at 04:27:29 AM by AutoGen 5.18.5pre4
* 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) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 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:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -94,9 +94,9 @@ typedef enum {
/** count of all options for ntp-keygen */
#define OPTION_CT 26
/** ntp-keygen version */
-#define NTP_KEYGEN_VERSION "4.2.7p482"
+#define NTP_KEYGEN_VERSION "4.2.8p2"
/** Full ntp-keygen version text */
-#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.7p482"
+#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p2"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/util/ntp-keygen.1ntp-keygenman b/util/ntp-keygen.1ntp-keygenman
index 28dc6ad..b600ed4 100644
--- a/util/ntp-keygen.1ntp-keygenman
+++ b/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 "02 Dec 2014" "ntp (4.2.7p482)" "User Commands"
+.TH ntp-keygen 1ntp-keygenman "07 Apr 2015" "ntp (4.2.8p2)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-znaynR/ag-LnaqmR)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Kfaqzc/ag-Wfaiyc)
.\"
-.\" It has been AutoGen-ed December 2, 2014 at 08:58:44 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed April 7, 2015 at 04:27:42 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1195,9 +1195,9 @@ libopts had an internal operational error. Please report
it to autogen-users@lists.sourceforge.net. Thank you.
.PP
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 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/util/ntp-keygen.1ntp-keygenmdoc b/util/ntp-keygen.1ntp-keygenmdoc
index 9b3dabb..ad8a96d 100644
--- a/util/ntp-keygen.1ntp-keygenmdoc
+++ b/util/ntp-keygen.1ntp-keygenmdoc
@@ -1,9 +1,9 @@
-.Dd December 2 2014
+.Dd April 7 2015
.Dt NTP_KEYGEN 1ntp-keygenmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 2, 2014 at 08:58:51 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed April 7, 2015 at 04:27:49 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -1051,9 +1051,9 @@ libopts had an internal operational error. Please report
it to autogen\-users@lists.sourceforge.net. Thank you.
.El
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 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/util/ntp-keygen.c b/util/ntp-keygen.c
index d55a357..494bedb 100644
--- a/util/ntp-keygen.c
+++ b/util/ntp-keygen.c
@@ -108,6 +108,7 @@
#endif /* OPENSSL */
#include <ssl_applink.c>
+#define _UC(str) ((char *)(intptr_t)(str))
/*
* Cryptodefines
*/
@@ -131,19 +132,19 @@
* Prototypes
*/
FILE *fheader (const char *, const char *, const char *);
-int gen_md5 (char *);
+int gen_md5 (const char *);
void followlink (char *, size_t);
#ifdef AUTOKEY
-EVP_PKEY *gen_rsa (char *);
-EVP_PKEY *gen_dsa (char *);
-EVP_PKEY *gen_iffkey (char *);
-EVP_PKEY *gen_gqkey (char *);
-EVP_PKEY *gen_mvkey (char *, EVP_PKEY **);
+EVP_PKEY *gen_rsa (const char *);
+EVP_PKEY *gen_dsa (const char *);
+EVP_PKEY *gen_iffkey (const char *);
+EVP_PKEY *gen_gqkey (const char *);
+EVP_PKEY *gen_mvkey (const char *, EVP_PKEY **);
void gen_mvserv (char *, EVP_PKEY **);
-int x509 (EVP_PKEY *, const EVP_MD *, char *, char *,
+int x509 (EVP_PKEY *, const EVP_MD *, char *, const char *,
char *);
void cb (int, int, void *);
-EVP_PKEY *genkey (char *, char *);
+EVP_PKEY *genkey (const char *, const char *);
EVP_PKEY *readkey (char *, char *, u_int *, EVP_PKEY **);
void writekey (char *, char *, u_int *, EVP_PKEY **);
u_long asn2ntp (ASN1_TIME *);
@@ -311,7 +312,7 @@ main(
char pathbuf[MAXFILENAME + 1];
const char *scheme = NULL; /* digest/signature scheme */
const char *ciphername = NULL; /* to encrypt priv. key */
- char *exten = NULL; /* private extension */
+ const char *exten = NULL; /* private extension */
char *grpkey = NULL; /* identity extension */
int nid; /* X509 digest/signature scheme */
FILE *fstr = NULL; /* file handle */
@@ -336,6 +337,8 @@ main(
ssl_check_version();
#endif /* OPENSSL */
+ ntp_crypto_srandom();
+
/*
* Process options, initialize host name and timestamp.
* gethostname() won't null-terminate if hostname is exactly the
@@ -348,7 +351,6 @@ main(
passwd1 = hostbuf;
passwd2 = NULL;
GETTIMEOFDAY(&tv, NULL);
- ntp_srandom((u_long)(tv.tv_sec + tv.tv_usec));
epoch = tv.tv_sec;
fstamp = (u_int)(epoch + JAN_1970);
@@ -810,7 +812,7 @@ main(
*/
int
gen_md5(
- char *id /* file name id */
+ const char *id /* file name id */
)
{
u_char md5key[MD5SIZE + 1]; /* MD5 key */
@@ -825,17 +827,24 @@ gen_md5(
str = fheader("MD5key", id, groupname);
for (i = 1; i <= MD5KEYS; i++) {
for (j = 0; j < MD5SIZE; j++) {
- int temp;
+ u_char temp;
while (1) {
- temp = ntp_random() & 0xff;
+ int rc;
+
+ rc = ntp_crypto_random_buf(
+ &temp, sizeof(temp));
+ if (-1 == rc) {
+ fprintf(stderr, "ntp_crypto_random_buf() failed.\n");
+ exit (-1);
+ }
if (temp == '#')
continue;
if (temp > 0x20 && temp < 0x7f)
break;
}
- md5key[j] = (u_char)temp;
+ md5key[j] = temp;
}
md5key[j] = '\0';
fprintf(str, "%2d MD5 %s # MD5 key\n", i,
@@ -950,7 +959,7 @@ readkey(
*/
EVP_PKEY * /* public/private key pair */
gen_rsa(
- char *id /* file name id */
+ const char *id /* file name id */
)
{
EVP_PKEY *pkey; /* private key */
@@ -958,7 +967,7 @@ gen_rsa(
FILE *str;
fprintf(stderr, "Generating RSA keys (%d bits)...\n", modulus);
- rsa = RSA_generate_key(modulus, 3, cb, "RSA");
+ rsa = RSA_generate_key(modulus, 65537, cb, _UC("RSA"));
fprintf(stderr, "\n");
if (rsa == NULL) {
fprintf(stderr, "RSA generate keys fails\n%s\n",
@@ -1003,7 +1012,7 @@ gen_rsa(
*/
EVP_PKEY * /* public/private key pair */
gen_dsa(
- char *id /* file name id */
+ const char *id /* file name id */
)
{
EVP_PKEY *pkey; /* private key */
@@ -1018,7 +1027,7 @@ gen_dsa(
"Generating DSA parameters (%d bits)...\n", modulus);
RAND_bytes(seed, sizeof(seed));
dsa = DSA_generate_parameters(modulus, seed, sizeof(seed), NULL,
- NULL, cb, "DSA");
+ NULL, cb, _UC("DSA"));
fprintf(stderr, "\n");
if (dsa == NULL) {
fprintf(stderr, "DSA generate parameters fails\n%s\n",
@@ -1105,7 +1114,7 @@ gen_dsa(
*/
EVP_PKEY * /* DSA cuckoo nest */
gen_iffkey(
- char *id /* file name id */
+ const char *id /* file name id */
)
{
EVP_PKEY *pkey; /* private key */
@@ -1123,7 +1132,7 @@ gen_iffkey(
modulus2);
RAND_bytes(seed, sizeof(seed));
dsa = DSA_generate_parameters(modulus2, seed, sizeof(seed), NULL,
- NULL, cb, "IFF");
+ NULL, cb, _UC("IFF"));
fprintf(stderr, "\n");
if (dsa == NULL) {
fprintf(stderr, "DSA generate parameters fails\n%s\n",
@@ -1283,7 +1292,7 @@ gen_iffkey(
*/
EVP_PKEY * /* RSA cuckoo nest */
gen_gqkey(
- char *id /* file name id */
+ const char *id /* file name id */
)
{
EVP_PKEY *pkey; /* private key */
@@ -1299,7 +1308,7 @@ gen_gqkey(
fprintf(stderr,
"Generating GQ parameters (%d bits)...\n",
modulus2);
- rsa = RSA_generate_key(modulus2, 3, cb, "GQ");
+ rsa = RSA_generate_key(modulus2, 65537, cb, _UC("GQ"));
fprintf(stderr, "\n");
if (rsa == NULL) {
fprintf(stderr, "RSA generate keys fails\n%s\n",
@@ -1492,7 +1501,7 @@ gen_gqkey(
*/
EVP_PKEY * /* DSA cuckoo nest */
gen_mvkey(
- char *id, /* file name id */
+ const char *id, /* file name id */
EVP_PKEY **evpars /* parameter list pointer */
)
{
@@ -1917,7 +1926,7 @@ x509 (
EVP_PKEY *pkey, /* signing key */
const EVP_MD *md, /* signature/digest scheme */
char *gqpub, /* identity extension (hex string) */
- char *exten, /* private cert extension */
+ const char *exten, /* private cert extension */
char *name /* subject/issuer name */
)
{
@@ -1971,7 +1980,7 @@ x509 (
fprintf(stderr, "%s: %s\n", LN_basic_constraints,
BASIC_CONSTRAINTS);
ex = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints,
- BASIC_CONSTRAINTS);
+ _UC(BASIC_CONSTRAINTS));
if (!X509_add_ext(cert, ex, -1)) {
fprintf(stderr, "Add extension field fails\n%s\n",
ERR_error_string(ERR_get_error(), NULL));
@@ -1984,7 +1993,7 @@ x509 (
* be used for.
*/
fprintf(stderr, "%s: %s\n", LN_key_usage, KEY_USAGE);
- ex = X509V3_EXT_conf_nid(NULL, NULL, NID_key_usage, KEY_USAGE);
+ ex = X509V3_EXT_conf_nid(NULL, NULL, NID_key_usage, _UC(KEY_USAGE));
if (!X509_add_ext(cert, ex, -1)) {
fprintf(stderr, "Add extension field fails\n%s\n",
ERR_error_string(ERR_get_error(), NULL));
@@ -2019,7 +2028,7 @@ x509 (
if (exten != NULL) {
fprintf(stderr, "%s: %s\n", LN_ext_key_usage, exten);
ex = X509V3_EXT_conf_nid(NULL, NULL,
- NID_ext_key_usage, exten);
+ NID_ext_key_usage, _UC(exten));
if (!X509_add_ext(cert, ex, -1)) {
fprintf(stderr,
"Add extension field fails\n%s\n",
@@ -2130,8 +2139,8 @@ cb (
*/
EVP_PKEY * /* public/private key pair */
genkey(
- char *type, /* key type (RSA or DSA) */
- char *id /* file name id */
+ const char *type, /* key type (RSA or DSA) */
+ const char *id /* file name id */
)
{
if (type == NULL)
@@ -2161,15 +2170,29 @@ fheader (
FILE *str; /* file handle */
char linkname[MAXFILENAME]; /* link name */
int temp;
-
+#ifdef HAVE_UMASK
+ mode_t orig_umask;
+#endif
+
snprintf(filename, sizeof(filename), "ntpkey_%s_%s.%u", file,
owner, fstamp);
- if ((str = fopen(filename, "w")) == NULL) {
+#ifdef HAVE_UMASK
+ orig_umask = umask( S_IWGRP | S_IRWXO );
+ str = fopen(filename, "w");
+ (void) umask(orig_umask);
+#else
+ str = fopen(filename, "w");
+#endif
+ if (str == NULL) {
perror("Write");
exit (-1);
}
- snprintf(linkname, sizeof(linkname), "ntpkey_%s_%s", ulink,
- hostname);
+ if (strcmp(ulink, "md5") == 0) {
+ strcpy(linkname,"ntp.keys");
+ } else {
+ snprintf(linkname, sizeof(linkname), "ntpkey_%s_%s", ulink,
+ hostname);
+ }
(void)remove(linkname); /* The symlink() line below matters */
temp = symlink(filename, linkname);
if (temp < 0)
diff --git a/util/ntp-keygen.html b/util/ntp-keygen.html
index b5315d2..1aad39b 100644
--- a/util/ntp-keygen.html
+++ b/util/ntp-keygen.html
@@ -70,7 +70,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>This document applies to version 4.2.7p482 of <code>ntp-keygen</code>.
+ <p>This document applies to version 4.2.8p2 of <code>ntp-keygen</code>.
<div class="node">
<p><hr>
@@ -1085,7 +1085,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.7p481
+<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p2-RC3
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/util/ntp-keygen.man.in b/util/ntp-keygen.man.in
index 69fcfaa..b47691b 100644
--- a/util/ntp-keygen.man.in
+++ b/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@ "02 Dec 2014" "ntp (4.2.7p482)" "User Commands"
+.TH ntp-keygen @NTP_KEYGEN_MS@ "07 Apr 2015" "ntp (4.2.8p2)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-znaynR/ag-LnaqmR)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Kfaqzc/ag-Wfaiyc)
.\"
-.\" It has been AutoGen-ed December 2, 2014 at 08:58:44 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed April 7, 2015 at 04:27:42 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1195,9 +1195,9 @@ libopts had an internal operational error. Please report
it to autogen-users@lists.sourceforge.net. Thank you.
.PP
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 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/util/ntp-keygen.mdoc.in b/util/ntp-keygen.mdoc.in
index 80c6009..540ff4f 100644
--- a/util/ntp-keygen.mdoc.in
+++ b/util/ntp-keygen.mdoc.in
@@ -1,9 +1,9 @@
-.Dd December 2 2014
+.Dd April 7 2015
.Dt NTP_KEYGEN @NTP_KEYGEN_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 2, 2014 at 08:58:51 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed April 7, 2015 at 04:27:49 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -1051,9 +1051,9 @@ libopts had an internal operational error. Please report
it to autogen\-users@lists.sourceforge.net. Thank you.
.El
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 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/util/ntptime.c b/util/ntptime.c
index dd5605c..5a6c1d1 100644
--- a/util/ntptime.c
+++ b/util/ntptime.c
@@ -98,15 +98,16 @@ main(
volatile unsigned ts_mask = TS_MASK; /* defaults to 20 bits (us) */
volatile unsigned ts_roundbit = TS_ROUNDBIT; /* defaults to 20 bits (us) */
volatile int fdigits = 6; /* fractional digits for us */
- int c;
+ size_t c;
+ int ch;
int errflg = 0;
int cost = 0;
volatile int rawtime = 0;
ZERO(ntx);
progname = argv[0];
- while ((c = ntp_getopt(argc, argv, optargs)) != EOF) {
- switch (c) {
+ while ((ch = ntp_getopt(argc, argv, optargs)) != EOF) {
+ switch (ch) {
#ifdef MOD_MICRO
case 'M':
ntx.modes |= MOD_MICRO;
@@ -467,7 +468,7 @@ timex_state(
{
static char buf[32];
- if (s >= 0 && s < COUNTOF(timex_states))
+ if ((size_t)s < COUNTOF(timex_states))
return timex_states[s];
snprintf(buf, sizeof(buf), "TIME-#%d", s);
return buf;