Nick Mathewson
738a8c655a
Add an extra check to test_dir to try to debug windows jenkins issue
2016-07-01 10:10:55 -04:00
teor (Tim Wilson-Brown)
514f0041d1
Avoid disclosing exit IP addresses in exit policies by default
...
From 0.2.7.2-alpha onwards, Exits would reject all the IP addresses
they knew about in their exit policy. But this may have disclosed
addresses that were otherwise unlisted.
Now, only advertised addresses are rejected by default by
ExitPolicyRejectPrivate. All known addresses are only rejected when
ExitPolicyRejectLocalInterfaces is explicitly set to 1.
2016-07-01 15:37:13 +10:00
Nick Mathewson
64ee7bcd0c
Make sure that our tests expect the windows path separator as needed
2016-06-30 18:26:44 -04:00
Nick Mathewson
889cfac676
One more tt_u64_op
2016-06-30 16:46:53 -04:00
Nick Mathewson
591078c76d
use tt_u64_op for comparing len_descs_dumped
2016-06-30 15:34:36 -04:00
Nick Mathewson
2713de2a47
Fix more naked strdup/malloc/free instances
2016-06-30 14:36:31 -04:00
Nick Mathewson
9a92f58219
Avoid naked strdups in test_dir.c
2016-06-30 14:30:28 -04:00
Nick Mathewson
7a7bd1f9ea
Fix a memory leak in test_dir_populate_dump_desc_fifo
2016-06-30 14:30:26 -04:00
Nick Mathewson
cb54390e0f
Merge remote-tracking branch 'andrea/ticket19323_squashed'
2016-06-30 11:44:58 -04:00
Nick Mathewson
c6846d7bf0
Merge remote-tracking branch 'andrea/bug18322_v3_squashed'
2016-06-30 11:18:00 -04:00
Andrea Shepard
9580b99dab
Add unit test for dump_desc_populate_fifo_from_directory()
2016-06-30 07:03:26 +00:00
Andrea Shepard
42f089473a
Unit test for dump_desc_populate_one_file()
2016-06-30 07:03:26 +00:00
Andrea Shepard
38cced90ef
Move unparseable descriptor dumps into subdirectory of DataDir
2016-06-30 07:03:25 +00:00
Andrea Shepard
824ee581b0
Add dir/dump_unparseable_descriptors unit test
2016-06-30 07:03:25 +00:00
teor (Tim Wilson-Brown)
69535f1284
Add tv_udiff and tv_mdiff unit tests with negative values
2016-06-30 09:29:18 +10:00
teor (Tim Wilson-Brown)
d36a0c4d22
Add more unit tests for tv_udiff and tv_mdiff
2016-06-29 17:23:42 +10:00
Andrea Shepard
ad0ce8716d
Unit tests for GETINFO download/desc and download/bridge cases
2016-06-29 06:55:57 +00:00
Andrea Shepard
45724beac4
Unit test for GETINFO download/cert case
2016-06-29 05:58:22 +00:00
Andrea Shepard
becf510ef2
Unit test for GETINFO download/networkstatus case
2016-06-29 05:56:21 +00:00
Nick Mathewson
703254a832
Merge remote-tracking branch 'public/bug15942_v2_alternative'
2016-06-23 09:01:24 -04:00
Nick Mathewson
5fbd195918
Coverage hack for test_switch_id.sh
...
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-20 11:15:47 -04:00
Nick Mathewson
603cb712ef
Small coverage improvements on compat.c
2016-06-20 11:03:13 -04:00
Nick Mathewson
2b74e13a7c
More coverage in backtrace.c
2016-06-20 10:31:36 -04:00
Nick Mathewson
c1f0ec3058
Merge remote-tracking branch 'dgoulet/bug19465_029_01'
2016-06-20 10:20:41 -04:00
Nick Mathewson
ba88d78127
Fix unit test crash on 32-bit.
2016-06-20 10:20:03 -04:00
David Goulet
85edef27eb
test: Increase offset to rendcache descriptor time
...
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-20 09:53:11 -04:00
Nick Mathewson
6cedd49323
Merge branch 'bug14013_029_01_squashed'
2016-06-20 08:48:09 -04:00
nikkolasg
568dc27a19
Make base16_decodes return number of decoded bytes
...
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-20 08:44:58 -04:00
U+039b
58e6a6aaeb
Fix #19063 : Add check in utility macro
2016-06-19 12:34:49 -04:00
Nick Mathewson
81cfd5c9a1
Merge branch 'zlib_coverage_squashed'
2016-06-19 12:20:38 -04:00
Nick Mathewson
d937b86699
Unindent block
2016-06-19 12:20:24 -04:00
Nick Mathewson
808015316a
Remove support for zlib <= 1.1
...
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-19 12:20:24 -04:00
Nick Mathewson
b421648da2
Merge remote-tracking branch 'public/thread_coverage'
2016-06-19 12:15:55 -04:00
Andrea Shepard
1553512af4
Unit test for DL_SCHED_RANDOM_EXPONENTIAL
2016-06-18 16:32:16 +00:00
Andrea Shepard
033cf30b3c
Keep make check-spaces happy
2016-06-18 16:07:44 +00:00
Nick Mathewson
48b25e6811
Merge branch 'bug18280_029_03_nm_squashed'
2016-06-17 13:53:57 -04:00
David Goulet
f4f9a9be40
test: Add base32_encode/decode unit tests
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-17 13:53:47 -04:00
Nick Mathewson
a418904962
Coverage on parse_config_line_from_str_verbose.
2016-06-16 15:52:19 -04:00
Nick Mathewson
c9ea9de806
Remove parse_config_line_from_str alias
...
All of our code just uses parse_config_line_from_str_verbose.
2016-06-16 15:40:56 -04:00
Nick Mathewson
128ab31c64
Mark code unreachable in unescape_string()
...
Also, add tests for it in case someday it does become reachable.
2016-06-16 15:36:08 -04:00
Nick Mathewson
dd73787190
On Windows, tv_sec is long, not time_t.
...
I'm not angry, Windows: just very disappointed.
2016-06-16 13:57:16 -04:00
Nick Mathewson
6ceb37971e
Try to fix memarea test on 32-bit systems
2016-06-16 11:59:51 -04:00
Nick Mathewson
5c596cdbc0
Tests for message rate-limiting
...
Also note a bug in the rate-limiting message.
2016-06-16 11:54:50 -04:00
Nick Mathewson
79370914d1
tests for size_mul_check__()
...
it's important, and we should make sure we got it right.
2016-06-16 10:43:01 -04:00
Nick Mathewson
41cb26c169
Correct the rounding behavior on tv_mdiff.
...
Fix for bug 19428.
2016-06-16 10:16:04 -04:00
Nick Mathewson
f05a213fe1
Improve coverage on tv_udiff, and tv_mdiff.
...
I found some bugs in tv_mdiff; separate commit for that
2016-06-16 10:07:44 -04:00
Nick Mathewson
6dc2b605b8
Improve coverage on esc_for_log, esc_for_log_len
2016-06-16 09:58:53 -04:00
Nick Mathewson
f986e26850
Reach 100% line coverage on memarea.c
2016-06-16 09:37:44 -04:00
Nick Mathewson
05e2750ea7
whoops; blank line
2016-06-14 20:21:59 -04:00
Nick Mathewson
227d3b3d6b
Use ENABLE/DISABLE_GCC_WARNING in masater.
2016-06-14 20:21:02 -04:00
Nick Mathewson
8486dea8d7
Merge branch 'maint-0.2.8'
2016-06-14 20:16:46 -04:00
Nick Mathewson
d6b01211b9
Resolve the remaining openssl "-Wredundant-decls" warnings.
...
Another part of 19406
2016-06-14 20:14:53 -04:00
Nick Mathewson
3bffdf05d1
use new-form macros to disable -Wredundant-decls
2016-06-14 12:22:52 -04:00
Nick Mathewson
df4fa92a88
Merge branch 'maint-0.2.8'
2016-06-14 12:17:24 -04:00
Yawning Angel
c5e2f7b944
Bug 19406: Fix the unit tests to work with OpenSSL 1.1.x
...
Just as it says on the tin. Don't need to fully disable any tests and
reduce coverage either. Yay me.
2016-06-14 12:13:09 -04:00
Nick Mathewson
d6b2af7a3a
Merge branch 'bug19180_easy_squashed'
2016-06-11 10:15:40 -04:00
Nick Mathewson
e80a032b61
Add clang's -Wstring-conversion, and fix the one place it hits
2016-06-11 10:11:54 -04:00
Nick Mathewson
53a3b39da1
Add -Wmissing-variable-declarations, with attendant fixes
...
This is a big-ish patch, but it's very straightforward. Under this
clang warning, we're not actually allowed to have a global variable
without a previous extern declaration for it. The cases where we
violated this rule fall into three roughly equal groups:
* Stuff that should have been static.
* Stuff that was global but where the extern was local to some
other C file.
* Stuff that was only global when built for the unit tests, that
needed a conditional extern in the headers.
The first two were IMO genuine problems; the last is a wart of how
we build tests.
2016-06-11 10:11:54 -04:00
Nick Mathewson
80f1a2cbbd
Add the -Wextra-semi warning from clang, and fix the cases where it triggers
2016-06-11 10:11:54 -04:00
Nick Mathewson
c3adbf755b
Resolve some warnings from OSX clang.
2016-06-11 10:11:53 -04:00
Nick Mathewson
9bbd6502f0
Use autoconf, not gcc version, to decide which warnings we have
...
This gives more accurate results under Clang, which can only help us
detect more warnings in more places.
Fixes bug 19216; bugfix on 0.2.0.1-alpha
2016-06-11 10:11:53 -04:00
Nick Mathewson
4caed2424a
Enable -Woverlength-strings for GCC>=4.6 on MOST of the code.
...
IMO it's fine for us to make exceptions to this rule in the unit
tests, but not in the code at large.
2016-06-11 10:11:52 -04:00
Nick Mathewson
8f2d2933f9
Use -Wdouble-promotion in GCC >= 4.6
...
This warning triggers on silently promoting a float to a double. In
our code, it's just a sign that somebody used a float by mistake,
since we always prefer double.
2016-06-11 10:11:52 -04:00
Nick Mathewson
493499a339
Add -Wfloat-conversion for GCC >= 4.9
...
This caught quite a few minor issues in our unit tests and elsewhere
in our code.
2016-06-11 10:11:52 -04:00
Nick Mathewson
4f8086fb20
Enable -Wnull-dereference (GCC >=6.1), and fix the easy cases
...
This warning, IIUC, means that the compiler doesn't like it when it
sees a NULL check _after_ we've already dereferenced the
variable. In such cases, it considers itself free to eliminate the
NULL check.
There are a couple of tricky cases:
One was the case related to the fact that tor_addr_to_in6() can
return NULL if it gets a non-AF_INET6 address. The fix was to
create a variant which asserts on the address type, and never
returns NULL.
2016-06-11 10:10:29 -04:00
Andrea Shepard
9eeaeddbb1
Reduce make check-spaces noise
2016-06-09 11:50:25 +00:00
Nick Mathewson
f016213f7f
Unit tests for our zlib code to test and reject compression bombs.
2016-06-08 18:08:30 -04:00
Nick Mathewson
3cc374456b
Add several test scripts wrapping test_workqueue
...
This is a fairly easy way for us to get our test coverage up on
compat_threads.c and workqueue.c -- I already implemented these
tests, so we might as well enable them.
2016-06-08 17:29:06 -04:00
Nick Mathewson
1e330e1947
Repair test_crypto_openssl_version with LibreSSL
2016-06-06 10:45:23 -04:00
Nick Mathewson
83513a93a1
Check tor_sscanf return value in test_crypto.c
...
Coverity noticed that we check tor_sscanf's return value everywhere
else.
2016-06-06 10:01:50 -04:00
Nick Mathewson
ed0ecd9f13
Use tor_sscanf, not sscanf, in test_crypto.c
...
Fixes the 0.2.9 instance of bug #19213 , which prevented mingw64 from
working. This case wasn't in any released Tor.
2016-06-02 10:16:15 -04:00
Nick Mathewson
b458a81cc5
Merge branch 'maint-0.2.8'
2016-06-02 10:13:35 -04:00
Nick Mathewson
a32ca313c4
Merge branch 'maint-0.2.7' into maint-0.2.8
2016-06-02 10:12:56 -04:00
Nick Mathewson
5854b19816
Use tor_sscanf, not sscanf, in test_util.c.
...
Fixes the 0.2.7 case of bug #19213 , which prevented mingw64 from
working.
2016-06-02 10:11:29 -04:00
Nick Mathewson
3cdc8bfa2c
Let's not even talk about those errors, ok?
2016-05-30 17:14:46 -04:00
Nick Mathewson
97f2c1c58e
Wait, we had sprintf() in our unit tests?? FOR SHAME!
2016-05-30 16:50:57 -04:00
Nick Mathewson
4f1a04ff9c
Replace nearly all XXX0vv comments with smarter ones
...
So, back long ago, XXX012 meant, "before Tor 0.1.2 is released, we
had better revisit this comment and fix it!"
But we have a huge pile of such comments accumulated for a large
number of released versions! Not cool.
So, here's what I tried to do:
* 0.2.9 and 0.2.8 are retained, since those are not yet released.
* XXX+ or XXX++ or XXX++++ or whatever means, "This one looks
quite important!"
* The others, after one-by-one examination, are downgraded to
plain old XXX. Which doesn't mean they aren't a problem -- just
that they cannot possibly be a release-blocking problem.
2016-05-30 16:18:16 -04:00
Nick Mathewson
1e5ad15688
Merge remote-tracking branch 'arma/task19035-fixedup'
2016-05-27 13:22:16 -04:00
Roger Dingledine
11d52a449c
Disable GET /tor/bytes.txt and GETINFO dir-usage
...
Remove support for "GET /tor/bytes.txt" DirPort request, and
"GETINFO dir-usage" controller request, which were only available
via a compile-time option in Tor anyway.
Feature was added in 0.2.2.1-alpha. Resolves ticket 19035.
2016-05-27 11:15:21 -04:00
Nick Mathewson
b7fac185a6
Merge branch 'maint-0.2.8'
2016-05-25 16:59:46 -04:00
Nick Mathewson
36b2b48308
Merge branch 'bug18668_028' into maint-0.2.8
2016-05-25 16:58:43 -04:00
Nick Mathewson
44ea3dc331
Merge branch 'maint-0.2.8'
2016-05-25 10:21:15 -04:00
Nick Mathewson
be3875cda2
Make sure that libscrypt_scrypt actually exists before using it.
...
Previously, if the header was present, we'd proceed even if the
function wasn't there.
Easy fix for bug 19161. A better fix would involve trying harder to
find libscrypt_scrypt.
2016-05-24 10:31:02 -04:00
cypherpunks
0e20d056e9
Prevent ASAN from registering a SIGSEGV handler
...
AddressSanitizer's (ASAN) SIGSEGV handler overrides the backtrace
handler and prevents it from printing its backtrace. The output of ASAN
is different from what 'bt_test.py' expects and causes backtrace test
failures.
The 'allow_user_segv_handler' option allows applications to set their
own SIGSEGV handler but is not supported by older GCC versions. These
older GCC versions do support the 'handle_segv' which prevents ASAN from
setting its SIGSEGV handler.
2016-05-20 08:34:18 -04:00
Nick Mathewson
f2205071f0
Remove round_int64_to_next_multiple_of: It is now unused.
2016-05-19 21:21:24 -04:00
Nick Mathewson
dcc4fd4403
Merge branch 'maint-0.2.8'
2016-05-19 16:05:13 -04:00
Nick Mathewson
33841a6030
Merge remote-tracking branch 'teor/fix18809-warnings' into maint-0.2.8
2016-05-19 16:04:56 -04:00
Nick Mathewson
4a14c2cfc7
Merge branch 'maint-0.2.8'
2016-05-19 15:56:39 -04:00
Nick Mathewson
0d6f293e0e
Merge remote-tracking branch 'public/bug19073' into maint-0.2.8
2016-05-19 15:56:31 -04:00
teor (Tim Wilson-Brown)
2d21f03cdc
Fix unused-but-set-variable warnings in the connection unit tests
...
No behaviour change - just remove the variables
2016-05-19 12:49:36 -04:00
Nick Mathewson
a7a44f2db0
Merge branch 'maint-0.2.8'
2016-05-19 08:29:58 -04:00
Nick Mathewson
06803c317f
Fix a compilation error in test_dir.c
2016-05-19 08:27:11 -04:00
Nick Mathewson
d718c717a6
Merge branch 'maint-0.2.8'
2016-05-19 08:25:12 -04:00
Nick Mathewson
9f217c83b0
Merge branch 'bug18809_028_squashed' into maint-0.2.8
2016-05-19 08:17:02 -04:00
teor (Tim Wilson-Brown)
f698b509d8
Add unit tests for networkstatus_consensus_is_bootstrapping
2016-05-19 07:58:41 -04:00
teor (Tim Wilson-Brown)
d5c70d7102
Restore and improve download schedule unit tests
2016-05-19 07:58:41 -04:00
teor (Tim Wilson-Brown)
4254d0297c
Update unit tests for multiple bootstrap connections
2016-05-19 07:58:41 -04:00
Nick Mathewson
159ea7a88f
Fix a bad sizeof() in test_crypto.c. Harmless. Spotted by coverity.
2016-05-18 08:29:13 -04:00
Nick Mathewson
ab932cd7bf
Remove duplicate siging_key_cert fields.
...
With the fix for #17150 , I added a duplicate certificate here. Here
I remove the original location in 0.2.8. (I wouldn't want to do
that in 027, due to the amount of authority-voting-related code
drift.)
Closes 19073.
2016-05-17 20:04:16 -04:00
Nick Mathewson
36909674b4
Merge remote-tracking branch 'teor/bug18963-remember-v2'
2016-05-17 12:15:53 -04:00
Nick Mathewson
6382cd93cb
Merge branch 'maint-0.2.8'
2016-05-17 11:10:20 -04:00
Nick Mathewson
0f9b0b8bfe
Initialize networking _before_ initializing libevent in the tests
...
This prevents WSANOTINITIALISED errors and fixes bug 18668. Bugfix
on 0.2.8.1-alpha -- 1bac468882
specifically.
2016-05-16 14:30:04 -04:00
Nick Mathewson
249f3a1664
Fix memory leak in test_crypto_aes_ctr_testvec
2016-05-16 09:55:09 -04:00
Nick Mathewson
9abd7b8f90
Windows lacks truncate(3).
...
Fix the new crypto tests, which used truncate(3).
2016-05-16 09:25:19 -04:00
Nick Mathewson
060e0d0a75
Merge branch 'crypto_unit_tests_v2_squashed'
2016-05-16 08:26:11 -04:00
Nick Mathewson
365d0fcc6d
Cover all our DH code, and/or mark it unreachable.
2016-05-16 08:26:00 -04:00
Nick Mathewson
94b34d1be6
At long last, unit tests for degenerate DH public keys.
...
Apparently, we detect and reject them correctly. Aren't you glad?
2016-05-16 08:26:00 -04:00
Nick Mathewson
d88656ec06
Slight improvements to DH coverage.
2016-05-16 08:25:59 -04:00
Nick Mathewson
7a5f15b6e0
Improve test coverage of our strongest-rng code.
2016-05-16 08:25:59 -04:00
Nick Mathewson
148f0004e1
Test coverage on ed25519 load/store functions.
2016-05-16 08:25:59 -04:00
Nick Mathewson
8a536be705
Mark unreachable lines in crypto_curve25519.c
...
Also, resolve a bug in test_ntor_cl.c
2016-05-16 08:25:53 -04:00
Nick Mathewson
df3a5e0cad
HKDF-SHA256 test vectors from RFC5869
2016-05-16 08:25:53 -04:00
Nick Mathewson
a7207329a8
Run tor_sscanf test in subprocess, in hopes of coaxing more info from jenkins
2016-05-12 13:37:05 -04:00
Nick Mathewson
445e05a015
Fix inconsistent tab/space mixing in include.am files.
...
This is a whitespace only, cosmetic fix.
There is still some inconsistency between lists, but less
inconsistency inside individual lists.
2016-05-12 13:06:58 -04:00
Nick Mathewson
607a9056d4
Merge branch 'ftrapv_v3'
...
There were some conflicts here, and some breakage to fix concerning
library link order in newer targets.
2016-05-12 13:00:45 -04:00
Nick Mathewson
fb999abea6
Document why we build memwipe that way.
2016-05-12 12:56:47 -04:00
Nick Mathewson
b1dce55b82
Do not apply bugtrapping flags to test-memwipe, since testing memwipe requires bugs.
...
Fixes bug 18901.
2016-05-12 11:22:10 -04:00
Nick Mathewson
20432fc541
Refactor out u64_dbl_t
...
This type saved a tiny amount of allocation, but not enough to be
worth keeping.
(This is in preparation for moving choose_array_element_by_weight)
2016-05-12 11:21:28 -04:00
Nick Mathewson
ce854a8d22
Add -ftrapv to gcc-hardening ... mostly!
...
We know there are overflows in curve25519-donna-c32, so we'll have
to have that one be fwrapv.
Only apply the asan, ubsan, and trapv options to the code that does
not need to run in constant time. Those options introduce branches
to the code they instrument.
(These introduced branches should never actually be taken, so it
might _still_ be constant time after all, but branch predictors are
complicated enough that I'm not really confident here. Let's aim for
safety.)
Closes 17983.
2016-05-12 11:21:28 -04:00
teor (Tim Wilson-Brown)
cdb528d841
Fetch certificates from the same directory as previous certificates
...
Improves the fix to #18963 .
2016-05-11 13:30:30 -04:00
Nick Mathewson
00ee62b8a5
Merge branch 'pubsub_squashed'
2016-05-11 13:26:29 -04:00
Nick Mathewson
80a6c8caa3
Basic work on a publish/subscribe abstraction
...
The goal here is to provide a way to decouple pieces of the code
that want to learn "when something happens" from those that realize
that it has happened.
The implementation here consists of a generic backend, plus a set of
macros to define and implement a set of type-safe frontends.
2016-05-11 13:25:11 -04:00
Nick Mathewson
33d3572a1d
Merge branch 'feature15588_squashed'
2016-05-09 14:41:36 -04:00
Roger Dingledine
ce8266d52d
fix typos/etc before i go nuts on #18809
2016-05-09 14:40:21 -04:00
John Brooks
dcc11674db
Add client auth for ADD_ONION services
2016-05-09 14:28:58 -04:00
John Brooks
d5a23ce115
Move rend auth cookie en-/decoding to a function
...
Tor stores client authorization cookies in two slightly different forms.
The service's client_keys file has the standard base64-encoded cookie,
including two chars of padding. The hostname file and the client remove
the two padding chars, and store an auth type flag in the unused bits.
The distinction makes no sense. Refactor all decoding to use the same
function, which will accept either form, and use a helper function for
encoding the truncated format.
2016-05-09 14:28:08 -04:00
Nick Mathewson
69380033d6
Merge branch 'timeouts_v2_squashed'
2016-05-09 14:06:10 -04:00
Nick Mathewson
af132fc299
timer tests: differences in timing accuracy can be negative.
...
Also, use symbolic names for good-enough thresholds for timer accuracy.
2016-05-09 14:04:54 -04:00
Nick Mathewson
11a09778d6
Test coverage for timers.
2016-05-09 14:04:54 -04:00
Nick Mathewson
118556e4b3
Quick-and-dirty test for timers code.
2016-05-09 14:04:53 -04:00
Nick Mathewson
5845c22822
Ed25519 test vectors from draft-irtf-cfrg-eddsa-05
2016-05-03 09:54:26 -04:00
Nick Mathewson
54697fa40b
Add test vector for AES_CTR from NIST SP800-38a sec F.5
2016-05-03 09:40:47 -04:00
Nick Mathewson
44a3248197
Add test vector for Curve25519 from RFC7748
2016-05-03 09:31:34 -04:00
Nick Mathewson
405b637598
tests for some of the simpler functions in crypto.c
2016-05-03 09:21:08 -04:00
Nick Mathewson
d1f2af57df
White-box tests for crypto_rand_*_range(), rand_hostname().
...
Coverage-driven; part of ticket 16794.
2016-05-03 09:21:07 -04:00
Nick Mathewson
b72aa18d73
test_bt.sh: Check stderr for backtrace as well as stdout.
...
addresssanitizer likes to put backtraces on stderr.
2016-05-02 12:58:58 -04:00
teor (Tim Wilson-Brown)
05cf286713
Make mock function static to prevent future clashes
2016-04-28 12:26:38 +10:00
teor (Tim Wilson-Brown)
692828bea5
Decide to advertise begindir support like we decide to advertise DirPort
...
Decide to advertise begindir support in a similar way to how
we decide to advertise DirPort.
Fix up the associated descriptor-building unit tests.
Resolves #18616 , bugfix on 0c8e042c30
in #12538 in 0.2.8.1-alpha.
2016-04-28 12:26:38 +10:00
Nick Mathewson
bff53aabce
Remove redundant declarations of MIN
...
Apparently somewhere along the line we decided that MIN might be
missing.
But we already defined it (if it was missing) in compat.h, which
everybody includes.
Closes ticket 18889.
2016-04-25 15:28:58 -04:00
Nick Mathewson
520799f084
Merge branch 'handles_squashed'
2016-04-19 14:08:05 -04:00
Nick Mathewson
e015f7c9cc
Basic 'handle' implementation and tests.
...
This abstraction covers the case where one part of the program needs
to refer to another object that is allowed to disappear.
2016-04-19 14:07:43 -04:00
Roger Dingledine
525307c0ea
fix typos/etc before i go nuts on #18809
2016-04-13 00:06:30 -04:00
Nick Mathewson
eafcd7b0fc
Merge branch 'maint-0.2.8'
2016-04-12 13:02:37 -04:00
Nick Mathewson
1a065cea46
Do not link tests against both libor.a and libor-testing.a
...
Also, put libor-testing.a at a better position in the list of
libraries, to avoid linker errors.
This is a fix, or part of a fix, for 18490.
Conflicts:
src/test/include.am
2016-04-12 02:48:46 +00:00
David Goulet
40827da3bf
Turn TestingClientBootstrap* into non-testing options
...
This changes simply renames them by removing "Testing" in front of them and
they do not require TestingTorNetwork to be enabled anymore.
Fixes #18481
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2016-04-07 10:57:59 -04:00
Nick Mathewson
7532cd439b
When we get a bad nickname, explain what a good one is.
...
Closes #18300 ; patch from "icanhasaccount".
2016-04-07 10:54:53 -04:00
Nick Mathewson
d7a0382ba3
Don't call the system toupper or tolower.
...
Yes, we could cast to unsigned char first, but it's probably safest
to just use our own (in test_util), or remove bad-idea features that
we don't use (in readpassphrase.c).
Fixes 18728.
2016-04-05 23:22:28 -04:00
Nick Mathewson
32e8886314
One more test that didnt pass on windows. See #18665 .
2016-03-28 08:57:29 -04:00
Nick Mathewson
c0568a89d9
Whitespace fixes
2016-03-26 09:54:31 -04:00
Nick Mathewson
24c0c5ef19
Disable failing broken time format case for windows.
2016-03-25 22:00:20 -04:00
Nick Mathewson
4f86d75a4b
try to fix a test failure for sizeof(time_t)==4.
2016-03-24 12:26:46 -04:00
Nick Mathewson
6256c61d95
Merge branch 'timegm_overflow_squashed'
2016-03-24 10:18:00 -04:00
teor (Tim Wilson-Brown)
19fb86a2dc
Add a missing UL on a long in a unit test
2016-03-24 10:17:48 -04:00
teor (Tim Wilson-Brown)
b99bd3e7ff
Add unit tests with dates from 2035 to 2039
...
Platforms with 32-bit time_t sometimes give different results.
They don't always indicate failure on overflow, #18480 should
fix these.
2016-03-24 10:17:48 -04:00
Nick Mathewson
dae8484107
Try to fix an intermittent test failure on openbsd.
2016-03-22 09:12:59 -04:00
Nick Mathewson
9dff41694a
Never use sprintf. tor_snprintf instead. Bug in tests, not in any released tor.
2016-03-22 08:52:17 -04:00
Nick Mathewson
ddd30f966a
Merge remote-tracking branch 'arma/ticket18332-try3'
2016-03-21 10:41:23 -04:00
Nick Mathewson
cb3f9bc2d4
Merge branch 'bug18570_027'
2016-03-21 10:20:16 -04:00
Andrea Shepard
1cdc7fddb2
Add new channel/queue_incoming unit tests; modify channel unit tests for new clarified handling of alloc/free responsibility for queued incoming cells
2016-03-21 10:14:47 -04:00
Steven Chamberlain
a42938c076
test_options.c: assert that TransProxyType is tested
...
If a new platform defines USE_TRANSPARENT, ensure that a test runs for
its TransProxyType.
2016-03-21 09:51:35 -04:00
Steven Chamberlain
45681f695c
test_options.c: NULL a pointer after free #18447
...
tdata will be double-freed if none of linux, __FreeBSD__, DARWIN or
__OpenBSD__ are defined. (For example, FreeBSD derivatives).
2016-03-17 19:20:36 -04:00
Nick Mathewson
c9899ee640
Merge remote-tracking branch 'weasel/bug18458'
2016-03-15 09:18:24 -04:00
Roger Dingledine
edeba3d472
simplify rend_cache_store_status_t back to a boolean
...
it used to be a tri-state, but now it's just a bi-state, so we can
take out all the machinery like the enum.
2016-03-11 10:49:57 -05:00
Roger Dingledine
5390296338
rip out hid_serv_acting_as_directory()
...
When we made HidServDirectoryV2 always 1, we removed the situation
where a relay could choose not to be an HSDir. Now simplify the
rest of the code to reflect this decision.
(We have to remove two apparently unrelated free() calls in the unit
tests, since they used to free stuff that we created as a side effect
of calling router_get_my_routerinfo(), and now we no longer call that.)
2016-03-11 10:45:03 -05:00
Roger Dingledine
e167910fce
rip out hid_serv_responsible_for_desc_id()
...
This simplifies relay behavior, because the relay offers the hsdir
functionality independent of whether the directory authorities have
decided this relay is suitable for clients to use yet.
Implements ticket 18332.
2016-03-11 10:40:31 -05:00
Nick Mathewson
36ac47bd85
Merge remote-tracking branch 'public/bug18204_028'
2016-03-11 10:10:15 -05:00
Nick Mathewson
ef31c8862f
Add changes file for 18448; refactor
...
(I've made it so FreeBSD || FreeBSD_kernel is enough to ensure that
we think you might have ipfw, and so that the logic is all in one
place.)
2016-03-11 10:05:28 -05:00
Steven Chamberlain
db263442af
enable and test transproxy on FreeBSD derivatives #18448
...
The transproxy feature is only enabled when __FreeBSD__ is defined, and
only regular FreeBSD does that. Change this to __FreeBSD_kernel__ which
is defined on derivatives as well.
This enables the relevant options/validate__transproxy test on FreeBSD
derivatives.
2016-03-11 10:01:25 -05:00
Nick Mathewson
82df3e70ac
Do not link tests against both libor.a and libor-testing.a
...
Also, put libor-testing.a at a better position in the list of
libraries, to avoid linker errors.
This is a fix, or part of a fix, for 18490.
2016-03-11 09:53:25 -05:00
Peter Palfrader
1ef7df551d
First RelaxDirModeCheck implementation
2016-03-01 17:08:14 +01:00
Alexander Færøy
d4c5ccf79c
Use the kdf_rfc5869() function instead of kdf().
...
This patch fixes an issue in "ntor_ref.py gen_kdf_vectors" where the
script tries to call the undefined function kdf().
2016-02-28 15:24:59 +01:00
Nick Mathewson
57699de005
Update the copyright year.
2016-02-27 18:48:19 +01:00
Nick Mathewson
f2e23d5ad6
Fix a huge number of leaks in test_config.c
...
I no longer see asan reporting memory leaks in the unit tests.
2016-02-24 15:44:40 -05:00
Nick Mathewson
a3f764ea69
Fix memory leaks in routerlist/pick_directory_server_impl test
2016-02-24 15:13:29 -05:00
Nick Mathewson
ba0ddd7467
Fix a leak in test_have_enough_mem_for_dircache
2016-02-24 15:06:12 -05:00
Nick Mathewson
73c433a48a
Remove the freelist from memarea.c
...
This is in accordance with our usual policy against freelists,
now that working allocators are everywhere.
It should also make memarea.c's coverage higher.
I also doubt that this code ever helped performance.
2016-02-24 14:32:09 -05:00
Nick Mathewson
1318c1611f
Another clang+_FORTIFY_SOURCE issue
...
There was a parenthesis issue in test_util that clang found
confusing. This part was only in master.
Closes issue 14821.
2016-02-23 14:06:45 -05:00
Nick Mathewson
e88686cb2c
Merge remote-tracking branch 'teor/bug18348-v2'
2016-02-23 07:36:56 -05:00
Nick Mathewson
882e0fbd76
Merge branch 'bug17795'
2016-02-23 07:25:12 -05:00
Nick Mathewson
b3534dfc5e
Add missing check to test_address_get_if_addrs_ifaddrs. Bug 18378
2016-02-23 07:17:00 -05:00
Andrea Shepard
cda2381789
Appease make check-spaces
2016-02-23 05:07:29 +00:00
Nick Mathewson
e019e11e61
Another memory leak in the tests
2016-02-22 16:20:11 -05:00
Nick Mathewson
4cc50ee805
Small fixup on last fix to test leaks
2016-02-22 16:16:56 -05:00
Nick Mathewson
041d6482db
Fix a bunch of memory leaks in the unit tests
2016-02-22 16:14:03 -05:00
Nick Mathewson
ef42c00cf0
asan does not like TO_CONN(NULL)
2016-02-22 15:45:37 -05:00
teor (Tim Wilson-Brown)
d359cfab13
Update unit tests for fascist_firewall_choose_address*
...
Check that clients, bridge clients, and relays choose addresses
as expected.
2016-02-21 00:00:40 +11:00
Nick Mathewson
31c96a3699
Fix a NULL dereference on unit test failure. CID 1353177.
2016-02-16 12:55:41 -05:00
Nick Mathewson
fed8c5199a
Merge branch 'check_log_mutex_uncherrypicked'
2016-02-11 13:41:31 -05:00
teor (Tim Wilson-Brown)
a7a98e27ea
Initialise logging before trying to use it in unit tests
2016-02-11 13:41:25 -05:00
Nick Mathewson
838d4dee12
make check-spaces
2016-02-11 12:50:55 -05:00
Nick Mathewson
2b5ff52594
Merge branch 'feature17840-v11-tests_truncated'
2016-02-11 12:45:51 -05:00
Nick Mathewson
ba2be81fc3
Merge remote-tracking branch 'teor/feature17840-v11-merged-v2'
2016-02-11 12:20:20 -05:00
Nick Mathewson
69c47ab5fd
Merge remote-tracking branch 'sebastian/bug18242'
2016-02-10 15:38:52 -05:00
Nick Mathewson
4dc8dc4b89
Merge remote-tracking branch 'public/bug18184'
2016-02-10 15:36:48 -05:00
Nick Mathewson
a8d6989589
Whitespace fixes
2016-02-10 15:35:46 -05:00
Nick Mathewson
9746aed2ba
Another automated rename.
...
Also simplify crypto_common_digests() to have no loop.
2016-02-10 15:32:12 -05:00
Nick Mathewson
8a4bba06d2
Rename crypto_digest_all, and digests_t.
...
They are no longer "all" digests, but only the "common" digests.
Part of 17795.
This is an automated patch I made with a couple of perl one-liners:
perl -i -pe 's/crypto_digest_all/crypto_common_digests/g;' src/*/*.[ch]
perl -i -pe 's/\bdigests_t\b/common_digests_t/g;' src/*/*.[ch]
2016-02-10 15:28:19 -05:00
Nick Mathewson
31a27729b9
Fix spaces.
2016-02-06 14:00:24 -05:00
Sebastian Hahn
55d6fd27cb
Fix the --disable-asserts-in-tests configure option
2016-02-05 14:40:07 +01:00
Nick Mathewson
1bac468882
Fix two problems in the 0.2.8.x unit tests
...
1. We were sometimes using libevent uninitialized, which is Not Allowed.
2. The malformed-PTR dns test was supposed to get a -1 output... but
the test was wrong, since it forgot that in-addr.arpa addresses
are in reverse order.
Bugs not in any released tor.
2016-02-04 12:30:48 -05:00
Nick Mathewson
fa52b6f075
Make tortls unit tests pass with LibreSSL.
...
Part of the fix for 17921.
2016-02-03 11:31:57 -05:00
Nick Mathewson
c1c3e45eab
Make crypto/rng_engine test pass on libressl. Bug not in any released tor.
2016-02-03 11:18:16 -05:00
Nick Mathewson
27582325dc
Make Tor build happily with OpenSSL master and libressl.
...
Also tested with 1.0.0t and 1.0.2f.
Closes ticket 19784.
Closes most of 17921. (Still need to make some tests pass.)
2016-02-03 11:13:12 -05:00
teor (Tim Wilson-Brown)
c213f277cd
Make bridge clients prefer the configured bridge address
...
When ClientPreferIPv6ORPort is auto, bridges prefer the configured
bridge ORPort address. Otherwise, they use the value of the option.
Other clients prefer IPv4 ORPorts if ClientPreferIPv6ORPort is auto.
When ClientPreferIPv6DirPort is auto, all clients prefer IPv4 DirPorts.
2016-02-03 23:56:19 +11:00
teor (Tim Wilson-Brown)
b316c87bc9
Make bridge clients prefer the configured bridge address
...
When ClientPreferIPv6ORPort is auto, bridges prefer the configured
bridge ORPort address. Otherwise, they use the value of the option.
Other clients prefer IPv4 ORPorts if ClientPreferIPv6ORPort is auto.
When ClientPreferIPv6DirPort is auto, all clients prefer IPv4 DirPorts.
2016-02-03 23:52:39 +11:00
Nick Mathewson
b860f82d56
Treat bt_test.py failures as "SKIP" on freebsd.
...
Closes #18204 .
2016-02-01 14:11:45 -05:00
Nick Mathewson
c6fa55d2da
Bitwise negate is ~, not !.
...
Spotted by coverity; bug in tests only, not in any released Tor.
This is CID 1351128
2016-02-01 13:12:58 -05:00
Nick Mathewson
7631cffbcc
Fix warnings from check-spaces
2016-02-01 10:24:13 -05:00
Nick Mathewson
ac7e43d30a
Redux: don't expect unix sockets to be accepted on windows
2016-02-01 10:21:11 -05:00
Nick Mathewson
49442b5e67
Don't expect unix sockets to be accepted on Windows
...
Fixes failures in test_config.c; bug not in any released tor.
2016-02-01 09:57:54 -05:00
Nick Mathewson
f4ac44c9f2
Merge branch 'options_validate_second_round_cleaned'
2016-02-01 09:52:11 -05:00
teor (Tim Wilson-Brown)
e3da5ad6e3
Replace incorrect use of snprintf in unit tests with tor_snprintf
...
This avoids a potential out of bounds write.
2016-02-01 09:50:43 -05:00
teor (Tim Wilson-Brown)
f7b2ae91e9
Make all unit tests independent of log message order and count
2016-02-01 09:50:43 -05:00
teor (Tim Wilson-Brown)
dbb5819e96
Report malformed options in options_validate unit tests
2016-02-01 09:50:42 -05:00
Ola Bini
fe92e9bb96
Add a helper to search for strings in the log, and change option tests to use this helper instead of looking at specific indices in the log list
2016-02-01 09:50:42 -05:00
Nick Mathewson
4cd93a6a59
Merge branch 'maint-0.2.7'
...
(We already had a fix for the address test freebsd issues)
2016-02-01 09:41:45 -05:00
Nick Mathewson
7d1fe7c9e7
Try to fix address tests on FreeBSD
...
In jails, there is not always a localhost.
Bugfix not on any released Tor.
2016-02-01 09:38:31 -05:00
teor (Tim Wilson-Brown)
1dae4dac12
Add unit tests for ClientUseIPv[4,6] and ClientPreferIPv6[OR,Dir]Port
2016-02-01 09:15:07 +11:00
teor (Tim Wilson-Brown)
26f68a771c
Report malformed options in options_validate unit tests
2016-02-01 09:11:16 +11:00
teor (Tim Wilson-Brown)
13db39b856
Fix existing options_validate unit tests for ClientUseIPv4
2016-02-01 09:10:52 +11:00
Ola Bini
8627a40fba
Add a helper to search for strings in the log, and change option tests to use this helper instead of looking at specific indices in the log list
2016-02-01 09:09:44 +11:00
Nick Mathewson
5f7df92571
Remove support for unsigned time_t
...
We've never actually tested this support, and we should probably assume
it's broken.
To the best of my knowledge, only OpenVMS has this, and even on
OpenVMS it's a compile-time option to disable it. And I don't think
we build on openvms anyway. (Everybody else seems to be working
around the 2038 problem by using a 64-bit time_t, which won't expire
for roughly 292 billion years.)
Closes ticket 18184.
2016-01-29 09:18:59 -05:00
teor (Tim Wilson-Brown)
c4cb4706c9
Merge branch 'feature17840-v11-squashed' into feature17840-v11-merged
...
Conflicts:
src/or/directory.c
src/test/test_routerlist.c
Fix minor conflicts.
2016-01-29 07:37:06 +11:00
teor (Tim Wilson-Brown)
77a9de0d48
Automatically use IPv6 when ClientUseIPv4 is 0
...
Consequential changes to log messages:
* it's no longer possible to disable both IPv4 and IPv6,
* refactor common string out of remaining log messages
2016-01-29 07:16:32 +11:00
teor (Tim Wilson-Brown)
3b8216f215
Use fascist firewall and ClientUseIPv4 for bridge clients
...
Bridge clients ignore ClientUseIPv6, acting as if it is always 1.
This preserves existing behaviour.
Make ClientPreferIPv6OR/DirPort auto by default:
* Bridge clients prefer IPv6 by default.
* Other clients prefer IPv4 by default.
This preserves existing behaviour.
2016-01-29 07:16:04 +11:00
teor (Tim Wilson-Brown)
e72cbf7a4e
Choose directory servers by IPv4/IPv6 preferences
...
Add unit tests, refactor pick_directory functions.
2016-01-29 07:13:57 +11:00
teor (Tim Wilson-Brown)
268608c0a0
Choose OR Entry Guards using IPv4/IPv6 preferences
...
Update unit tests.
2016-01-29 07:13:57 +11:00
teor (Tim Wilson-Brown)
2d33d192fc
Add ClientUseIPv4 and ClientPreferIPv6DirPort torrc options
...
ClientUseIPv4 0 tells tor to avoid IPv4 client connections.
ClientPreferIPv6DirPort 1 tells tor to prefer IPv6 directory connections.
Refactor policy for IPv4/IPv6 preferences.
Fix a bug where node->ipv6_preferred could become stale if
ClientPreferIPv6ORPort was changed after the consensus was loaded.
Update documentation, existing code, add unit tests.
2016-01-29 07:13:57 +11:00
Nick Mathewson
1a022525f7
attempt to fix crashes in unit tests
2016-01-27 09:42:08 -05:00
Nick Mathewson
39a86185c8
Correct further grammatical errors in tor comments
...
Avoid using a pronoun where it makes comments unclear.
Avoid using gender for things that don't have it.
Avoid assigning gender to people unnecessarily.
2016-01-27 08:51:28 -05:00
Nick Mathewson
cbed61d128
Merge remote-tracking branch 'twstrike/parse_port_config_tests'
2016-01-21 12:15:39 -05:00
Nick Mathewson
ae3d2a93f0
Merge remote-tracking branch 'twstrike/options_test'
2016-01-19 20:14:18 -05:00
Ola Bini
32946e2c96
Make sure that tests for domain sockets only run on OSes with domain sockets
2016-01-19 11:14:41 -05:00
Ola Bini
3e738211d4
Use correct u64 int ops instead of regular int ops, in order to avoid warnings on 32bit clang
2016-01-19 11:11:01 -05:00
Nick Mathewson
da4dbb29b7
Fix some leaks in the unit tests.
2016-01-15 11:45:19 -05:00
Nick Mathewson
f6ea7a6258
Make the new directory tests build and run again.
...
Had to disable a couple.
Also add changes file for 17003.
2016-01-15 11:20:14 -05:00
Nick Mathewson
537214d10e
Merge remote-tracking branch 'twstrike/directory-tests'
2016-01-15 11:08:22 -05:00
Nick Mathewson
f47d4af04c
Whitespace cleanup
2016-01-15 10:57:03 -05:00
Ola Bini
1722232d78
Update tests to match current changes to options_validate
2016-01-13 10:54:08 -05:00
Ola Bini
6d5215fd19
Move clearing of log messages on advice from @cypherpunks, in order to minimize risk of race conditions leading to another memory leak
2016-01-13 10:35:49 -05:00
Ola Bini
5c1c117b8e
Revert my addition of callback cleaner and instead use existing functionality for temporary log files
2016-01-13 10:35:06 -05:00
Ola Bini
0bfa616e2e
Remove a small memory leak in log callback setup
2016-01-13 10:35:05 -05:00
Ola Bini
ce953b864b
Fix memory leaks
2016-01-13 10:35:05 -05:00
Ola Bini
f2a7a83626
Fix all white space issues
2016-01-13 10:34:24 -05:00
Ola Bini
1a3fcda0a3
Fix some issues in gcc warnings
2016-01-13 10:32:09 -05:00
Ola Bini
5edd431d92
Add tests for options_act
2016-01-13 10:31:13 -05:00
Ola Bini
fcd7923a96
Fix remaining memory leaks
2016-01-12 12:33:05 -05:00
Ola Bini
ee39869f67
Fix some memory leaks
2016-01-12 12:14:34 -05:00
Ola Bini
b24a16e56e
Make it compile with gcc-warnings turned on
2016-01-12 11:53:07 -05:00
Fergus Dall
9e5a6f0293
Stop log_heartbeat test from failing in timezones with non-integer offsets
...
Instead of comparing the end of the time string against a constant,
compare it to the output of format_local_iso_time when given the
correct input.
2016-01-12 22:01:46 +10:30