commit e788c577f11ef4c0309e9d5298bf57639c0ebb06 Author: Nick Mathewson nickm@torproject.org Date: Thu Aug 11 20:37:18 2016 -0400
Only use evutil_secure_rng_add_bytes() when present.
OpenBSD removes this function, and now that Tor requires Libevent 2, we should also support the OpenBSD Libevent 2.
Fixes bug 19904; bugfix on 0.2.5.4-alpha. --- changes/bug19904 | 4 ++++ configure.ac | 4 +++- src/common/compat_libevent.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/changes/bug19904 b/changes/bug19904 new file mode 100644 index 0000000..217d82d --- /dev/null +++ b/changes/bug19904 @@ -0,0 +1,4 @@ + o Minor bugfixes (compilation): + - Build correctly on versions of libevent2 without support + for evutil_secure_rng_add_bytes(). Fixes bug 19904; + bugfix on 0.2.5.4-alpha. diff --git a/configure.ac b/configure.ac index be7c4e8..a1a55e1 100644 --- a/configure.ac +++ b/configure.ac @@ -500,7 +500,9 @@ save_CPPFLAGS="$CPPFLAGS" LIBS="-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $LIBS" LDFLAGS="$TOR_LDFLAGS_libevent $LDFLAGS" CPPFLAGS="$TOR_CPPFLAGS_libevent $CPPFLAGS" -AC_CHECK_FUNCS([evutil_secure_rng_set_urandom_device_file]) +AC_CHECK_FUNCS([evutil_secure_rng_set_urandom_device_file \ + evutil_secure_rng_add_bytes \ +])
LIBS="$STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $save_LIBS"
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c index 4dab544..055d6a8 100644 --- a/src/common/compat_libevent.c +++ b/src/common/compat_libevent.c @@ -337,7 +337,9 @@ tor_init_libevent_rng(void) rv = -1; } crypto_rand(buf, 32); +#ifdef HAVE_EVUTIL_SECURE_RNG_ADD_BYTES evutil_secure_rng_add_bytes(buf, 32); +#endif evutil_secure_rng_get_bytes(buf, sizeof(buf)); return rv; }