Commit Graph

10059 Commits

Author SHA1 Message Date
George Kadianakis
782c907c7c s/DynamicPrimes/DynamicDHGroups/g 2011-11-25 01:00:14 +01:00
George Kadianakis
bdeb797a13 Notify the user that her computer is generating numbers. 2011-11-25 00:59:47 +01:00
George Kadianakis
5f3f41c234 Make sure that the stored DH prime is safe to use. 2011-11-25 00:33:40 +01:00
George Kadianakis
94076d9e3b Move crypto_get_stored_dynamic_prime() to crypto.c 2011-11-24 22:59:01 +01:00
George Kadianakis
2ef68980a7 Move store_dynamic_prime() to crypto.c. 2011-11-24 22:32:10 +01:00
George Kadianakis
cabb8e54c7 Tone down the logging. 2011-11-24 22:14:09 +01:00
George Kadianakis
8a726dd0dd Implement dynamic prime reading and storing to disk. 2011-11-24 22:13:44 +01:00
George Kadianakis
42bda231ee Make DynamicPrimes SIGHUP-able.
Instead of passing the DynamicPrimes configuration option to
crypto_global_init(), generate and set a new TLS DH prime when we read
the torrc.
2011-11-24 22:13:38 +01:00
George Kadianakis
0e71be5d94 Improve code in the dynamic primes realm. 2011-11-24 22:13:19 +01:00
George Kadianakis
fb38e58d14 Improve logging. 2011-11-24 22:13:00 +01:00
George Kadianakis
1797e0a39e Make it compile. 2011-11-24 22:12:44 +01:00
George Kadianakis
375e55eaa2 Rename "Rakshasa" to "Dynamic Prime". 2011-11-24 22:09:15 +01:00
George Kadianakis
659381e00d Introduce the DynamicPrimes configuration option. 2011-11-24 22:09:06 +01:00
George Kadianakis
edec9409e8 Copy/Paste Jake's stuff.
This commit copies parts of Jake's
f3bb6846975193d9a6649c31f94bda47e4014070 commit verbatim to the
current master.
2011-11-24 22:06:50 +01:00
Robert Ransom
b2212bf9b4 Add Tor2webMode configuration option 2011-11-24 03:54:32 -08:00
Sebastian Hahn
f77f9bddb8 appease check-spaces 2011-11-24 09:20:51 +01:00
Sebastian Hahn
46d69cb915 Fix compile warning in tor_inet_pton() (on 64bit)
This slipped through into 0.2.3.8-alpha unfortunately.
2011-11-24 09:19:57 +01:00
Nick Mathewson
3ebe960f3f Detect tor_addr_to_str failure in tor_dup_addr.
This avoids a possible strdup of an uninitialized buffer.

Fixes 4529; fix on 0.2.1.3-alpha; reported by troll_un.
2011-11-23 23:04:10 -05:00
Nick Mathewson
f067067ee6 Merge branch 'bug2474'
Had to resolve conflicts wrt the " (using bufferevents)" addition to the
startup string.

Conflicts:
	src/or/main.c
2011-11-23 17:14:54 -05:00
Nick Mathewson
2b4d4ffa8f Tweak the "this is not a stable release" warning some more 2011-11-23 17:09:36 -05:00
Nick Mathewson
3890c81e7c Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-23 16:28:18 -05:00
Nick Mathewson
fbf1c5ee79 Merge remote-tracking branch 'public/bug4230' into maint-0.2.2 2011-11-23 16:22:26 -05:00
Sebastian Hahn
841247a586 Fix a compile warning on 64bit OS X
Backport of 68475fc5c5 which accidentally
only made it into master. Fixes bug 4547. Bug isn't in any released
version.
2011-11-23 12:06:55 -05:00
Roger Dingledine
dfe6dac37c bump to 0.2.3.8-alpha-dev 2011-11-23 04:41:19 -05:00
Sebastian Hahn
68475fc5c5 Fix a compile warning on 64bit OS X 2011-11-23 01:41:37 +01:00
Roger Dingledine
a58d9e6045 bump to 0.2.3.8-alpha 2011-11-22 18:29:57 -05:00
Roger Dingledine
fce107b11e raise AuthDirFastGuarantee from 20KB to 100KB
This patch reverts part of 39ceda7e05 (where it used to be 100KB).
2011-11-21 18:44:59 -05:00
Roger Dingledine
58764d8ec6 apparently or_options_t likes being a const in master 2011-11-21 18:42:07 -05:00
Roger Dingledine
6a76007b08 Merge branch 'maint-0.2.2'
Conflicts:
	src/or/dirserv.c
