Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # HG changeset patch |
michael@0 | 2 | # User Landry Breuil <landry@openbsd.org> |
michael@0 | 3 | # Date 1384377262 -3600 |
michael@0 | 4 | # Wed Nov 13 22:14:22 2013 +0100 |
michael@0 | 5 | # Node ID 026009b2c94dc564413d48df824fabec98e2c631 |
michael@0 | 6 | # Parent f2b602a5ee27b2e05abe84ea7cbd358dadd2ffb5 |
michael@0 | 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 |
michael@0 | 8 | |
michael@0 | 9 | diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c |
michael@0 | 10 | --- a/ipc/chromium/src/third_party/libevent/evutil_rand.c |
michael@0 | 11 | +++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c |
michael@0 | 12 | @@ -134,15 +134,16 @@ ev_arc4random_buf(void *buf, size_t n) |
michael@0 | 13 | #endif /* } !_EVENT_HAVE_ARC4RANDOM */ |
michael@0 | 14 | |
michael@0 | 15 | void |
michael@0 | 16 | evutil_secure_rng_get_bytes(void *buf, size_t n) |
michael@0 | 17 | { |
michael@0 | 18 | ev_arc4random_buf(buf, n); |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | +#ifndef __OpenBSD__ |
michael@0 | 22 | void |
michael@0 | 23 | evutil_secure_rng_add_bytes(const char *buf, size_t n) |
michael@0 | 24 | { |
michael@0 | 25 | arc4random_addrandom((unsigned char*)buf, |
michael@0 | 26 | n>(size_t)INT_MAX ? INT_MAX : (int)n); |
michael@0 | 27 | } |
michael@0 | 28 | - |
michael@0 | 29 | +#endif |
michael@0 | 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 |
michael@0 | 31 | --- a/ipc/chromium/src/third_party/libevent/include/event2/util.h |
michael@0 | 32 | +++ b/ipc/chromium/src/third_party/libevent/include/event2/util.h |
michael@0 | 33 | @@ -667,29 +667,31 @@ void evutil_secure_rng_get_bytes(void *b |
michael@0 | 34 | * numbers. You only need to call it if (a) you want to double-check |
michael@0 | 35 | * that one of the seeding methods did succeed, or (b) you plan to drop |
michael@0 | 36 | * the capability to seed (by chrooting, or dropping capabilities, or |
michael@0 | 37 | * whatever), and you want to make sure that seeding happens before your |
michael@0 | 38 | * program loses the ability to do it. |
michael@0 | 39 | */ |
michael@0 | 40 | int evutil_secure_rng_init(void); |
michael@0 | 41 | |
michael@0 | 42 | +#ifndef __OpenBSD__ |
michael@0 | 43 | /** Seed the random number generator with extra random bytes. |
michael@0 | 44 | |
michael@0 | 45 | You should almost never need to call this function; it should be |
michael@0 | 46 | sufficient to invoke evutil_secure_rng_init(), or let Libevent take |
michael@0 | 47 | care of calling evutil_secure_rng_init() on its own. |
michael@0 | 48 | |
michael@0 | 49 | If you call this function as a _replacement_ for the regular |
michael@0 | 50 | entropy sources, then you need to be sure that your input |
michael@0 | 51 | contains a fairly large amount of strong entropy. Doing so is |
michael@0 | 52 | notoriously hard: most people who try get it wrong. Watch out! |
michael@0 | 53 | |
michael@0 | 54 | @param dat a buffer full of a strong source of random numbers |
michael@0 | 55 | @param datlen the number of bytes to read from datlen |
michael@0 | 56 | */ |
michael@0 | 57 | void evutil_secure_rng_add_bytes(const char *dat, size_t datlen); |
michael@0 | 58 | +#endif |
michael@0 | 59 | |
michael@0 | 60 | #ifdef __cplusplus |
michael@0 | 61 | } |
michael@0 | 62 | #endif |
michael@0 | 63 | |
michael@0 | 64 | #endif /* _EVUTIL_H_ */ |