michael@0: # HG changeset patch michael@0: # User Landry Breuil michael@0: # Date 1384377262 -3600 michael@0: # Wed Nov 13 22:14:22 2013 +0100 michael@0: # Node ID 026009b2c94dc564413d48df824fabec98e2c631 michael@0: # Parent f2b602a5ee27b2e05abe84ea7cbd358dadd2ffb5 michael@0: 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: michael@0: diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c michael@0: --- a/ipc/chromium/src/third_party/libevent/evutil_rand.c michael@0: +++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c michael@0: @@ -134,15 +134,16 @@ ev_arc4random_buf(void *buf, size_t n) michael@0: #endif /* } !_EVENT_HAVE_ARC4RANDOM */ michael@0: michael@0: void michael@0: evutil_secure_rng_get_bytes(void *buf, size_t n) michael@0: { michael@0: ev_arc4random_buf(buf, n); michael@0: } michael@0: michael@0: +#ifndef __OpenBSD__ michael@0: void michael@0: evutil_secure_rng_add_bytes(const char *buf, size_t n) michael@0: { michael@0: arc4random_addrandom((unsigned char*)buf, michael@0: n>(size_t)INT_MAX ? INT_MAX : (int)n); michael@0: } michael@0: - michael@0: +#endif michael@0: 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: --- a/ipc/chromium/src/third_party/libevent/include/event2/util.h michael@0: +++ b/ipc/chromium/src/third_party/libevent/include/event2/util.h michael@0: @@ -667,29 +667,31 @@ void evutil_secure_rng_get_bytes(void *b michael@0: * numbers. You only need to call it if (a) you want to double-check michael@0: * that one of the seeding methods did succeed, or (b) you plan to drop michael@0: * the capability to seed (by chrooting, or dropping capabilities, or michael@0: * whatever), and you want to make sure that seeding happens before your michael@0: * program loses the ability to do it. michael@0: */ michael@0: int evutil_secure_rng_init(void); michael@0: michael@0: +#ifndef __OpenBSD__ michael@0: /** Seed the random number generator with extra random bytes. michael@0: michael@0: You should almost never need to call this function; it should be michael@0: sufficient to invoke evutil_secure_rng_init(), or let Libevent take michael@0: care of calling evutil_secure_rng_init() on its own. michael@0: michael@0: If you call this function as a _replacement_ for the regular michael@0: entropy sources, then you need to be sure that your input michael@0: contains a fairly large amount of strong entropy. Doing so is michael@0: notoriously hard: most people who try get it wrong. Watch out! michael@0: michael@0: @param dat a buffer full of a strong source of random numbers michael@0: @param datlen the number of bytes to read from datlen michael@0: */ michael@0: void evutil_secure_rng_add_bytes(const char *dat, size_t datlen); michael@0: +#endif michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif michael@0: michael@0: #endif /* _EVUTIL_H_ */