Commit Graph

24518 Commits

Author SHA1 Message Date
Nick Mathewson
b4fe0a6a03 Improve control flow in authority_certs_fetch_resource_impl 2017-04-27 09:30:08 -04:00
Nick Mathewson
52316f9969 Include UPLOAD_RENDDESC_V2 in PURPOSE_IS_UPLOAD
This was only used in one place before, and it's safe to update it.
2017-04-27 09:27:00 -04:00
Nick Mathewson
0f6420e53a Changes file for dirreq refactoring branch 2017-04-24 12:15:25 -04:00
Nick Mathewson
91553417c7 Fix a comment that held the remaining reference to the old api. 2017-04-21 16:39:05 -04:00
Nick Mathewson
d8ff01b2b4 Refactor directory_command_should_use_begindir to use directory_request_t 2017-04-21 15:55:23 -04:00
Nick Mathewson
2a99bf008d move the definition of directory_command_should_use_begindir 2017-04-21 15:54:50 -04:00
Nick Mathewson
cc677e88d4 Refactor directory_send_command to take a directory_request_t 2017-04-21 15:49:10 -04:00
Nick Mathewson
900d36e3b1 Rename, revise, and document directory_request_is_dir_specified. 2017-04-21 15:42:09 -04:00
Nick Mathewson
d7fab36037 Make directory_request_set_guard_state static. 2017-04-21 15:42:09 -04:00
Nick Mathewson
81045e19eb Document the new directory_request_t API and add some assertions 2017-04-21 15:42:03 -04:00
Nick Mathewson
3327e675fd Remove old directory_initiate_command_*() functions. 2017-04-21 15:14:52 -04:00
Nick Mathewson
8aadd60eac Replace remaining directory_initiate_command_* instances 2017-04-21 15:08:28 -04:00
Nick Mathewson
4e393f5318 Make launch_direct_bridge_descriptor_fetch use dirreqs. 2017-04-21 14:47:14 -04:00
Nick Mathewson
4ae65bb5d3 Refactor directory_get_from_dirserver to use request API. 2017-04-21 14:40:48 -04:00
Nick Mathewson
eee733be33 Refactor directory_post_to_dirservers to use requests 2017-04-21 14:35:42 -04:00
Nick Mathewson
c300fd7e65 Have directory_get_from_all_authorities use requests. 2017-04-21 14:31:35 -04:00
Nick Mathewson
a55bd00b0f continue refactoring directory API: remove initiate_command_rend
This commit mainly moves the responsibility for directory request
construction one level higher.  It also allows a directory request
to contain a pointer to a routerstatus, which will get turned into
the correct contact information at the last minute.
2017-04-21 14:18:06 -04:00
Nick Mathewson
91a6fbcf77 Begin work to turn "directory request" into an object
This patch adds the object type, and makes all of the functions
that used to feed into directory_initiate_command_rend() feed into
that type instead.
2017-04-16 18:45:48 -04:00
Nick Mathewson
b081a7ed21 Merge branch 'ticket21891_031_01_squashed' 2017-04-13 16:43:13 -04:00
David Goulet
0565f5a3bb hs: Make the service list pruning function public
The reason for making the temporary list public is to keep it encapsulated in
the rendservice subsystem so the prop224 code does not have direct access to
it and can only affect it through the rendservice pruning function.

It also has been modified to not take list as arguments but rather use the
global lists (main and temporary ones) because prop224 code will call it to
actually prune the rendservice's lists. The function does the needed rotation
of pointers between those lists and then prune if needed.

In order to make the unit test work and not completely horrible, there is a
"impl_" version of the function that doesn't free memory, it simply moves
pointers around. It is directly used in the unit test and two setter functions
for those lists' pointer have been added only for unit test.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-04-13 16:25:49 -04:00
Nick Mathewson
ba89520593 fix wide lines 2017-04-13 14:36:57 -04:00
Nick Mathewson
902672eac6 Merge branch 'ticket21889_031_01_squashed' 2017-04-13 14:23:59 -04:00
George Kadianakis
f02868bb53 hs: Add service-side circuitmap API.
Now we have separate getters and setters for service-side and relay-side. I
took this approach over adding arguments to the already existing methods to
have more explicit type-checking, and also because some functions would grow
too large and dirty.

This commit also fixes every callsite to use the new function names which
modifies the legacy HS (v2) and the prop224 (v3) code.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-04-13 14:23:51 -04:00
Nick Mathewson
63e39b291e Merge remote-tracking branch 'dgoulet/bug21155_031_02' 2017-04-13 09:56:14 -04:00
Nick Mathewson
28ec2d9c2c Merge remote-tracking branch 'dgoulet/ticket21919_031_01' 2017-04-13 09:38:59 -04:00
Nick Mathewson
755c88a474 Merge branch 'asn/prop224-ntor-v2-squashed' 2017-04-13 09:22:34 -04:00
George Kadianakis
ea5901bf1c prop224: Add Python integration tests for HS ntor.
This test is identical to the ./src/test/test_ntor.sh integration test.
2017-04-13 09:22:19 -04:00
George Kadianakis
18ee145cda prop224: Add basic HS ntor unittest.
The test checks that introduce1/rendezvous1 key material is generated
correctly both for client-side and service-side.
2017-04-13 09:22:19 -04:00
George Kadianakis
50b0bc5bfe prop224: Add module that performs the HS ntor handshake.
and also does the key expansion.
2017-04-13 09:22:19 -04:00
David Goulet
bf68c78e94 hs: Make check-spaces happy after rename
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-04-12 07:53:05 -04:00
David Goulet
6bacc3c7a8 hs: Change trunnel prop224 cell's namespace
One of the goals of this change is to have trunnel API/ABI being more explicit
so we namespace them with "trn_*". Furthermore, we can now create
hs_cells.[ch] without having to confuse it with trunnel which used to be
"hs_cell_*" before that change.