2011-11-21 18:36:49 -05:00
Roger Dingledine
c0ec4eafc5 parameterize bw cutoffs to guarantee Fast and Guard flags
Now it will be easier for researchers to simulate Tor networks with
different values. Resolves ticket 4484.
2011-11-21 18:22:10 -05:00
Nick Mathewson
f4e053d6df Merge branch 'bug4518' into maint-0.2.2 2011-11-21 17:25:51 -05:00
Nick Mathewson
929074b368 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-21 10:52:38 -05:00
Nick Mathewson
b3c988f0d7 Merge remote-tracking branch 'public/bug3963' into maint-0.2.2 2011-11-21 10:52:15 -05:00
Nick Mathewson
0539c34c35 Merge branch 'bug4360' 2011-11-21 10:48:02 -05:00
Sebastian Hahn
2efa6eb652 Sockets are unsigned on windows
this gets rid of a warning about signed/unsigned comparison

This is a backport of 0a5338e03c that
accidentally only went into master
2011-11-20 15:15:14 +01:00
Nick Mathewson
7992eb43c5 Log more loudly on a bad cert from an authority.
Clock skew made this situation way too frequent so we demoted it to
"protocol_warn", but when there's an authority, it should really just
be warn.
2011-11-20 00:48:25 -05:00
Sebastian Hahn
3dc2a1c62c Get rid of an unused parameter warning on win
This is a backport of bed79c47f4 which
accidentally only went into master
2011-11-20 03:02:28 +01:00
Nick Mathewson
8e388bc39c Only call cull_wedged_cpuworkers once every 60 seconds.
The function is over 10 or 20% on some of Moritz's profiles, depending
on how you could.

Since it's checking for a multi-hour timeout, this is safe to do.

Fixes bug 4518.
2011-11-19 18:30:55 -05:00
Anders Sundman
725d4f035c Imporved unit test coverage for tor_inet_pton 2011-11-19 10:58:33 +01:00
Anders Sundman
edc561432a Minor tor_inet_pton bug fixes
In particular:
* Disallow "0x10::"
* Don't blow up on ":"
* Disallow "::10000"
2011-11-19 10:58:33 +01:00
Nick Mathewson
53dac6df18 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-18 19:09:08 -05:00
Sebastian Hahn
6ef44b7849 Don't log about stats when running as a client without geoip
Completely disable stats if we aren't running as a relay. We won't
collect any anyway, so setting up the infrastructure for them and
logging about them is wrong. This also removes a confusing log
message that clients without a geoip db would have seen.

Fixes bug 4353.
2011-11-19 00:50:03 +01:00
Nick Mathewson
b88db7573c Merge remote-tracking branch 'public/benchmark' 2011-11-18 18:42:49 -05:00
Nick Mathewson
6e6a661296 New UserspaceIOCPBuffers option to set SO_{SND,RCV}BUF to zero
When running with IOCP, we are in theory able to use userspace-
allocated buffers to avoid filling up the stingy amount of kernel
space allocated for sockets buffers.

The bufferevent_async implementation in Libevent provides this
ability, in theory.  (There are likely to be remaining bugs).  This
patch adds a new option that, when using IOCP bufferevents, sets
each socket's send and receive buffers to 0, so that we should use
this ability.

When all the bugs are worked out here, if we are right about bug 98,
this might solve or mitigate bug 98.

This option is experimental and will likely require lots of testing
and debugging.
2011-11-18 17:43:03 -05:00
Nick Mathewson
6a6233b70b Fix a couple of memory leaks in rend_add_service spotted by coverity 2011-11-17 17:14:49 -05:00
Roger Dingledine
95163ec072 trivial code cleanup in generate_v2_networkstatus_opinion() 2011-11-16 18:59:20 -05:00
Roger Dingledine
3992c5487f fix trivial typo
somebody should s/authoritative directory server/directory authority/g
at some point
2011-11-16 18:10:13 -05:00
Nick Mathewson
2408934516 Merge remote-tracking branch 'sebastian/bug2893' 2011-11-16 17:30:24 -05:00
Nick Mathewson
2f3dad10a8 Merge branch 'bug4457_master' 2011-11-16 16:23:15 -05:00
Nick Mathewson
5a02406ae0 Merge branch 'bug4457_022' into maint-0.2.2 2011-11-16 16:22:47 -05:00
Sebastian Hahn
7bd46344df Eat all whitespace after a control command 2011-11-16 18:14:06 +01:00
Roger Dingledine
67650a869d allow manual control port authenticate via netcat 2011-11-16 18:14:03 +01:00
Sebastian Hahn
8200a85323 Fix a check-spaces complaint 2011-11-16 16:40:56 +01:00
Sebastian Hahn
9fc7725aba Don't allow building on platforms where AF_UNSPEC != 0 2011-11-16 16:39:04 +01:00
Sebastian Hahn
688b53059e Don't fail to send netinfo if real_addr is unset
If we haven't set real_addr on a connection, we also now that _base.addr
hasn't been tampered with. So we can use that.
2011-11-16 16:05:46 +01:00
Nick Mathewson
69dd993a92 Make certificate skew into a protocol warning 2011-11-15 15:57:46 -05:00
Nick Mathewson
87622e4c7e Allow up to a 30 days future skew, 48 hours past skew in certs. 2011-11-15 15:57:41 -05:00
Nick Mathewson
26fcb4bb8c Merge remote-tracking branch 'sebastian/bug4469' 2011-11-15 11:59:37 -05:00
Nick Mathewson
3ef40f6993 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-15 11:42:38 -05:00
Sebastian Hahn
4b8d2ad6f5 Fix compile warnings on windows 2011-11-15 13:34:04 +01:00
Nick Mathewson
5bea660f8e Use real_addr in send_netinfo
Reported by "troll_un"; bugfix on 0.2.0.10-alpha; fixes bug 4349.
2011-11-14 22:43:40 -05:00
Nick Mathewson
4af82fb388 Merge remote-tracking branch 'public/bug4367' 2011-11-14 22:35:49 -05:00
Nick Mathewson
7be50c26e8 Disable IOCP and retry event_base_new_with_config once on failure
This is a fancier bug4457 workaround for 0.2.3.  In 0.2.2, we could
just tell Libevent "Don't enable locking!" so it wouldn't try to make
the event_base notifiable.  But for IOCP, we need a notifiable base.
(Eventually, we'll want a notifiable base for other stuff, like
multithreaded crypto.)  So the solution is to try a full-featured
initialization, and then retry with all the options turned off if that
fails.
2011-11-14 18:12:29 -05:00
Nick Mathewson
cf8117136c Merge remote-tracking branch 'public/bug4457_022' into bug4457_master
Conflicts:
	src/common/compat_libevent.c

