0001-fix-ntp-keygen-without-openssl.patch 4.2 KB

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