diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-04-16 14:54:39 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-16 22:03:09 -0400 |
commit | e6785ee16dce675aa770616bcdbd128d5dfb1132 (patch) | |
tree | 3f5c1b6d827946b36c1aaff010265e9dec432d4f /src/common/compat_libevent.h | |
parent | 156eefca454e10440d1070f7500e1708589fc64b (diff) | |
download | tor-e6785ee16dce675aa770616bcdbd128d5dfb1132.tar.gz tor-e6785ee16dce675aa770616bcdbd128d5dfb1132.zip |
Get Libevent's PRNG functioning under the linux sandbox
Libevent uses an arc4random implementation (I know, I know) to
generate DNS transaction IDs and capitalization. But it liked to
initialize it either with opening /dev/urandom (which won't work
under the sandbox if it doesn't use the right pointer), or with
sysctl({CTL_KERN,KERN_RANDOM,RANDOM_UUIC}). To make _that_ work, we
were permitting sysctl unconditionally. That's not such a great
idea.
Instead, we try to initialize the libevent PRNG _before_ installing
the sandbox, and make sysctl always fail with EPERM under the
sandbox.
Diffstat (limited to 'src/common/compat_libevent.h')
-rw-r--r-- | src/common/compat_libevent.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h index f0d1828b7b..9ee7b49cfb 100644 --- a/src/common/compat_libevent.h +++ b/src/common/compat_libevent.h @@ -89,6 +89,8 @@ int tor_add_bufferevent_to_rate_limit_group(struct bufferevent *bev, struct bufferevent_rate_limit_group *g); #endif +int tor_init_libevent_rng(void); + void tor_gettimeofday_cached(struct timeval *tv); void tor_gettimeofday_cache_clear(void); #ifdef TOR_UNIT_TESTS |