Resolving conflict by not taking 7363eae13c ("Use the
EVENT_BASE_FLAG_NOLOCK flag to prevent socketpair() invocation"): in
Tor 0.2.3.x, we _do_ sometimes use notifiable event bases.
2011-11-14 17:59:42 -05:00
Nick Mathewson
0f6c021617 Detect failure from event_init() or event_base_new_with_config() 2011-11-14 17:53:45 -05:00
Nick Mathewson
7363eae13c Use the EVENT_BASE_FLAG_NOLOCK flag to prevent socketpair() invocation
In Tor 0.2.2, we never need the event base to be notifiable, since we
don't call it from other threads.  This is a workaround for bug 4457,
which is not actually a Tor bug IMO.
2011-11-14 17:48:57 -05:00
Nick Mathewson
8592126a18 Merge remote-tracking branch '4ZM/topic/test/4433_address' 2011-11-14 12:53:34 -05:00
Nick Mathewson
9292a78722 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-14 11:10:45 -05:00
Nick Mathewson
2b7bdc295a Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2 2011-11-14 11:10:27 -05:00
Nick Mathewson
13f02c387f Merge remote-tracking branch 'karsten/geoip-november2011' into maint-0.2.1 2011-11-14 11:10:10 -05:00
George Kadianakis
406ae1ba5a Use callback-driven approach to block renegotiations.
Also use this new approach in the bufferevents-enabled case.
2011-11-13 14:47:11 +01:00
Gisle Vanem
af12a7ac00 Fix test_util.c compilation on MSVC
"Those '{}' constructs are not well liked by MSVC (cl v.16.xx)."

Received on tor-dev; fixes bug on 0.2.3.3-alpha.
2011-11-11 23:49:53 -05:00
Nick Mathewson
ce51887291 All-in-one benchmark test for cell crypto 2011-11-11 13:06:17 -05:00
Nick Mathewson
4c9b6df84d Convert bench_dmap to produce reasonable output. 2011-11-11 12:46:22 -05:00
Nick Mathewson
ff93535c71 New src/test/bench.c to allow us to actually _run_ benchmark code
Yes, the timing functions are suboptimal.  Please improve!
2011-11-11 12:35:08 -05:00
Sebastian Hahn
a2ecf131f3 Remove the torint.h include from aes.h
This hasn't been needed for a while, there's nothing in aes.h now that
would need uint* stuff.
2011-11-11 11:47:25 -05:00
Sebastian Hahn
38123ffa23 Fix the bench_{aes,dmap} test functions to work with TT
TT expects them to be named test_bench_{aes,dmap}. Also change the
DISABLED macro to reflect that.
2011-11-11 11:47:25 -05:00
Nick Mathewson
46d236c684 Remove vestiges of RIJNDAEL_COUNTER_OPTIMIZATION 2011-11-11 11:47:25 -05:00
Nick Mathewson
7d8edfcceb Stop using "u32" and "u8" in aes.c 2011-11-11 11:47:24 -05:00
Nick Mathewson
21cf7079fe Dump our internal AES implementation
This thing was pretty pointless on versions of OpenSSL 0.9.8 and later,
and almost totally pointless on OpenSSL 1.0.0.

Also, favor EVP by default, since it lets us get hardware acceleration
where present.  (See issue 4442)
2011-11-11 11:47:24 -05:00
Nick Mathewson
d348cfdbdf Merge remote-tracking branch '4ZM/topic/test/4434_address' 2011-11-11 11:07:29 -05:00
Anders Sundman
ca1e88a0db Unit tests for tor_addr_to_str 2011-11-11 08:32:26 +01:00
Anders Sundman
b6b7efc084 Unit tests for tor_addr_to_PTR_name 2011-11-11 08:14:42 +01:00
Anders Sundman
1b97588a31 Return value bugfix of tor_addr_to_PTR_name
Returns value semantics was inconsitent between IPv4 and IPv6
2011-11-11 08:14:32 +01:00
Anders Sundman
930eed21c3 Fixed buffer bounds check bug in tor_addr_to_str 2011-11-11 07:53:58 +01:00
Anders Sundman
8c7658dfdf Unit tests for tor_inet_ntop 2011-11-11 07:49:41 +01:00
Anders Sundman
01e1dc0e62 Fixed of-by-one error in tor_inet_ntop
The of-by-one error could lead to 1 byte buffer over runs IPv6 for addresses.
2011-11-11 07:47:00 +01:00
Anders Sundman
8d6ce1625f Unit tests for eat_whitespace functions 2011-11-10 23:26:39 +01:00
Anders Sundman
c0efd461d3 Unit test for n_bits_set func 2011-11-10 23:26:39 +01:00
Anders Sundman
fa9aef6eec Unit test for hex_str func
Note: Too long input is undefined by contract. That behaviour should not be asserted in test.
2011-11-10 23:26:29 +01:00
Nick Mathewson
e1c6431e42 Correct the handling of overflow behavior in smartlist_ensure_capacity
The old behavior was susceptible to the compiler optimizing out our
assertion check, *and* could still overflow size_t on 32-bit systems
even when it did work.
2011-11-09 14:48:52 -05:00
Nick Mathewson
f0589da0e3 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-09 11:04:40 -05:00
Nick Mathewson
8adec87050 Merge remote-tracking branch 'rransom-tor/bug4426' into maint-0.2.2 2011-11-09 11:03:20 -05:00
Nick Mathewson
9452b65680 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-09 10:28:43 -05:00
Sebastian Hahn
0cc7a63fc0 Don't warn when compiling with --disable-threads
STMT_VOID semantics suggested by nick, thanks!
2011-11-09 10:26:35 +01:00
Nick Mathewson
d4489a2851 Rewrite comment at head of eventdns.c
Let's make it more obvious to the everyday reader that eventdns.c is
  a) Based on Libevent's evdns.c
  b) Slated for demolition
  c) Supposed to keep API-compatibility with Libevent.
  d) Not worth tweaking unless there's a bug.
