summaryrefslogtreecommitdiffstats
path: root/package/ntp/0001-fix-ntp-keygen-without-openssl.patch
blob: b9883be1eec6ad4423cf32e551f6524f85f50bd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Fix build breakage without openssl.
From upstream: http://bk1.ntp.org/ntp-stable/?PAGE=patch&REV=5497b345z5MNTuNvJWuqPSje25NQTg

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

diff -Nura ntp-4.2.8.orig/configure.ac ntp-4.2.8/configure.ac
--- ntp-4.2.8.orig/configure.ac	2014-12-22 10:16:10.449311393 -0300
+++ ntp-4.2.8/configure.ac	2014-12-22 10:17:30.757215905 -0300
@@ -102,7 +102,7 @@
 enable_nls=no
 LIBOPTS_CHECK_NOBUILD([sntp/libopts])
 
-NTP_ENABLE_LOCAL_LIBEVENT
+NTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
 
 NTP_LIBNTP
 
@@ -771,6 +771,10 @@
 
 #### 
 
+AC_CHECK_FUNCS([arc4random_buf])
+
+####
+
 saved_LIBS="$LIBS"
 LIBS="$LIBS $LDADD_LIBNTP"
 AC_CHECK_FUNCS([daemon])
diff -Nura ntp-4.2.8.orig/libntp/ntp_crypto_rnd.c ntp-4.2.8/libntp/ntp_crypto_rnd.c
--- ntp-4.2.8.orig/libntp/ntp_crypto_rnd.c	2014-12-22 10:16:10.430301237 -0300
+++ ntp-4.2.8/libntp/ntp_crypto_rnd.c	2014-12-22 10:18:04.921468163 -0300
@@ -24,6 +24,21 @@
 int crypto_rand_init = 0;
 #endif
 
+#ifndef HAVE_ARC4RANDOM_BUF
+static void
+arc4random_buf(void *buf, size_t nbytes);
+
+void
+evutil_secure_rng_get_bytes(void *buf, size_t nbytes);
+
+static void
+arc4random_buf(void *buf, size_t nbytes)
+{
+	evutil_secure_rng_get_bytes(buf, nbytes);
+	return;
+}
+#endif
+
 /*
  * As of late 2014, here's how we plan to provide cryptographic-quality
  * random numbers:
diff -Nura ntp-4.2.8.orig/Makefile.am ntp-4.2.8/Makefile.am
--- ntp-4.2.8.orig/Makefile.am	2014-12-22 10:16:10.441307117 -0300
+++ ntp-4.2.8/Makefile.am	2014-12-22 10:16:49.403122474 -0300
@@ -3,6 +3,7 @@
 NULL =
 
 SUBDIRS =		\
+	sntp		\
 	scripts		\
 	include		\
 	libntp		\
@@ -17,7 +18,6 @@
 	clockstuff	\
 	kernel		\
 	util		\
-	sntp		\
 	tests		\
 	$(NULL)
 
@@ -64,7 +64,6 @@
 	.gcc-warning			\
 	libtool				\
 	html/.datecheck			\
-	sntp/built-sources-only		\
 	$(srcdir)/COPYRIGHT		\
 	$(srcdir)/.checkChangeLog	\
 	$(NULL)
diff -Nura ntp-4.2.8.orig/sntp/configure.ac ntp-4.2.8/sntp/configure.ac
--- ntp-4.2.8.orig/sntp/configure.ac	2014-12-22 10:16:10.428300168 -0300
+++ ntp-4.2.8/sntp/configure.ac	2014-12-22 10:24:11.238172928 -0300
@@ -97,11 +97,14 @@
 enable_nls=no
 LIBOPTS_CHECK
 
-AM_COND_IF(
-    [BUILD_SNTP],
-    [NTP_LIBEVENT_CHECK],
-    [NTP_LIBEVENT_CHECK_NOBUILD]
-)
+# From when we only used libevent for sntp:
+#AM_COND_IF(
+#    [BUILD_SNTP],
+#    [NTP_LIBEVENT_CHECK],
+#    [NTP_LIBEVENT_CHECK_NOBUILD]
+#)
+
+NTP_LIBEVENT_CHECK([2])
 
 # Checks for libraries.
 
diff -Nura ntp-4.2.8.orig/sntp/m4/ntp_libevent.m4 ntp-4.2.8/sntp/m4/ntp_libevent.m4
--- ntp-4.2.8.orig/sntp/m4/ntp_libevent.m4	2014-12-22 10:16:10.417294288 -0300
+++ ntp-4.2.8/sntp/m4/ntp_libevent.m4	2014-12-22 10:20:31.757915561 -0300
@@ -1,4 +1,25 @@
-dnl NTP_ENABLE_LOCAL_LIBEVENT				     -*- Autoconf -*-
+# SYNOPSIS						-*- Autoconf -*-
+#
+#  NTP_ENABLE_LOCAL_LIBEVENT
+#  NTP_LIBEVENT_CHECK([MINVERSION [, DIR]])
+#  NTP_LIBEVENT_CHECK_NOBUILD([MINVERSION [, DIR]])
+#
+# DESCRIPTION
+#
+# AUTHOR
+#
+#  Harlan Stenn
+#
+# LICENSE
+#
+#  This file is Copyright (c) 2014 Network Time Foundation
+# 
+#  Copying and distribution of this file, with or without modification, are
+#  permitted in any medium without royalty provided the copyright notice,
+#  author attribution and this notice are preserved.  This file is offered
+#  as-is, without any warranty.
+
+dnl NTP_ENABLE_LOCAL_LIBEVENT
 dnl
 dnl Provide only the --enable-local-libevent command-line option.
 dnl
@@ -29,7 +50,7 @@
 dnl but DO NOT invoke DIR/configure if we are going to use our bundled
 dnl version.  This may be the case for nested packages.
 dnl
-dnl provide --enable-local-libevent .
+dnl provides --enable-local-libevent .
 dnl
 dnl Examples:
 dnl
diff -Nura ntp-4.2.8.orig/util/Makefile.am ntp-4.2.8/util/Makefile.am
--- ntp-4.2.8.orig/util/Makefile.am	2014-12-22 10:16:10.435303910 -0300
+++ ntp-4.2.8/util/Makefile.am	2014-12-22 10:21:02.500339706 -0300
@@ -19,6 +19,7 @@
 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
 
OpenPOWER on IntegriCloud