Here are the perl line that were used for this rename:

  perl -i -pe 's/cell_extension/trn_cell_extension/g;' src/*/*.[ch]
  perl -i -pe 's/cell_extension/trn_cell_extension/g;' src/trunnel/hs/*.trunnel
  perl -i -pe 's/hs_cell_/trn_cell_/g;' src/*/*.[ch]
  perl -i -pe 's/hs_cell_/trn_cell_/g;' src/trunnel/hs/*.trunnel

  And then "./scripts/codegen/run_trunnel.sh" with trunnel commit id
  613fb1b98e58504e2b84ef56b1602b6380629043.

Fixes #21919

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-04-11 13:46:41 -04:00
David Goulet
e5fc02c81c config: Warn if EntryNodes and HiddenService are used together
Pinning EntryNodes along with hidden services can be possibly harmful (for
instance #14917 and #21155) so at the very least warn the operator if this is
the case.

Fixes #21155

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-04-10 13:22:36 -04:00
Nick Mathewson
01fc93ffef Merge remote-tracking branch 'dgoulet/bug16706_031_01' 2017-04-10 12:12:14 -04:00
Nick Mathewson
f5258045c4 Fix some no-longer-reasonable unit tests for base64_decode()
These tests tried to use ridiculously large buffer sizes to check
the sanity-checking in the code; but since the sanity-checking
changed, these need to change too.
2017-04-10 12:08:31 -04:00
Nick Mathewson
aebd72a2f0 changes file for 17868 2017-04-10 11:27:41 -04:00
Taylor Yu
26dd4d92cf Remove SR_COMMIT_LEN workaround
Now that base64_decode() checks the destination buffer length against
the actual number of bytes as they're produced, shared_random.c no
longer needs the "SR_COMMIT_LEN+2" workaround.
2017-04-07 18:19:15 -04:00
Taylor Yu
2b38bb28b4 Remove base64_decode_nopad()
Remove base64_decode_nopad() because it is redundant now that
base64_decode() correctly handles both padded and unpadded base64
encodings with "right-sized" output buffers.
2017-04-07 18:18:23 -04:00
Taylor Yu
00ffefb41b Test odd-sized base64 decodes
Test base64_decode() with odd sized decoded lengths, including
unpadded encodings and padded encodings with "right-sized" output
buffers.  Convert calls to base64_decode_nopad() to base64_decode()
because base64_decode_nopad() is redundant.
2017-04-07 18:16:45 -04:00
Taylor Yu
f15818f280 Make base64_decode() check actual decoded length
base64_decode() was applying an overly conservative check on the
output buffer length that could incorrectly produce an error if the
input encoding contained padding or newlines.  Fix this by checking
the output buffer length against the actual decoded length produced
during decoding.
2017-04-07 18:13:22 -04:00
Nick Mathewson
05ef3b959d Merge branch 'maint-0.3.0' 2017-04-07 14:03:40 -04:00
Nick Mathewson
f1613b53c5 Merge remote-tracking branch 'public/bug21894_029' into maint-0.3.0 2017-04-07 14:03:25 -04:00
Nick Mathewson
f0fa7dcdf0 Merge branch 'ticket21842_squashed' 2017-04-07 13:21:15 -04:00
Nick Mathewson
7b60f0129a Remove tor-checkkey as obsolete
CVE-2008-0166 is long gone, and we no longer need a helper tool to
dump out public key moduli so folks can detect it.

Closes ticket 21842.
2017-04-07 13:21:07 -04:00
Nick Mathewson
506b4bfaba Merge remote-tracking branch 'dgoulet/ticket21893_031_01' 2017-04-07 11:04:06 -04:00
Nick Mathewson
4812441d34 Never read off the end of a buffer in base32_encode()
When we "fixed" #18280 in 4e4a7d2b0c
in 0291 it appears that we introduced a bug: The base32_encode
function can read off the end of the input buffer, if the input
buffer size modulo 5 is not equal to 0 or 3.

This is not completely horrible, for two reasons:
   * The extra bits that are read are never actually used: so this
     is only a crash when asan is enabled, in the worst case.  Not a
     data leak.

   * The input sizes passed to base32_encode are only ever multiples
      of 5. They are all either DIGEST_LEN (20), REND_SERVICE_ID_LEN
      (10), sizeof(rand_bytes) in addressmap.c (10), or an input in
      crypto.c that is forced to a multiple of 5.

So this bug can't actually trigger in today's Tor.

Closes bug 21894; bugfix on 0.2.9.1-alpha.
2017-04-07 10:47:16 -04:00
Nick Mathewson
d33c3627f4 Comment fix. (Catalyst spotted this) 2017-04-07 10:00:08 -04:00
Nick Mathewson
61f1838cdc Merge branch 'isolate_openssl' 2017-04-07 09:58:21 -04:00
Nick Mathewson
f5cc8da7e0 Use DIGEST512_LEN macro in crypto_hash_sha512.h in ref10 2017-04-07 09:58:04 -04:00
Nick Mathewson
1e54bdd48a Make the warnings about terminating nuls a bit stronger
It looks like 32_encoded_size/64_encode_size APIs are inconsistent
not only in the number of "d"s they have, but also in whether they
count the terminating NUL.  Taylor noted this in 86477f4e3f,
but I think we should note the inconsistently more loudly in order
to avoid trouble.

(I ran into trouble with this when writing 30b13fd82e243713c6a0d.)
2017-04-07 09:51:08 -04:00
Nick Mathewson
2c86380bde Merge remote-tracking branch 'argonblue/baseXXlen' 2017-04-07 09:48:18 -04:00