Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 # HG changeset patch
2 # User Landry Breuil <landry@openbsd.org>
3 # Date 1384377262 -3600
4 # Wed Nov 13 22:14:22 2013 +0100
5 # Node ID 026009b2c94dc564413d48df824fabec98e2c631
6 # Parent f2b602a5ee27b2e05abe84ea7cbd358dadd2ffb5
7 Bug 931354: OpenBSD doesn't provide arc4random_addrandom anymore, fix libevent accordingly by #ifndef'ing out its caller evutil_secure_rng_add_bytes() (which isnt called anywhere) r=joshaas
9 diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c
10 --- a/ipc/chromium/src/third_party/libevent/evutil_rand.c
11 +++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c
12 @@ -134,15 +134,16 @@ ev_arc4random_buf(void *buf, size_t n)
13 #endif /* } !_EVENT_HAVE_ARC4RANDOM */
15 void
16 evutil_secure_rng_get_bytes(void *buf, size_t n)
17 {
18 ev_arc4random_buf(buf, n);
19 }
21 +#ifndef __OpenBSD__
22 void
23 evutil_secure_rng_add_bytes(const char *buf, size_t n)
24 {
25 arc4random_addrandom((unsigned char*)buf,
26 n>(size_t)INT_MAX ? INT_MAX : (int)n);
27 }
28 -
29 +#endif
30 diff --git a/ipc/chromium/src/third_party/libevent/include/event2/util.h b/ipc/chromium/src/third_party/libevent/include/event2/util.h
31 --- a/ipc/chromium/src/third_party/libevent/include/event2/util.h
32 +++ b/ipc/chromium/src/third_party/libevent/include/event2/util.h
33 @@ -667,29 +667,31 @@ void evutil_secure_rng_get_bytes(void *b
34 * numbers. You only need to call it if (a) you want to double-check
35 * that one of the seeding methods did succeed, or (b) you plan to drop
36 * the capability to seed (by chrooting, or dropping capabilities, or
37 * whatever), and you want to make sure that seeding happens before your
38 * program loses the ability to do it.
39 */
40 int evutil_secure_rng_init(void);
42 +#ifndef __OpenBSD__
43 /** Seed the random number generator with extra random bytes.
45 You should almost never need to call this function; it should be
46 sufficient to invoke evutil_secure_rng_init(), or let Libevent take
47 care of calling evutil_secure_rng_init() on its own.
49 If you call this function as a _replacement_ for the regular
50 entropy sources, then you need to be sure that your input
51 contains a fairly large amount of strong entropy. Doing so is
52 notoriously hard: most people who try get it wrong. Watch out!
54 @param dat a buffer full of a strong source of random numbers
55 @param datlen the number of bytes to read from datlen
56 */
57 void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
58 +#endif
60 #ifdef __cplusplus
61 }
62 #endif
64 #endif /* _EVUTIL_H_ */