arc4random.c


Log

Author Commit Date CI Message
Nick Mathewson 27931976 2012-02-11T21:20:47 Merge remote-tracking branch 'origin/patches-2.0'
Ross Lagerwall d2b5f722 2012-02-11T17:23:17 Make uses of open() close-on-exec safe by introducing evutil_open_closeonexec. In a multi-process/threaded environment, opening fds internally without the close-on-exec flag could leak fds to child processes.
Nick Mathewson 539466e5 2012-02-10T17:33:50 Merge remote-tracking branch 'origin/patches-2.0' Conflicts: Makefile.am WIN32-Code/event2/event-config.h configure.in
Nick Mathewson e49e2891 2012-02-10T17:29:53 Update copyright notices to 2012
Nick Mathewson d4306028 2011-12-08T11:43:04 Merge remote-tracking branch 'origin/patches-2.0' Conflicts: configure.in
Mike Frysinger 358c745e 2011-12-08T11:39:48 check for sysctl before we use it Not all C libraries under Linux support the sysctl() func.
Nick Mathewson 9f560bfa 2011-05-25T19:50:56 Use "_WIN32", not WIN32: it's standard and we don't need to fake it This patch was automatically generated with perl. Based on a patch by Peter Rosin.
Nick Mathewson 9f5bf663 2011-02-08T22:24:51 Merge remote branch 'origin/patches-2.0'
Nick Mathewson f7361980 2011-02-08T22:24:06 Fix a type error in our (unused) arc4random_stir()
Kevin Bowling ded0a090 2011-01-07T00:41:37 Add evconfig-private to remaining files
Nick Mathewson 9c8db0f8 2010-09-23T22:45:55 Fix all warnings in the main codebase flagged by -Wsigned-compare Remember, the code int is_less_than(int a, unsigned b) { return a < b; } is buggy, since the C integer promotion rules basically turn it into int is_less_than(int a, unsigned b) { return ((unsigned)a) < b; } and we really want something closer to int is_less_than(int a, unsigned b) { return a < 0 || ((unsigned)a) < b; } . Suggested by an example from Ralph Castain
Nick Mathewson c44de06c 2010-05-08T18:09:27 Numerous opensolaris compilation fixes For future note, opensolaris doesn't have sys/sysctl.h, doesn't like comparing iov_buf to a chain_space_ptr without a cast, and is (predictably) unforgiving of dumb syntax errors. Also, we had accidentally broken the devpoll backend test in configure.in
Nick Mathewson 90d42251 2010-05-08T15:31:54 Fix some crazy macro mistakes in arc4random.c
Nick Mathewson 20fda296 2010-05-03T13:00:00 Try /proc on Linux as entropy fallback; use sysctl as last resort It turns out that the happy fun Linux kernel is deprecating sysctl, and using sysctl to fetch entropy will spew messages in the kernel logs. Let's not do that. Instead, let's call sysctl for our entropy only when all other means fail. Additionally, let's add another means, and try /proc/sys/kernel/random/uuid if /dev/urandom fails.
Nick Mathewson a47a4b7e 2010-04-23T16:08:09 Fix a couple of bugs in the BSD sysctl arc4seed logic Of course, FreeBSD has its own arc4random() implementation, so this should never actually be needed. Still, it's good to paint the underside of the wagon.
Nick Mathewson 71fc3eb0 2010-03-04T01:13:51 Seed the RNG using sysctl() as well as /dev/urandom William Ahern points out that if the user has chrooted, they might not have a working /dev/urandom. Linux and many of the BSDs, however, define a sysctl interface to their kernel random number generators. This patch takes a belt-and-suspenders approach and tries to do use the sysctl _and_ the /dev/urandom approach if both are present. When using the sysctl approach, it tries to bulletproof itself by checking to make sure that the buffers are actually set by the sysctl calls.
Nick Mathewson 98edb891 2010-02-25T17:14:41 Fix arc4random compilation on MSVC.
Nick Mathewson ff2a134d 2010-02-18T00:54:44 Fix getpid() usage on Windows On Windows, getpid() is _getpid(), and requires that we first include <process.h>. arc4random.c previously didn't know that. Actually, I question whether arc4random needs to do its getpid() tricks on Windows. They exist only so that we remember to re-seed the ARC4 cipher whenever we fork... but Windows has no fork(), so I think we're in the clear.
Nick Mathewson 4ec8fea6 2010-02-13T00:11:44 Make RNG work when we have arc4random() but not arc4random_buf()
Nick Mathewson d4de062e 2010-02-10T17:19:18 Add an arc4random implementation for use by evdns Previously, evdns was at the mercy of the user for providing a good entropy source; without one, it would be vulnerable to various active attacks. This patch adds a port of OpenBSD's arc4random() calls to Libevent [port by Chris Davis], and wraps it up a little bit so we can use it more safely.