2011-11-09 00:23:44 -05:00
Robert Ransom
565463243c Include HiddenServiceDir in some warning messages 2011-11-07 17:02:50 -08:00
Robert Ransom
bfb900e426 Add some XXXes 2011-11-07 15:32:43 -08:00
Robert Ransom
ef2b0bd528 Add GETINFO md/id/* and md/name/* items for relay microdescs 2011-11-07 15:32:33 -08:00
Nick Mathewson
4a7225d4c9 Merge remote-tracking branch 'rransom-tor/bug4411' 2011-11-07 11:57:07 -05:00
Robert Ransom
749b37bcf4 Fix assert on clients of and authorities for v0 HS descs 2011-11-07 08:48:23 -08:00
Nick Mathewson
ceebc8283f Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-07 11:48:02 -05:00
Nick Mathewson
ca282e5326 Merge branch 'bug4424' into maint-0.2.2 2011-11-07 11:47:28 -05:00
Nick Mathewson
02d89c5c66 Remove an extraneous "if" in the 4424 fix 2011-11-07 11:46:51 -05:00
Robert Ransom
65a0d7e7ef Don't leak an extend_info_t in rend_client_any_intro_points_usable 2011-11-07 08:35:51 -08:00
Nick Mathewson
51f53b590e Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-07 10:44:02 -05:00
Nick Mathewson
4d8306e0e9 Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2 2011-11-07 10:42:34 -05:00
Karsten Loesing
6d45c6d548 Update to the November 2011 GeoIP database. 2011-11-07 14:23:48 +01:00
Dan Rosenberg
d5161ab895 Fix remotely triggerable assert during ip decryption
Fixes bug 4410.
2011-11-06 17:23:14 +01:00
George Kadianakis
e097bffaed Fix issues pointed out by nickm.
- Rename tor_tls_got_server_hello() to tor_tls_got_client_hello().
- Replaced some aggressive asserts with LD_BUG logging.

  They were the innocent "I believe I understand how these callbacks
  work, and this assert proves it" type of callbacks, and not the "If
  this statement is not true, computer is exploding." type of
  callbacks.
- Added a changes file.
2011-11-03 22:33:50 +01:00
Nick Mathewson
c1005dd6d3 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-03 13:24:46 -04:00
George Kadianakis
3ae96845d3 Fix a memleak when fetching descriptors for bridges in ExcludeNodes. 2011-11-03 13:23:50 -04:00
Nick Mathewson
325a659cb1 Even when we can't answer an AUTH_CHALLENGE, send NETINFO.
Fixes bug 4368; fix on 0.2.3.6-alpha; bug found by "frosty".
2011-11-03 12:40:02 -04:00
Nick Mathewson
88c4b425bd Fix bug 4367: correctly detect auth_challenge cells we can't use
Found by frosty_un, bugfix on 0.2.3.6-alpha, fix suggested by arma.
2011-11-03 11:52:35 -04:00
Andrea Gelmini
72d4d762c1 Remove some duplicate includes 2011-11-03 10:23:33 -04:00
Sebastian Hahn
eb30999972 Fix a check-spaces complaint 2011-11-02 20:57:58 +01:00
Sebastian Hahn
c98faa1a23 Resolve a crash when running as dirauth
When we're asked for our own descriptor, don't crash.
2011-11-02 20:57:23 +01:00
George Kadianakis
d4ba301f29 Tell the bridge operator on what ports his transports spawned.
- Add a LOG_WARN message when registering the transports of a server
  managed proxy, so that the bridge operator can see in what ports the
  transports spawned and notify his/her clients.
2011-11-02 14:23:41 +01:00
Robert Ransom
60ed98e184 Reduce lifetime of DH public key replay-detection cache elements 2011-10-31 05:05:45 -07:00
Robert Ransom
272dd90b5c Ignore timestamps of INTRODUCE2 cells 2011-10-31 05:05:45 -07:00
Roger Dingledine
be1f3a5eb5 normalize the name of the CERTS cell 2011-10-31 04:33:38 -04:00
Roger Dingledine
c2d03beb65 blurb and version bump for 0.2.3.7-alpha 2011-10-30 18:39:49 -04:00
Robert Ransom
1a52a947c5 Move the real INTRODUCE2 replay-detection cache into rend_intro_point_t 2011-10-30 04:46:58 -07:00
Robert Ransom
1eba4f0cc3 Make introduction points expire 2011-10-30 02:17:59 -07:00
Robert Ransom
00885652db Allow intro points to expire somewhat gracefully
The Right Way to expire an intro point is to establish a new one to
replace it, publish a new descriptor that doesn't list any expiring intro
points, and *then*, once our upload attempts for the new descriptor have
ended (whether in success or failure), close the expiring intro points.

Unfortunately, we can't find out when the new descriptor has actually been
uploaded, so we'll have to settle for a five-minute timer.

There should be no significant behaviour changes due to this commit (only
a log-message change or two), despite the rather massive overhaul, so this
commit doesn't include a changes/ file.  (The commit that teaches
intro_point_should_expire_now to return non-zero gets a changes/ file,
though.)
2011-10-30 02:17:10 -07:00
Robert Ransom
ae9a831294 Use SMARTLIST_FOREACH_BEGIN and _END, not a for loop 2011-10-30 02:17:07 -07:00
Robert Ransom
e46d56a9b4 Correct bogus comments
The behaviour of rend_services_introduce here is likely as bogus as the
comments were.
2011-10-30 02:17:06 -07:00
Robert Ransom
290b4dc3d6 Use a more meaningful variable name 2011-10-30 02:17:06 -07:00
Robert Ransom
68331cbd81 Determine whether an intro point was in the last HS desc in a sane way 2011-10-30 02:17:05 -07:00
Robert Ransom
3f6a2d3e2a Record which intro points were listed in the last HS desc 2011-10-30 02:17:05 -07:00
Robert Ransom
6f035cb2b4 Record the number of INTRODUCE2 cells each intro point has received 2011-10-30 02:17:04 -07:00
Robert Ransom
6b26999146 Correct a log message 2011-10-30 02:17:01 -07:00
Robert Ransom
c60148c7f5 Record the time at which each intro point was first published 2011-10-30 02:17:00 -07:00
Robert Ransom
6f220de7b9 Improve a comment 2011-10-30 02:17:00 -07:00
Robert Ransom
190aac0eab Allow different HSes to maintain different numbers of intro points 2011-10-30 02:16:59 -07:00
Roger Dingledine
eeb6588389 bridges send netinfo cells like clients on outgoing conns
fixes bug 4348
2011-10-29 21:43:23 -04:00
Sebastian Hahn
dfdb4fde1a Disable stats requiring geoip info if we have none
In other parts of the code we will otherwise attempt to collect these
statistics, and that will lead to crashes.
2011-10-29 11:20:02 +02:00
Nick Mathewson
4dd8d811d6 Merge branch 'bug4343' 2011-10-28 18:05:25 -04:00
Nick Mathewson
00a0de8508 Bump version to 0.2.3.6-alpha-dev 2011-10-28 18:05:17 -04:00
Nick Mathewson
212c3acd42 Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/or/command.c
2011-10-28 18:02:57 -04:00
Nick Mathewson
cf8bffa359 Discard all cells on a marked connection
Fix for bug 4299
2011-10-28 17:04:15 -04:00
Nick Mathewson
2018f86e0c "Authetnicate" is not the usual spelling 2011-10-28 16:41:04 -04:00
Nick Mathewson
c2a098e980 Fix a double-free that would occur on an invalid cert in a CERTS cell
We would stash the certs in the handshake state before checking them
for validity... and then if they turned out to be invalid, we'd give
an error and free them.  Then, later, we'd free them again when we
tore down the connection.

Fixes bug 4343; fix on 0.2.3.6-alpha.
2011-10-28 16:38:56 -04:00
Nick Mathewson
7a8960cf1b Fix a memory-poisoning memset in tortls.c 2011-10-28 16:37:42 -04:00
Nick Mathewson
a2517fa77c Merge remote-tracking branch 'origin/maint-0.2.2' 2011-10-28 09:53:23 -04:00
Sebastian Hahn
f6b1dc2805 Fix typo, spotted by tmpname0901. Thanks! 2011-10-28 09:52:24 -04:00
Roger Dingledine
48bafb47ac bump maint-0.2.2 to 0.2.2.34-dev 2011-10-27 20:50:48 -04:00
Roger Dingledine
5d3095152e bump maint to 0.2.1.31 2011-10-27 20:01:58 -04:00
Roger Dingledine
1a160ae523 bump to 0.2.3.6-alpha 2011-10-26 20:33:23 -04:00
Sebastian Hahn
2dec6597af Merge branch 'maint-0.2.2_secfix' into master_secfix
Conflicts:
	src/common/tortls.c
	src/or/connection_or.c
	src/or/dirserv.c
	src/or/or.h
2011-10-27 00:38:45 +02:00
Robert Ransom
4684ced1b3 Add option to give guard flag to relays without the CVE-2011-2768 fix
This way, all of the DA operators can upgrade immediately, without nuking
every client's set of entry guards as soon as a majority of them upgrade.

Until enough guards have upgraded, a majority of dirauths should set this
config option so that there are still enough guards in the network. After
a few days pass, all dirauths should use the default.
2011-10-26 23:56:47 +02:00
Robert Ransom
00fffbc1a1 Don't give the Guard flag to relays without the CVE-2011-2768 fix 2011-10-26 23:42:39 +02:00
Robert Ransom
4d0f152aad Make tor_version_same_series non-static 2011-10-26 23:36:30 +02:00
Sebastian Hahn
df05e5ef4d Merge branch 'maint-0.2.1_secfix' into maint-0.2.2_secfix
Conflicts:
	src/or/connection_or.c
2011-10-26 23:30:27 +02:00
Robert Ransom
a74e7fd40f Reject create cells on outgoing OR connections from bridges 2011-10-26 23:21:14 +02:00
Robert Ransom
c05bb53508 Mark which OR connections are outgoing 2011-10-26 23:21:11 +02:00
Robert Ransom
af12c39d6d Don't use any OR connection which sent us a CREATE_FAST cell for an EXTEND
Fix suggested by Nick Mathewson.
2011-10-26 23:20:56 +02:00
Nick Mathewson
638fdedcf1 Don't send a certificate chain on outgoing TLS connections from non-relays 2011-10-26 23:20:56 +02:00
Nick Mathewson
a166f10414 Remove the -F option from tor-resolve.
It used to mean "Force": it would tell tor-resolve to ask tor to
resolve an address even if it ended with .onion.  But when
AutomapHostsOnResolve was added, automatically refusing to resolve
.onion hosts stopped making sense.  So in 0.2.1.16-rc (commit
298dc95dfd), we made tor-resolve happy to resolve anything.

The -F option stayed in, though, even though it didn't do anything.
Oddly, it never got documented.

Found while fixing GCC 4.6 "set, unused variable" warnings.
2011-10-26 17:13:04 -04:00
Roger Dingledine
a68867b150 manually backport a5232e0c4c 2011-10-26 17:11:52 -04:00
Roger Dingledine
cecc5b7aa1 stop asserting at boot
The patch for 3228 made us try to run init_keys() before we had loaded
our state file, resulting in an assert inside init_keys. We had moved
it too early in the function.

Now it's later in the function, but still above the accounting calls.
2011-10-26 22:09:44 +02:00
Nick Mathewson
55d9e4b8ba Reinit keys at the start of options_act().
Previously we did this nearer to the end (in the old_options &&
transition_affects_workers() block).  But other stuff cares about
keys being consistent with options... particularly anything which
tries to access a key, which can die in assert_identity_keys_ok().

Fixes bug 3228; bugfix on 0.2.2.18-alpha.

Conflicts:

	src/or/config.c
2011-10-26 22:09:44 +02:00
Robert Ransom
62c29a93ba Don't crash a bridge authority on SIGHUP if it's not in the consensus
Fixes bug 2572.
2011-10-26 22:09:44 +02:00
Sebastian Hahn
9082898944 Fix assert for relay/bridge state change
When we added support for separate client tls certs on bridges in
a2bb0bfdd5 we forgot to correctly initialize this when changing
from relay to bridge or vice versa while Tor is running. Fix that
by always initializing keys when the state changes.

Fixes bug 2433.

Conflicts:

	src/or/config.c
2011-10-26 22:09:44 +02:00
Nick Mathewson
b1632c3fb7 Fix memory leak in retry_all_listeners: Coverity CID 485 2011-10-26 13:22:20 -04:00
Nick Mathewson
097ed9998b Fix memory leak in options_act_reversible: fix Coverity CID 486,487 2011-10-26 13:22:13 -04:00
Nick Mathewson
e0a053be01 Do not tread vpadding cell as versions cell. Not in any released version. 2011-10-26 11:50:50 -04:00
George Kadianakis
9d53c00911 Fix a NULL pointer dereference in parse_server_transport_line(). 2011-10-26 11:21:11 -04:00
Nick Mathewson
beb9097bed Merge remote-tracking branch 'origin/maint-0.2.2' 2011-10-26 11:08:19 -04:00
Nick Mathewson
4a1a89be0c Merge remote-tracking branch 'public/cov_run224_022' into maint-0.2.2 2011-10-26 11:07:28 -04:00
Sebastian Hahn
34f12437d4 Fix a couple of pluggable transport bugs
Fix coverity complaints 490, 491 and 492. Especially the one in
parse_client_transport_line() could've been a remotely triggerable
segfault, I think.
2011-10-26 16:49:24 +02:00
Nick Mathewson
d0a91386e5 Don't crash when accountingmax is set in non-server Tors
We use a hash of the identity key to seed a prng to tell when an
accounting period should end.  But thanks to the bug998 changes,
clients no longer have server-identity keys to use as a long-term seed
in accounting calculations.  In any case, their identity keys (as used
in TLS) were never never fixed.  So we can just set the wakeup time
from a random seed instead there.  Still open is whether everybody
should be random.

This patch fixes bug 2235, which was introduced in 0.2.2.18-alpha.

Diagnosed with help from boboper on irc.
2011-10-26 14:20:47 +02:00
Sebastian Hahn
3a890b3b70 Properly refcount client_identity_key
In a2bb0bf we started using a separate client identity key. When we are
in "public server mode" (that means not a bridge) we will use the same
key. Reusing the key without doing the proper refcounting leads to a
segfault on cleanup during shutdown. Fix that.

Also introduce an assert that triggers if our refcount falls below 0.
That should never happen.
2011-10-26 14:17:01 +02:00
Nick Mathewson
dc557e8164 Add some asserts to get_{tlsclient|server}_identity_key
We now require that:
  - Only actual servers should ever call get_server_identity_key
  - If you're being a client or bridge, the client and server keys should
    differ.
  - If you're being a public relay, the client and server keys
    should be the same.
2011-10-26 14:16:54 +02:00
Nick Mathewson
2a2301e411 Rename get_client_identity_key to get_tlsclient_identity_key 2011-10-26 14:16:34 +02:00
Robert Ransom
59e565e2a2 Maintain separate server and client identity keys when appropriate.
Fixes a bug described in ticket #988.

Conflicts:

	src/or/main.c
	src/or/router.c
2011-10-26 14:16:20 +02:00
Nick Mathewson
299a78c5fe Make crypto_free_pk_env tolerate NULL arg in 0.2.1. Error-proofing against bug 988 backport 2011-10-26 14:14:05 +02:00
Robert Ransom
9976df9e56 Maintain separate server and client TLS contexts.
Fixes bug #988.

Conflicts:

	src/or/main.c
	src/or/router.c
2011-10-26 14:13:55 +02:00
Robert Ransom
8781640111 Refactor tor_tls_context_new:
* Make tor_tls_context_new internal to tortls.c, and return the new
  tor_tls_context_t from it.

* Add a public tor_tls_context_init wrapper function to replace it.

Conflicts:

	src/or/main.c
	src/or/router.c
2011-10-26 14:08:36 +02:00
Robert Ransom
07ab559a8e Add public_server_mode function. 2011-10-26 14:03:43 +02:00
George Kadianakis
e2b3527106 Also handle needless renegotiations in SSL_write().
SSL_read(), SSL_write() and SSL_do_handshake() can always progress the
SSL protocol instead of their normal operation, this means that we
must be checking for needless renegotiations after they return.

Introduce tor_tls_got_excess_renegotiations() which makes the
          tls->server_handshake_count > 2
check for us, and use it in tor_tls_read() and tor_tls_write().

Cases that should not be handled:

* SSL_do_handshake() is only called by tor_tls_renegotiate() which is a
  client-only function.

* The SSL_read() in tor_tls_shutdown() does not need to be handled,
  since SSL_shutdown() will be called if SSL_read() returns an error.
2011-10-26 13:36:30 +02:00
Nick Mathewson
c5a3664f27 Fix zlib macro brokenness on osx with zlib 1.2.4 and higher.
From the code:
   zlib 1.2.4 and 1.2.5 do some "clever" things with macros.  Instead of
   saying "(defined(FOO) ? FOO : 0)" they like to say "FOO-0", on the theory
   that nobody will care if the compile outputs a no-such-identifier warning.

   Sorry, but we like -Werror over here, so I guess we need to define these.
   I hope that zlib 1.2.6 doesn't break these too.

Possible fix for bug 1526.
2011-10-26 07:30:11 -04:00
George Kadianakis
340809dd22 Get rid of tor_tls_block_renegotiation().
Since we check for naughty renegotiations using
tor_tls_t.server_handshake_count we don't need that semi-broken
function (at least till there is a way to disable rfc5746
renegotiations too).
2011-10-26 13:16:14 +02:00
George Kadianakis
ecd239e3b5 Detect and deny excess renegotiations attempts.
Switch 'server_handshake_count' from a uint8_t to 2 unsigned int bits.
Since we won't ever be doing more than 3 handshakes, we don't need the
extra space.

Toggle tor_tls_t.got_renegotiate based on the server_handshake_count.
Also assert that when we've done two handshakes as a server (the initial
SSL handshake, and the renegotiation handshake) we've just
renegotiated.

Finally, in tor_tls_read() return an error if we see more than 2
handshakes.
2011-10-26 03:12:18 +02:00
George Kadianakis
4fd79f9def Detect renegotiation when it actually happens.
The renegotiation callback was called only when the first Application
Data arrived, instead of when the renegotiation took place.

This happened because SSL_read() returns -1 and sets the error to
SSL_ERROR_WANT_READ when a renegotiation happens instead of reading
data [0].

I also added a commented out aggressive assert that I won't enable yet
because I don't feel I understand SSL_ERROR_WANT_READ enough.

[0]: Look at documentation of SSL_read(), SSL_get_error() and
     SSL_CTX_set_mode() (SSL_MODE_AUTO_RETRY section).
2011-10-26 03:09:22 +02:00
George Kadianakis
69a821ea1c Refactor the SSL_set_info_callback() callbacks.
Introduce tor_tls_state_changed_callback(), which handles every SSL
state change.

The new function tor_tls_got_server_hello() is called every time we
send a ServerHello during a v2 handshake, and plays the role of the
previous tor_tls_server_info_callback() function.
2011-10-26 02:05:45 +02:00
Nick Mathewson
7ab0b5ff71 Avoid likely memory fragmentation from rep_hist_note_descs_served
When you're doing malloc(sizeof(int)), something may well have gone
wrong.

This technique is a bit abusive, but we're already relying on it
working correctly in geoip.c.
2011-10-25 17:53:26 -04:00
Sebastian Hahn
7fbc018433 Add percentiles to the desc stats reporting
To get a better idea what's going on on Tonga, add some code to report
how often the most and least frequently fetched descriptor was fetched,
as well as 25, 50, 75 percentile.

Also ensure we only count bridge descriptors here.
2011-10-25 16:47:27 +02:00
George Kadianakis
6b3c3b968f Rename tor_process_destroy() to tor_process_handle_destroy(). 2011-10-24 16:04:31 +02:00
George Kadianakis
47a5b8009b Improve general code quality.
- Add a tor_process_get_pid() function that returns the PID of a
  process_handle_t.
- Conform to make check-spaces.
- Add some more documentation.
- Improve some log messages.
2011-10-24 16:01:24 +02:00
George Kadianakis
572aa4ec44 Add PT_PROTO_FAILED_LAUNCH managed proxy state.
We used to try to terminate the managed proxy process even if it
failed while launching. We introduce a new managed proxy state, to
represent a *broken* and *not launched* proxy.
2011-10-24 15:59:11 +02:00
George Kadianakis
20be928fae Make set_managed_proxy_environment() work on Windows. 2011-10-24 15:56:28 +02:00
George Kadianakis
f12a40d860 Prepare util.[ch] to use the new process_handle_t API.
Also, create tor_process_destroy() which destroys a process_handle_t.
2011-10-24 15:55:53 +02:00
Sebastian Hahn
f885c60501 Don't initialize desc stats for non-bridgedirauth nodes
Also make sure that calling rep_hist_note_desc_served() while stats
aren't initialized just returns.

Bug spotted by SwissTorHelp. Thanks!
2011-10-24 14:54:22 +02:00
Roger Dingledine
2e295ae46e bump to 0.2.3.5-alpha-dev 2011-10-23 13:38:12 -04:00
Nick Mathewson
9d355bf479 Double-check that we really can get RSA keys from ID/Auth certs
Addresses issue 4287; issue not in any released Tor.
2011-10-23 13:31:09 -04:00
Nick Mathewson
87a93917c3 Fix a reference-leak in tor_tls_received_v3_certificate
We were calling SSL_get_peer_certificate but not X509_free.

This is a major part of bug4252; the bug has been in no released version.
2011-10-23 13:23:53 -04:00
Nick Mathewson
80cf342e47 Fix memory leak in prop176 code
This fixes part of bug4252.  Bug not in any released version.
2011-10-23 13:23:53 -04:00
Nick Mathewson
0c2a3601e8 Merge remote-tracking branch 'rransom-tor/bug3825c' 2011-10-23 12:55:10 -04:00
Sebastian Hahn
42b96a041d Check for jumping clock in *format_*stats functions
None of these were real bugs (yet), because the callers made sure
everything was fine. Make it more explicit. Suggested by Nick
2011-10-21 11:21:42 -04:00