Commit Graph

25676 Commits

Author SHA1 Message Date
Isis Lovecruft
d0cabbf2c5
Fix CI homebrew checks for outdated packages.
(cherry picked from commit 8f8689f70235dc19cbc5092ea148af5772a9cdc3)
2017-07-25 00:52:05 +00:00
Nick Mathewson
a4217cc52f Fix remaining cases of hs_config failures without af_unix 2017-07-24 15:58:11 -04:00
Nick Mathewson
661e317697 Fix hs_config unit test on systems without unix sockets
Bugfix on 418059dd96f5f427eceffff1daeb2a2f6c4adbeb; jenkins found
this.
2017-07-24 15:13:23 -04:00
Nick Mathewson
6c8c973191 Rename the hybrid_encrypt/decrypt functions; label them as dangerous
We need to keep these around for TAP and old-style hidden services,
but they're obsolete, and we shouldn't encourage anyone to use them.
So I've added "obsolete" to their names, and a comment explaining
what the problem is.

Closes ticket 23026.
2017-07-24 14:34:53 -04:00
Nick Mathewson
db1664e593 Improve comment about why we disable TLS compression.
Closes bug 22964.  Based on Teor's replacement there, but tries
to put the comment in a more logical place, and explain why we're
actually disabling compression in the first place.
2017-07-24 14:17:16 -04:00
David Goulet
10331081c7 test: Remove buggy unit test in test_hs_service
There isn't much of a point of this buggy test afterall to add twice the same
service object but with a different key which ultinately can end up failing
the test because 1/N_BUCKETS of probability that we end up to put the service
in the same bucket.

Fixes #23023

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-24 11:33:52 -04:00
Roger Dingledine
ec5b30ca0b fix whitespace issue 2017-07-23 00:57:10 -04:00
Isis Lovecruft
7b4585e2a3
Add a changes file for bug22636. 2017-07-17 21:44:59 +00:00
Isis Lovecruft
68722a1ddf
Fix and expand upon our Travis CI configuration.
* CHANGE .travis.yml so that commands for different purposes (e.g. getting
   dependencies, building, testing) are in separate config lines and sections.
 * CHANGE .travis.yml to use their mechanism for installing dependencies via
   apt. [0]  This also allows us to not need sudo (the "sudo: false" line).
 * CHANGE Travis CI tests (the "script:" section) to build and run tests in the
   same manner as Jenkins (i.e. with --enable-fatal-warnings and
   --disable-silent-rules and run `make check`).
 * ADD Travis configuration to do all the target builds with both GCC and clang.
 * ADD make flags to build with both of the cores available.
 * ADD notifications for IRC, and configure email notifications (to the author
   of the commit) only if the branch was previously building successfully and
   the latest commit broke it.
 * ADD the ability to run the Travis build matrix for OSX as well, but leave it
   commented out by default (because it takes roughly ten times longer, due to a
   shortage of OSX build machines).
 * ADD Travis config option to cancel/fail the build early if one target has
   already failed ("fast_finish: true").
 * ADD comments to describe what our Travis config is doing and why it is
   configured that way.

