1Fix ntp-keygen build without OpenSSL
2
3http://bk1.ntp.org/ntp-stable/?PAGE=patch&REV=5497b345z5MNTuNvJWuqPSje25NQTg
4
5Index: ntp-4.2.8/Makefile.am
6===================================================================
7--- ntp-4.2.8.orig/Makefile.am
8+++ ntp-4.2.8/Makefile.am
9@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I sntp/m4 -I sntp/lib
10
11 NULL =
12
13+# moved sntp first to get libtool and libevent built.
14+
15 SUBDIRS = \
16+ sntp \
17 scripts \
18 include \
19 libntp \
20@@ -17,7 +20,6 @@ SUBDIRS = \
21 clockstuff \
22 kernel \
23 util \
24- sntp \
25 tests \
26 $(NULL)
27
28@@ -64,7 +66,6 @@ BUILT_SOURCES = \
29 .gcc-warning \
30 libtool \
31 html/.datecheck \
32- sntp/built-sources-only \
33 $(srcdir)/COPYRIGHT \
34 $(srcdir)/.checkChangeLog \
35 $(NULL)
36Index: ntp-4.2.8/configure.ac
37===================================================================
38--- ntp-4.2.8.orig/configure.ac
39+++ ntp-4.2.8/configure.ac
40@@ -102,7 +102,7 @@ esac
41 enable_nls=no
42 LIBOPTS_CHECK_NOBUILD([sntp/libopts])
43
44-NTP_ENABLE_LOCAL_LIBEVENT
45+NTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
46
47 NTP_LIBNTP
48
49@@ -771,6 +771,10 @@ esac
50
51 ####
52
53+AC_CHECK_FUNCS([arc4random_buf])
54+
55+####
56+
57 saved_LIBS="$LIBS"
58 LIBS="$LIBS $LDADD_LIBNTP"
59 AC_CHECK_FUNCS([daemon])
60Index: ntp-4.2.8/libntp/ntp_crypto_rnd.c
61===================================================================
62--- ntp-4.2.8.orig/libntp/ntp_crypto_rnd.c
63+++ ntp-4.2.8/libntp/ntp_crypto_rnd.c
64@@ -24,6 +24,21 @@
65 int crypto_rand_init = 0;
66 #endif
67
68+#ifndef HAVE_ARC4RANDOM_BUF
69+static void
70+arc4random_buf(void *buf, size_t nbytes);
71+
72+void
73+evutil_secure_rng_get_bytes(void *buf, size_t nbytes);
74+
75+static void
76+arc4random_buf(void *buf, size_t nbytes)
77+{
78+ evutil_secure_rng_get_bytes(buf, nbytes);
79+ return;
80+}
81+#endif
82+
83 /*
84 * As of late 2014, here's how we plan to provide cryptographic-quality
85 * random numbers:
86Index: ntp-4.2.8/sntp/configure.ac
87===================================================================
88--- ntp-4.2.8.orig/sntp/configure.ac
89+++ ntp-4.2.8/sntp/configure.ac
90@@ -97,11 +97,14 @@ esac
91 enable_nls=no
92 LIBOPTS_CHECK
93
94-AM_COND_IF(
95- [BUILD_SNTP],
96- [NTP_LIBEVENT_CHECK],
97- [NTP_LIBEVENT_CHECK_NOBUILD]
98-)
99+# From when we only used libevent for sntp:
100+#AM_COND_IF(
101+# [BUILD_SNTP],
102+# [NTP_LIBEVENT_CHECK],
103+# [NTP_LIBEVENT_CHECK_NOBUILD]
104+#)
105+
106+NTP_LIBEVENT_CHECK([2])
107
108 # Checks for libraries.
109
110Index: ntp-4.2.8/sntp/m4/ntp_libevent.m4
111===================================================================
112--- ntp-4.2.8.orig/sntp/m4/ntp_libevent.m4
113+++ ntp-4.2.8/sntp/m4/ntp_libevent.m4
114@@ -1,4 +1,25 @@
115-dnl NTP_ENABLE_LOCAL_LIBEVENT -*- Autoconf -*-
116+# SYNOPSIS -*- Autoconf -*-
117+#
118+# NTP_ENABLE_LOCAL_LIBEVENT
119+# NTP_LIBEVENT_CHECK([MINVERSION [, DIR]])
120+# NTP_LIBEVENT_CHECK_NOBUILD([MINVERSION [, DIR]])
121+#
122+# DESCRIPTION
123+#
124+# AUTHOR
125+#
126+# Harlan Stenn
127+#
128+# LICENSE
129+#
130+# This file is Copyright (c) 2014 Network Time Foundation
131+#
132+# Copying and distribution of this file, with or without modification, are
133+# permitted in any medium without royalty provided the copyright notice,
134+# author attribution and this notice are preserved. This file is offered
135+# as-is, without any warranty.
136+
137+dnl NTP_ENABLE_LOCAL_LIBEVENT
138 dnl
139 dnl Provide only the --enable-local-libevent command-line option.
140 dnl
141@@ -29,7 +50,7 @@ dnl If NOBUILD is provided as the 3rd ar
142 dnl but DO NOT invoke DIR/configure if we are going to use our bundled
143 dnl version. This may be the case for nested packages.
144 dnl
145-dnl provide --enable-local-libevent .
146+dnl provides --enable-local-libevent .
147 dnl
148 dnl Examples:
149 dnl
150Index: ntp-4.2.8/util/Makefile.am
151===================================================================
152--- ntp-4.2.8.orig/util/Makefile.am
153+++ ntp-4.2.8/util/Makefile.am
154@@ -19,6 +19,7 @@ AM_LDFLAGS = $(LDFLAGS_NTP)
155 LDADD= ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
156 tg2_LDADD= ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
157 ntp_keygen_LDADD = version.o $(LIBOPTS_LDADD) ../libntp/libntp.a
158+ntp_keygen_LDADD += $(LDADD_LIBEVENT)
159 ntp_keygen_LDADD += $(LDADD_LIBNTP) $(PTHREAD_LIBS) $(LDADD_NTP) $(LIBM)
160 ntp_keygen_SOURCES = ntp-keygen.c ntp-keygen-opts.c ntp-keygen-opts.h
161