summaryrefslogtreecommitdiffstats
path: root/ipc/chromium/src/third_party/libevent/patches/openbsd-no-arc4random_addrandom.patch
blob: cbb77be7e0e8513ebb2fe1ceda3aec66bafba296 (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
diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c
--- a/ipc/chromium/src/third_party/libevent/evutil_rand.c
+++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c
@@ -187,20 +187,22 @@ ev_arc4random_buf(void *buf, size_t n)
 #endif /* } !EVENT__HAVE_ARC4RANDOM */
 
 void
 evutil_secure_rng_get_bytes(void *buf, size_t n)
 {
 	ev_arc4random_buf(buf, n);
 }
 
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(ANDROID)
 void
 evutil_secure_rng_add_bytes(const char *buf, size_t n)
 {
 	arc4random_addrandom((unsigned char*)buf,
 	    n>(size_t)INT_MAX ? INT_MAX : (int)n);
 }
+#endif
 
 void
 evutil_free_secure_rng_globals_(void)
 {
     evutil_free_secure_rng_globals_locks();
 }
diff --git a/ipc/chromium/src/third_party/libevent/include/event2/util.h b/ipc/chromium/src/third_party/libevent/include/event2/util.h
--- a/ipc/chromium/src/third_party/libevent/include/event2/util.h
+++ b/ipc/chromium/src/third_party/libevent/include/event2/util.h
@@ -837,30 +837,32 @@ int evutil_secure_rng_init(void);
  * user of the secure RNG might be running. Don't pass anything other than a
  * real /dev/...random device file here, or you might lose security.)
  *
  * This API is unstable, and might change in a future libevent version.
  */
 EVENT2_EXPORT_SYMBOL
 int evutil_secure_rng_set_urandom_device_file(char *fname);
 
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(ANDROID)
 /** Seed the random number generator with extra random bytes.
 
     You should almost never need to call this function; it should be
     sufficient to invoke evutil_secure_rng_init(), or let Libevent take
     care of calling evutil_secure_rng_init() on its own.
 
     If you call this function as a _replacement_ for the regular
     entropy sources, then you need to be sure that your input
     contains a fairly large amount of strong entropy.  Doing so is
     notoriously hard: most people who try get it wrong.  Watch out!
 
     @param dat a buffer full of a strong source of random numbers
     @param datlen the number of bytes to read from datlen
  */
 EVENT2_EXPORT_SYMBOL
 void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
+#endif
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* EVENT1_EVUTIL_H_INCLUDED_ */