Nick Mathewson [Wed, 12 Feb 2014 16:56:29 +0000 (11:56 -0500)]
Split crypto_global_init() into pre/post config
It's increasingly apparent that we want to make sure we initialize our
PRNG nice and early, or else OpenSSL will do it for us. (OpenSSL
doesn't do _too_ bad a job, but it's nice to do it ourselves.)
We'll also need this for making sure we initialize the siphash key
before we do any hashes.
Nick Mathewson [Fri, 7 Feb 2014 22:38:16 +0000 (17:38 -0500)]
Siphash-2-4 is now our hash in nearly all cases.
I've made an exception for cases where I'm sure that users can't
influence the inputs. This is likely to cause a slowdown somewhere,
but it's safer to siphash everything and *then* look for cases to
optimize.
This patch doesn't actually get us any _benefit_ from siphash yet,
since we don't really randomize the key at any point.
Nick Mathewson [Wed, 12 Feb 2014 15:09:45 +0000 (10:09 -0500)]
Raw import of Marek Majkowski's cisphash.c
siphash is a hash function designed for producing hard-to-predict
64-bit outputs from short inputs and a 128-bit key. It's chosen for
security and speed.
See https://131002.net/siphash/ for more information on siphash.
Karsten Loesing [Tue, 11 Feb 2014 07:44:35 +0000 (08:44 +0100)]
Add changes file for ticket 10842.
This is a bugfix on 0.2.2.26-beta, because 6b83b3b made directory
authorities remove themselves from the list of directory authorities to
upload to, but didn't suppress the warning in case they're the only
directory authority in the network.
Nick Mathewson [Fri, 7 Feb 2014 22:36:11 +0000 (17:36 -0500)]
Survive fedora's openssl in our benchmarks
Apparently fedora currently has ECDH but not P224. This isn't a huge
deal, since we no longer use OpenSSL's P224 ever (see #9780 and 72c1e5acfe1c6). But we shouldn't have segfaulting benchmarks really.
Nick Mathewson [Fri, 7 Feb 2014 17:01:16 +0000 (12:01 -0500)]
Remove a needless check in channel_tls_handle_incoming
This patch removes an "if (chan)" that occurred at a place where
chan was definitely non-NULL. Having it there made some static
analysis tools conclude that we were up to shenanigans.
Nick Mathewson [Thu, 6 Feb 2014 22:08:50 +0000 (17:08 -0500)]
Discard circuit paths on which nobody supports ntor
Right now this accounts for about 1% of circuits over all, but if you
pick a guard that's running 0.2.3, it will be about 6% of the circuits
running through that guard.
Making sure that every circuit has at least one ntor link means that
we're getting plausibly good forward secrecy on every circuit.
Nick Mathewson [Fri, 17 Jan 2014 18:39:04 +0000 (13:39 -0500)]
Make the handling for usable-exit counting handle ExitNodes better
It's possible to set your ExitNodes to contains only exits that don't
have the Exit flag. If you do that, we'll decide that 0 of your exits
are working. Instead, in that case we should look at nodes which have
(or which might have) exit policies that don't reject everything.
Nick Mathewson [Mon, 3 Feb 2014 21:12:30 +0000 (16:12 -0500)]
Clean up test_hs.c: warning fix; tor_free() usage.
My OSX laptop rightly gave a warning because of sticking strlen() into
an int, but once I took a closer look... it appears that the strlen()
was part of a needlessly verbose implementation for tor_strdup().
While I was there, I fixed the usage of tor_free() in test_hs.c: It
checks for NULL, and it zeros its argument. So instead of
if (foo) {
tor_free(foo);
foo = NULL;
}
we should just say
tor_free(foo);
Nick Mathewson [Mon, 3 Feb 2014 16:34:13 +0000 (11:34 -0500)]
slownacl's pure-python curve25519 lets us test ntor everywhere.
Improvement on f308adf8382bc7e61ea05a172, where we made the ntor
unit tests run everywhere... so long as a python curve25519 module
was installed. Now the unit tests don't require that module.
Nick Mathewson [Sun, 2 Feb 2014 20:45:00 +0000 (15:45 -0500)]
Move the friendly warning about TPROXY and root to EPERM time
I'm doing this because:
* User doesn't mean you're running as root, and running as root
doesn't mean you've set User.
* It's possible that the user has done some other
capability-based hack to retain the necessary privileges.
Nick Mathewson [Wed, 29 Jan 2014 20:17:05 +0000 (15:17 -0500)]
Rip out all of the v2 directory code.
The remaining vestige is that we continue to publish the V2dir flag,
and that, for the controller, we continue to emit v2 directory
formats when requested.
Nick Mathewson [Fri, 24 Jan 2014 17:56:10 +0000 (12:56 -0500)]
Apply StrictNodes to hidden service directories early
Previously, we would sometimes decide in directory_get_from_hs_dir()
to connect to an excluded node, and then later in
directory_initiate_command_routerstatus_rend() notice that it was
excluded and strictnodes was set, and catch it as a stopgap.
Additionally, this patch preferentially tries to fetch from
non-excluded nodes even when StrictNodes is off.
Fix for bug #10722. Bugfix on 0.2.0.10-alpha (the v2 hidserv directory
system was introduced in e136f00ca). Reported by "mr-4".
Nick Mathewson [Sat, 21 Dec 2013 15:15:09 +0000 (10:15 -0500)]
Fix a logic error in circuit_stream_is_being_handled.
When I introduced the unusable_for_new_circuits flag in 62fb209d837f3f551, I had a spurious ! in the
circuit_stream_is_being_handled loop. This made us decide that
non-unusable circuits (that is, usable ones) were the ones to avoid,
and caused it to launch a bunch of extra circuits.
Nick Mathewson [Wed, 18 Dec 2013 16:49:44 +0000 (11:49 -0500)]
Never allow OpenSSL engines to replace the RAND_SSLeay method
This fixes bug 10402, where the rdrand engine would use the rdrand
instruction, not as an additional entropy source, but as a replacement
for the entire userspace PRNG. That's obviously stupid: even if you
don't think that RDRAND is a likely security risk, the right response
to an alleged new alleged entropy source is never to throw away all
previously used entropy sources.
Thanks to coderman and rl1987 for diagnosing and tracking this down.