summaryrefslogtreecommitdiff
path: root/src/common/compat_libevent.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-08-11 20:37:18 -0400
committerNick Mathewson <nickm@torproject.org>2016-08-11 20:37:18 -0400
commite788c577f11ef4c0309e9d5298bf57639c0ebb06 (patch)
tree9f53f02ba7fcc8317299c93a471aeac71d8c3979 /src/common/compat_libevent.c
parent60997a00e8e7585e076c750ab37095c0bfc3c773 (diff)
downloadtor-e788c577f11ef4c0309e9d5298bf57639c0ebb06.tar.gz
tor-e788c577f11ef4c0309e9d5298bf57639c0ebb06.zip
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.
Diffstat (limited to 'src/common/compat_libevent.c')
-rw-r--r--src/common/compat_libevent.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 4dab54493f..055d6a8500 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;
}