ipc/chromium/src/third_party/libevent/openbsd-no-arc4random_addrandom.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/third_party/libevent/openbsd-no-arc4random_addrandom.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +# HG changeset patch
     1.5 +# User Landry Breuil <landry@openbsd.org>
     1.6 +# Date 1384377262 -3600
     1.7 +#      Wed Nov 13 22:14:22 2013 +0100
     1.8 +# Node ID 026009b2c94dc564413d48df824fabec98e2c631
     1.9 +# Parent  f2b602a5ee27b2e05abe84ea7cbd358dadd2ffb5
    1.10 +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
    1.11 +
    1.12 +diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c
    1.13 +--- a/ipc/chromium/src/third_party/libevent/evutil_rand.c
    1.14 ++++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c
    1.15 +@@ -134,15 +134,16 @@ ev_arc4random_buf(void *buf, size_t n)
    1.16 + #endif /* } !_EVENT_HAVE_ARC4RANDOM */
    1.17 + 
    1.18 + void
    1.19 + evutil_secure_rng_get_bytes(void *buf, size_t n)
    1.20 + {
    1.21 + 	ev_arc4random_buf(buf, n);
    1.22 + }
    1.23 + 
    1.24 ++#ifndef __OpenBSD__
    1.25 + void
    1.26 + evutil_secure_rng_add_bytes(const char *buf, size_t n)
    1.27 + {
    1.28 + 	arc4random_addrandom((unsigned char*)buf,
    1.29 + 	    n>(size_t)INT_MAX ? INT_MAX : (int)n);
    1.30 + }
    1.31 +-
    1.32 ++#endif
    1.33 +diff --git a/ipc/chromium/src/third_party/libevent/include/event2/util.h b/ipc/chromium/src/third_party/libevent/include/event2/util.h
    1.34 +--- a/ipc/chromium/src/third_party/libevent/include/event2/util.h
    1.35 ++++ b/ipc/chromium/src/third_party/libevent/include/event2/util.h
    1.36 +@@ -667,29 +667,31 @@ void evutil_secure_rng_get_bytes(void *b
    1.37 +  * numbers.  You only need to call it if (a) you want to double-check
    1.38 +  * that one of the seeding methods did succeed, or (b) you plan to drop
    1.39 +  * the capability to seed (by chrooting, or dropping capabilities, or
    1.40 +  * whatever), and you want to make sure that seeding happens before your
    1.41 +  * program loses the ability to do it.
    1.42 +  */
    1.43 + int evutil_secure_rng_init(void);
    1.44 + 
    1.45 ++#ifndef __OpenBSD__
    1.46 + /** Seed the random number generator with extra random bytes.
    1.47 + 
    1.48 +     You should almost never need to call this function; it should be
    1.49 +     sufficient to invoke evutil_secure_rng_init(), or let Libevent take
    1.50 +     care of calling evutil_secure_rng_init() on its own.
    1.51 + 
    1.52 +     If you call this function as a _replacement_ for the regular
    1.53 +     entropy sources, then you need to be sure that your input
    1.54 +     contains a fairly large amount of strong entropy.  Doing so is
    1.55 +     notoriously hard: most people who try get it wrong.  Watch out!
    1.56 + 
    1.57 +     @param dat a buffer full of a strong source of random numbers
    1.58 +     @param datlen the number of bytes to read from datlen
    1.59 +  */
    1.60 + void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
    1.61 ++#endif
    1.62 + 
    1.63 + #ifdef __cplusplus
    1.64 + }
    1.65 + #endif
    1.66 + 
    1.67 + #endif /* _EVUTIL_H_ */

mercurial