aboutsummaryrefslogtreecommitdiff
path: root/depends/patches/libevent/fix_android_arc4random_addrandom.patch
blob: 5bcc64bef6bc86e6f5336aedb89f03c7458f1402 (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
From cadae3ab7abf45e61ecae8aac39d97d1f3cbd336 Mon Sep 17 00:00:00 2001
From: Lawrence Nahum <lawrence@greenaddress.it>
Date: Sun, 3 Dec 2017 22:56:09 +0100
Subject: [PATCH] fixup

---
 configure.ac          | 1 +
 evutil_rand.c         | 3 +++
 include/event2/util.h | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7528d37..3bb2121 100644
--- a/configure.ac
+++ b/configure.ac
@@ -341,6 +341,7 @@ dnl Checks for library functions.
 AC_CHECK_FUNCS([ \
   accept4 \
   arc4random \
+  arc4random_addrandom \
   arc4random_buf \
   eventfd \
   epoll_create1 \
diff --git a/evutil_rand.c b/evutil_rand.c
index 046a14b..3f0bf2c 100644
--- a/evutil_rand.c
+++ b/evutil_rand.c
@@ -191,6 +191,7 @@ evutil_secure_rng_get_bytes(void *buf, size_t n)
 {
 	ev_arc4random_buf(buf, n);
 }
+#ifdef HAVE_ARC4RANDOM_ADDRANDOM
 
 void
 evutil_secure_rng_add_bytes(const char *buf, size_t n)
@@ -199,6 +200,8 @@ evutil_secure_rng_add_bytes(const char *buf, size_t n)
 	    n>(size_t)INT_MAX ? INT_MAX : (int)n);
 }
 
+#endif
+
 void
 evutil_free_secure_rng_globals_(void)
 {
diff --git a/include/event2/util.h b/include/event2/util.h
index dd4bbb6..a9a169d 100644
--- a/include/event2/util.h
+++ b/include/event2/util.h
@@ -841,7 +841,7 @@ int evutil_secure_rng_init(void);
  */
 EVENT2_EXPORT_SYMBOL
 int evutil_secure_rng_set_urandom_device_file(char *fname);
-
+#ifdef HAVE_ARC4RANDOM_ADDRANDOM
 /** Seed the random number generator with extra random bytes.
 
     You should almost never need to call this function; it should be
@@ -858,7 +858,7 @@ int evutil_secure_rng_set_urandom_device_file(char *fname);
  */
 EVENT2_EXPORT_SYMBOL
 void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
-
+#endif
 #ifdef __cplusplus
 }
 #endif
-- 
2.14.3