summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2016-07-01prop250: Fix unit tests about the RSA fingerprint checkDavid Goulet
Code has been changed so every RSA fingerprint for a commit in our state is validated before being used. This fixes the unit tests by mocking one of the key function and updating the hardcoded state string. Also, fix a time parsing overflow on platforms with 32bit time_t Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-07-01prop250: Sort commits in lexicographical order in votesDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: Improve log messagesDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: Sort smartlist before you get most frequent SRV.George Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: Only trust known authority when computing SRVDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: Add version to Commit line in vote and stateDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: Add a valid flag to sr_commit_tDavid Goulet
We assert on it using the ASSERT_COMMIT_VALID() macro in critical places where we use them expecting a commit to be valid. Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: Use RSA identity digest instead of fingerprintDavid Goulet
The prop250 code used the RSA identity key fingerprint to index commit in a digestmap instead of using the digest. To behavior change except the fact that we are actually using digestmap correctly. Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: change time_t to uint64_tDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2016-07-01prop250: Add unit testsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-07-01prop250: Initialize the SR subsystem and us it!David Goulet
This commit makes it that tor now uses the shared random protocol by initializing the subsystem. Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-07-01prop250: Parse votes and consensusDavid Goulet
One of the last piece that parses the votes and consensus in order to update our state and make decision for the SR values. We need to inform the SR subsystem when we set the current consensus because this can be called when loaded from file or downloaded from other authorities or computed. The voting schedule is used for the SR timings since we are bound to the voting system. Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-07-01prop250: Put commits and SRVs in votes/consensusDavid Goulet
This commit adds the commit(s) line in the vote as well as the SR values. It also has the mechanism to add the majority SRVs in the consensus. Signed-off-by: George Kadianakis <desnacked@riseup.net> Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-07-01prop250: Add commit and SR values generation codeDavid Goulet
This adds the logic of commit and SR values generation. Furthermore, the concept of a protocol run is added that is commit is generated at the right time as well as SR values which are also rotated before a new protocol run. Signed-off-by: George Kadianakis <desnacked@riseup.net> Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-20prop250: Add memory and disk state in new filesDavid Goulet
This commit introduces two new files with their header. "shared_random.c" contains basic functions to initialize the state and allow commit decoding for the disk state to be able to parse them from disk. "shared_random_state.c" contains everything that has to do with the state for both our memory and disk. Lots of helper functions as well as a mechanism to query the state in a synchronized way. Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-06-20Add tor_htonll/ntohll functionsDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2016-06-20util: zero target buffer of base*_encode/decodeDavid Goulet
Make sure to memset(0) the destination buffer so we don't leave any uninitialized data. Fixes #19462 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-20Patch from dgoulet: fix a base16 problem that manifested w stemNick Mathewson
2016-06-20Coverage hack for test_switch_id.shNick Mathewson
This hack provides a way to make sure we can see coverage from test-switch-id. If you set OVERRIDE_GCDA_PERMISSIONS_HACK, we temporarily make the .gcda files mode 0666 before we run the test scripts, and then we set them to 0644 again afterwards. That's necessary because the test_switch_id.sh script does a setuid() to 'nobody' part way through, and drops the ability to change its mind back.
2016-06-20Small coverage improvements on compat.cNick Mathewson
2016-06-20compat.c coverage: simplify under-tested alloc_getcwd.Nick Mathewson
Yes, HURD lacks PATH_MAX. But we already limited the maximum buffer to 4096, so why not just use that?
2016-06-20More coverage in backtrace.cNick Mathewson
2016-06-20Merge remote-tracking branch 'dgoulet/bug19465_029_01'Nick Mathewson
2016-06-20Fix unit test crash on 32-bit.Nick Mathewson
2016-06-20test: Increase offset to rendcache descriptor timeDavid Goulet
Slow system can sometime take more than 10 seconds to reach the test callsite resulting in the unit test failing when using time in the future or in the past. Fixes #19465 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-20Merge branch 'bug14013_029_01_squashed'Nick Mathewson
2016-06-20Make base16_decodes return number of decoded bytesnikkolasg
base16_decodes() now returns the number of decoded bytes. It's interface changes from returning a "int" to a "ssize_t". Every callsite now checks the returned value. Fixes #14013 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-19Changes file for 19063; use the BUG macroNick Mathewson
2016-06-19Fix #19063: Add check in utility macroU+039b
2016-06-19Merge branch 'zlib_coverage_squashed'Nick Mathewson
2016-06-19Unindent blockNick Mathewson
2016-06-19Mark some torgzip lines as unreachable/untestable.Nick Mathewson
2016-06-19Remove a ridiculous realloc call from torgzip.cNick Mathewson
realloc()ing a thing in order to try to save memory on it just doesn't make sense with today's allocators. Instead, let's use the fact that whenever we decompress something, either it isn't too big, or we chop it up, or we reallocate it.
2016-06-19Remove support for zlib <= 1.1Nick Mathewson
zlib 1.2 came out in 2003; earlier versions should be dead by now. Our workaround code was only preventing us from using the gzip encoding (if we decide to do so), and having some dead code linger around in torgzip.c
2016-06-19Merge remote-tracking branch 'public/thread_coverage'Nick Mathewson
2016-06-18Keep make check-spaces happyAndrea Shepard
2016-06-17Merge branch 'bug18280_029_03_nm_squashed'Nick Mathewson
2016-06-17test: Add base32_encode/decode unit testsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-17Fix base32 API to take any source length in bytesDavid Goulet
Fixes #18280 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2016-06-17Use the Autoconf macro AC_USE_SYSTEM_EXTENSIONScypherpunks
The Autoconf macro AC_USE_SYSTEM_EXTENSIONS defines preprocessor macros which turn on extensions to C and POSIX. The macro also makes it easier for developers to use the extensions without needing (or forgetting) to define them manually. The macro can be safely used because it was introduced in Autoconf 2.60 and Tor requires Autoconf 2.63 and above.
2016-06-17Merge remote-tracking branch 'dgoulet/bug18604_029_01'Nick Mathewson
2016-06-16Mark an abort() as unreachable.Nick Mathewson
2016-06-16Coverage on parse_config_line_from_str_verbose.Nick Mathewson
2016-06-16Remove parse_config_line_from_str aliasNick Mathewson
All of our code just uses parse_config_line_from_str_verbose.
2016-06-16Mark code unreachable in unescape_string()Nick Mathewson
Also, add tests for it in case someday it does become reachable.
2016-06-16On Windows, tv_sec is long, not time_t.Nick Mathewson
I'm not angry, Windows: just very disappointed.
2016-06-16Correctly close intro circuit when deleting ephemeral HSDavid Goulet
When deleting an ephemeral HS, we were only iterating on circuit with an OPEN state. However, it could be possible that an intro point circuit didn't reached the open state yet. This commit makes it that we close the circuit regardless of its state except if it was already marked for close. Fixes #18604 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-16Try to fix memarea test on 32-bit systemsNick Mathewson
2016-06-16Tests for message rate-limitingNick Mathewson
Also note a bug in the rate-limiting message.
2016-06-16I believe I found some dead code in our time parsing functionsNick Mathewson