[0]: https://docs.travis-ci.com/user/installing-dependencies/#Installing-Packages-on-Container-Based-Infrastructure)
2017-07-17 21:44:44 +00:00
Isis Lovecruft
cdb3e17ba2
Add a changes file for bug22636. 2017-07-17 21:43:16 +00:00
Isis Lovecruft
6632271823
Fix and expand upon our Travis CI configuration.
* CHANGE .travis.yml so that commands for different purposes (e.g. getting
   dependencies, building, testing) are in separate config lines and sections.
 * CHANGE .travis.yml to use their mechanism for installing dependencies via
   apt. [0]  This also allows us to not need sudo (the "sudo: false" line).
 * CHANGE Travis CI tests (the "script:" section) to build and run tests in the
   same manner as Jenkins (i.e. with --enable-fatal-warnings and
   --disable-silent-rules and run `make check`).
 * CHANGE Travis config to install nightly rustc and cargo.
 * CHANGE Travis config to split rust install into commands for getting
   dependencies ("before_install:") and commands for installing them
   ("install:").
 * REMOVE shell redirection when downloading the rustup.sh script.
 * CHANGE cargo to be in "online mode" so that we can get our Rust dependencies.
   There's not really a way to get the dependencies without using cargo
   right now.  See https://bugs.torproject.org/22830 for more info.
 * REMOVE cargo "offline mode" envvars from rustup.sh invocation.
 * ADD commands to get more info about rustc and cargo before building.
 * FIX sourcing the cargo/toolchain environment that rustup creates. (Without
   this, our build scripts don't know about anything called "rustc" or "cargo".)
 * ADD Travis configuration to do all the target builds with both GCC and clang.
 * ADD make flags to build with both of the cores available.
 * ADD notifications for IRC, and configure email notifications (to the author
   of the commit) only if the branch was previously building successfully and
   the latest commit broke it.
 * ADD the ability to run the Travis build matrix for OSX as well, but leave it
   commented out by default (because it takes roughly ten times longer, due to a
   shortage of OSX build machines).
 * ADD Travis config option to cancel/fail the build early if one target has
   already failed ("fast_finish: true").
 * ADD comments to describe what our Travis config is doing and why it is
   configured that way.

[0]: https://docs.travis-ci.com/user/installing-dependencies/#Installing-Packages-on-Container-Based-Infrastructure)
2017-07-17 21:43:05 +00:00
Patrick O'Doherty
c32e6d6730
.travis.yml to run test suite
Installs dependencies (including rust) and runs the existing test suite.

TODO: Introduce build matrix utilizing the rust toolchain to run test
suites both with and without the rust components.
2017-07-17 21:32:05 +00:00
Nick Mathewson
2ae51ed5e2 Fix zstd 1.3.0 trouble: Be more respectful of its state machine
In zstd 1.3.0, once you have called ZSTD_endStream and been told
that your putput buffer is full, it really doesn't want you to call
ZSTD_compressStream again.  ZSTD 1.2.0 didn't seem to mind about
this.

This patch fixes the issue by making sure never to call
ZSTD_endStream if there's any more data on the input buffer to
process, by flushing even when we're about to call "endStream", and
by never calling "compress" or "flush" after "endStream".
2017-07-14 16:31:29 -04:00
Nick Mathewson
0ccdf2f31e Merge branch 'bug17750_029_squashed' 2017-07-14 15:07:09 -04:00
Nick Mathewson
b7566d465f Fix a signed integer overflow in dir/download_status_random_backoff
Fix for 22924. Bugfix on 0.2.9.1-alpha when the test was introducd
-- though it couldn't actually overflow until we fixed 17750.

Additionally, this only seems to overflow on 32-bit, and only when
the compiler doesn't re-order the (possibly dead) assignment out of
the way.  We ran into it on a 32-bit ubuntu trusty builder.
2017-07-14 15:05:30 -04:00
Nick Mathewson
9a1338d9df Fix 32-bit warnings in hs_common.c 2017-07-14 11:33:12 -04:00
Nick Mathewson
f5d2f79aca Merge branch 'maint-0.2.9' into maint-0.3.0 2017-07-14 09:11:14 -04:00
Nick Mathewson
52c1754ff6 Merge branch 'maint-0.3.0' into maint-0.3.1 2017-07-14 09:11:14 -04:00
Nick Mathewson
d0816a040d Merge branch 'maint-0.3.1' 2017-07-14 09:11:14 -04:00
Nick Mathewson
3a7d757140 Merge branch 'bug22916_027' into maint-0.2.9 2017-07-14 09:11:08 -04:00
Nick Mathewson
bbc75faed1 Merge branch 'maint-0.3.0' into maint-0.3.1 2017-07-14 09:06:44 -04:00
Nick Mathewson
ce5d8c92dd Merge branch 'maint-0.3.1' 2017-07-14 09:06:44 -04:00
Nick Mathewson
c1afbbe8fe Merge branch 'bug22803_030' into maint-0.3.0 2017-07-14 09:06:33 -04:00
Patrick O'Doherty
071e9b56b1
.travis.yml to run test suite
Installs dependencies (including rust) and runs the existing test suite.

TODO: Introduce build matrix utilizing the rust toolchain to run test
suites both with and without the rust components.
2017-07-13 22:05:58 +00:00
Nick Mathewson
3cec1783b7 Fix compiler warnings with openssl-scrypt/libscrypt test on clang
Clang didn't like that we were passing uint64_t values to an API
that wanted uint32_t.  GCC has either not cared, or has figured out
that the values in question were safe to cast to uint32_t.

Fixes bug22916; bugfix on 0.2.7.2-alpha.
2017-07-13 17:49:48 -04:00
Nick Mathewson
ef4ea864ea Merge remote-tracking branch 'dgoulet/ticket21979_032_04' 2017-07-13 17:23:37 -04:00
David Goulet
965e3a6628 prop224: Fix clang warnings
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 17:18:11 -04:00
Nick Mathewson
62d241ad22 Merge remote-tracking branch 'isis/bug19476' 2017-07-13 16:58:45 -04:00
Nick Mathewson
66a564fad8 Merge branch 'maint-0.3.1' 2017-07-13 16:55:06 -04:00
Nick Mathewson
66258f8878 Merge branch 'fewer-diffs' into maint-0.3.1 2017-07-13 16:55:02 -04:00
Nick Mathewson
ec29cae8d7 Merge branch 'maint-0.3.1' 2017-07-13 16:52:20 -04:00
Nick Mathewson
1ea155b28f Merge branch 'bug22520_031' into maint-0.3.1 2017-07-13 16:52:16 -04:00
Nick Mathewson
c73b35d428 Merge branch 'maint-0.3.1' 2017-07-13 16:51:18 -04:00
Nick Mathewson
e6d2059751 Merge remote-tracking branch 'isis/bug22830_0.3.1' into maint-0.3.1 2017-07-13 16:51:09 -04:00
David Goulet
5d64ceb12d prop224: Move service version into config object
It makes more sense to have the version in the configuration object of the
service because it is afterall a torrc option (HiddenServiceVersion).

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
3eeebd1b0c prop224: Use the service config object when configuring
Both configuration function now takes the service config object instead of the
service itself.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
f64689f3f0 prop224: Don't use char * for binary data
It turns out that some char * sneaked in our hs_common.c code. Replace those
by uint8_t *.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
1b048fbfaa prop224: Add a clear configuration function
The added function frees any allocated pointers in a service configuration
object and reset all values to 0.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
750c684fff prop224: Don't use an array of config handlers
As per nickm suggestion, an array of config handlers will not play well with
our callgraph tool.

Instead, we'll go with a switch case on the version which has a good side
effect of allowing us to control what we pass to the function intead of a fix
set of parameters.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
e9dd4ed16d prop224: Detect duplicate configuration options
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
cfa6f8358b prop224: Use a common function to parse uint64_t
Add a helper function to parse uint64_t and also does logging so we can reduce
the amount of duplicate code.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
28f6431399 Revert "fixup! prop224: Add hs_config.{c|h} with a refactoring"
This reverts commit e2497e2ba038133026a475f0f93c9054187b2a1d.
2017-07-13 16:50:09 -04:00
David Goulet
09b12c4094 test: Add v3 service load keys and accessors
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
418059dd96 test: Add v3 service config and registration test
This tests our hs_config.c API to properly load v3 services and register them
to the global map. It does NOT test the service object validity, that will be
the hs service unit test later on.

At this commit, we have 100% code coverage of hs_config.c.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
87f6f96f47 hs: Add rend_service_init()
Initialize both the global and staging service lists.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:09 -04:00
David Goulet
f76f873199 prop224: Add a function to check for invalid opts
Every hidden service option don't apply to every version so this new function
makes sure we don't have for instance an option that is only for v2 in a v3
configured service.

This works using an exclude lists for a specific version. Right now, there is
only one option that is not allowed in v3. The rest is common.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:50:08 -04:00
David Goulet
138e03c488 prop224: Load and/or generate v3 service keys
Try to load or/and generate service keys for v3. This write both the public
and private key file to disk along with the hostname file containing the onion
address.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:49:44 -04:00
David Goulet
f3899acdbf prop224: Service address creation/validation
This also adds unit test and a small python script generating a deterministic
test vector that a unit test tries to match.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:49:44 -04:00
David Goulet
c086a59ea1 prop224: Configure v3 service from options
This commit adds the support in the HS subsystem for loading a service from a
set of or_options_t and put them in a staging list.

To achieve this, service accessors have been created and a global hash map
containing service object indexed by master public key. However, this is not
used for now. It's ground work for registration process.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:49:44 -04:00
David Goulet
93774dcb54 test: Add HS v2 service configuration unit tests
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-13 16:49:08 -04:00