Commit Graph

24477 Commits

Author SHA1 Message Date
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
Nick Mathewson 30b13fd82e Add test for expected output from encode{,d}_length functions 2017-04-07 09:47:29 -04:00
David Goulet dff50001ec prop224: Flag router with HSIntro/HSDir using protover
Note down in the routerstatus_t of a node if the router supports the HSIntro=4
version for the ed25519 authentication key and HSDir=2 version for the v3
descriptor supports.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-04-07 09:44:52 -04:00
Taylor Yu 681812ea40 Use macros for base64 lengths in shared_random.h
Fixes #19564.
2017-04-06 17:43:17 -04:00
Taylor Yu 86477f4e3f Use baseXX length macros in baseXX_encode()
Use the new baseXX length macros to clean up the length checks in the
baseXX_encode() functions.
2017-04-06 17:43:16 -04:00
Taylor Yu e7f40baade Add macros for baseXX encoding lengths 2017-04-06 15:43:55 -04:00
Taylor Yu c5adab0258 Make CEIL_DIV() slightly more overflow-safe 2017-04-06 13:54:46 -04:00
Nick Mathewson 489ef6b38b changes file for 21873 2017-04-06 11:57:56 -04:00
Nick Mathewson b47aecbe76 Merge remote-tracking branch 'arthuredelstein/21873' 2017-04-06 11:57:14 -04:00
Nick Mathewson 9d34a1e052 Merge branch 'storage_labeled_squashed' 2017-04-06 11:49:00 -04:00
Nick Mathewson 5567a80caa Explain config_line_find() behavior on duplicates. 2017-04-06 11:48:41 -04:00
Nick Mathewson 89b673f24b Add an assertion to config_line_append(). 2017-04-06 11:48:41 -04:00
Nick Mathewson 95a4f2d525 Additional unit tests to improve conscache coverage 2017-04-06 11:48:41 -04:00
Nick Mathewson 2b5b6025bd Tests for cleanup and reference counting on conscache 2017-04-06 11:48:41 -04:00
Nick Mathewson 73e9bc914f Tests for simple cases of conscache code. 2017-04-06 11:48:41 -04:00
Nick Mathewson 4404dc5756 Add a 'consensus cache' type on top of storagedir.
Every file in the cache is labeled.  The labels are held in memory;
the bodies are mapped on demand.
2017-04-06 11:48:41 -04:00
Nick Mathewson 5f8860a16f Unit tests for labelled storagedir entries 2017-04-06 11:48:41 -04:00
Nick Mathewson 37bb3b31fa Add some "labeled storagedir" abstractions.
These add a tiny bit of structure on top of the regular storagedir
abstractions in order to store key-value lists at the head of each
document.
2017-04-06 11:48:40 -04:00
Nick Mathewson 4c2ad48568 Merge branch 'maint-0.3.0' 2017-04-06 08:32:12 -04:00
Nick Mathewson a5b50ef25b Merge branch 'maint-0.2.9' into maint-0.3.0 2017-04-06 08:32:04 -04:00
Nick Mathewson 7d7770f735 Merge branch 'maint-0.2.8' into maint-0.2.9 2017-04-06 08:31:54 -04:00
Nick Mathewson 91c6b18ca0 Merge branch 'maint-0.2.7-redux' into maint-0.2.8 2017-04-06 08:31:32 -04:00
Nick Mathewson 44bc8821b1 Merge branch 'maint-0.2.6' into maint-0.2.7-redux 2017-04-06 08:31:23 -04:00
Nick Mathewson 21d776738c Merge branch 'maint-0.2.5' into maint-0.2.6 2017-04-06 08:31:18 -04:00
Nick Mathewson a8a860e1da Merge branch 'maint-0.2.4' into maint-0.2.5 2017-04-06 08:31:12 -04:00
Karsten Loesing 9d7933296c Update geoip and geoip6 to the April 4 2017 database. 2017-04-06 10:52:39 +02:00
Arthur Edelstein 6f0edff399 Bug 21873: Clarify KeepAliveIsolateSOCKSAuth behavior 2017-04-05 17:19:25 -07:00
Nick Mathewson 0e5e5ba64b Merge branch 'maint-0.3.0'
"ours" merge to avoid the version bump.
2017-04-05 10:04:42 -04:00
Nick Mathewson 868de69c33 forward-port the 0.3.0.5-rc changelog 2017-04-05 10:04:38 -04:00
Nick Mathewson 06fe8a14c4 bump to 0.3.0.5-rc-dev 2017-04-05 10:03:09 -04:00
Nick Mathewson b6f22524ee Move config line parsing function to confline.c 2017-04-04 11:11:01 -04:00
Nick Mathewson c2947dbb86 Move config_line_t functions from confparse.c into common.
I'm doing this to storagedir to used config_line_t.
2017-04-04 11:11:01 -04:00
Nick Mathewson 321c1c453e Merge branch 'maint-0.3.0' 2017-04-04 09:43:23 -04:00
David Goulet 7519584347 hs: Expose hs_service.c functions for unit tests
In order to avoid src/or/hs_service.o to contain no symbols and thus making
clang throw a warning, the functions are now exposed not just to unit tests.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-04-04 09:41:14 -04:00
Taylor Yu b1c7e5d8c0 Capture expected log in test_circuitbuild.c
Capture the warning for the unhandled circuit purpose test case, both
to clean up the test log and to confirm that it gets logged.
2017-04-03 15:24:59 -04:00
Nick Mathewson 67c88fd10d Merge branch 'bug13790_rebased' 2017-04-03 11:58:37 -04:00
Taylor Yu f0a57df55c Test unhandled purpose in route_len_for_purpose()
Check that route_len_for_purpose() (helper for new_route_len())
correctly fails a non-fatal bug assertion if it encounters an
unhandled circuit purpose when it is called with exit node info.
2017-04-03 11:58:11 -04:00