]> git.ipfire.org Git - thirdparty/tor.git/log
thirdparty/tor.git
11 years agoMerge remote-tracking branch 'origin/maint-0.2.5'
Nick Mathewson [Sun, 19 Oct 2014 19:40:25 +0000 (15:40 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.5'

11 years agoMerge remote-tracking branch 'origin/maint-0.2.4' into maint-0.2.5
Nick Mathewson [Sun, 19 Oct 2014 19:40:07 +0000 (15:40 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.4' into maint-0.2.5

11 years agoMerge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4
Nick Mathewson [Sun, 19 Oct 2014 19:39:48 +0000 (15:39 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4

11 years agoNote that our #13426 fix is also a #13471 fix.
Nick Mathewson [Sun, 19 Oct 2014 19:38:44 +0000 (15:38 -0400)] 
Note that our #13426 fix is also a #13471 fix.

See also http://marc.info/?l=openssl-dev&m=141357408522028&w=2

11 years agoformat_changelog: Sort sections case-insensitively
Nick Mathewson [Sun, 19 Oct 2014 18:19:22 +0000 (14:19 -0400)] 
format_changelog: Sort sections case-insensitively

11 years agoformat_changelog.py: fix spelling of "hyphenatable"
Nick Mathewson [Sun, 19 Oct 2014 16:59:17 +0000 (12:59 -0400)] 
format_changelog.py: fix spelling of "hyphenatable"

11 years agoformat_changelog.py: tweak hyphenation rules
Nick Mathewson [Sun, 19 Oct 2014 16:57:57 +0000 (12:57 -0400)] 
format_changelog.py: tweak hyphenation rules

Mark all our generated command names, and anything with a
double-hyphen, as unhyphenatable.

11 years agoTeach format_changelog to sort and collate sections.
Nick Mathewson [Sun, 19 Oct 2014 16:44:19 +0000 (12:44 -0400)] 
Teach format_changelog to sort and collate sections.

Give it options to turn off collation and/or wrapping.

11 years agoformat_changelog.py: learn about the ReleaseNotes format
Nick Mathewson [Sun, 19 Oct 2014 15:47:16 +0000 (11:47 -0400)] 
format_changelog.py: learn about the ReleaseNotes format

11 years agoMerge remote-tracking branch 'origin/maint-0.2.5'
Nick Mathewson [Thu, 16 Oct 2014 17:29:14 +0000 (13:29 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.5'

11 years agoDowngrade 'unexpected sendme cell from client' to PROTOCOL_WARN
Nick Mathewson [Thu, 16 Oct 2014 17:04:11 +0000 (13:04 -0400)] 
Downgrade 'unexpected sendme cell from client' to PROTOCOL_WARN

Closes 8093.

11 years agoMerge remote-tracking branch 'yawning/bug13314'
Nick Mathewson [Thu, 16 Oct 2014 13:12:13 +0000 (09:12 -0400)] 
Merge remote-tracking branch 'yawning/bug13314'

11 years agoMerge remote-tracking branch 'origin/maint-0.2.5'
Nick Mathewson [Thu, 16 Oct 2014 13:09:20 +0000 (09:09 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.5'

11 years agoMerge remote-tracking branch 'origin/maint-0.2.4' into maint-0.2.5
Nick Mathewson [Thu, 16 Oct 2014 13:08:52 +0000 (09:08 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.4' into maint-0.2.5

11 years agoMerge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4
Nick Mathewson [Thu, 16 Oct 2014 13:08:32 +0000 (09:08 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4

11 years agoMerge branch 'no_sslv3_023' into maint-0.2.3
Nick Mathewson [Thu, 16 Oct 2014 13:08:09 +0000 (09:08 -0400)] 
Merge branch 'no_sslv3_023' into maint-0.2.3

11 years agoDisable SSLv3 unconditionally. Closes ticket 13426.
Nick Mathewson [Wed, 15 Oct 2014 15:50:05 +0000 (11:50 -0400)] 
Disable SSLv3 unconditionally. Closes ticket 13426.

The POODLE attack doesn't affect Tor, but there's no reason to tempt
fate: SSLv3 isn't going to get any better.

11 years agoEmit fewer spurious lines in cov-diff output.
Nick Mathewson [Tue, 14 Oct 2014 13:41:40 +0000 (09:41 -0400)] 
Emit fewer spurious lines in cov-diff output.

11 years agoDefine a strnlen replacement on platforms (win32) that lack it
Nick Mathewson [Mon, 13 Oct 2014 18:59:17 +0000 (14:59 -0400)] 
Define a strnlen replacement on platforms (win32) that lack it

Right now this is only needed for test_util_format_time_interval, so
define it as a static function.  We can move it into compat later if
we need to.

11 years agoMerge remote-tracking branch 'public/bug11243_squashed'
Nick Mathewson [Mon, 13 Oct 2014 18:32:43 +0000 (14:32 -0400)] 
Merge remote-tracking branch 'public/bug11243_squashed'

11 years agoAdd comments to can_dl_again usage
Nick Mathewson [Mon, 13 Oct 2014 18:22:52 +0000 (14:22 -0400)] 
Add comments to can_dl_again usage

11 years agoNote that parse-list functions may add duplicate 'invalid' entries.
Nick Mathewson [Mon, 13 Oct 2014 18:15:56 +0000 (14:15 -0400)] 
Note that parse-list functions may add duplicate 'invalid' entries.

11 years agoBugfixes on bug11243 fix for the not-added cases and tests
Nick Mathewson [Mon, 13 Oct 2014 18:11:27 +0000 (14:11 -0400)] 
Bugfixes on bug11243 fix for the not-added cases and tests

 1. The test that adds things to the cache needs to set the clock back so
    that the descriptors it adds are valid.

 2. We split ROUTER_NOT_NEW into ROUTER_TOO_OLD, so that we can
    distinguish "already had it" from "rejected because of old published
    date".

 3. We make extrainfo_insert() return a was_router_added_t, and we
    make its caller use it correctly.  This is probably redundant with
    the extrainfo_is_bogus flag.

11 years agoUse symbolic constants for statuses in microdescs_add_to_cache.
Nick Mathewson [Mon, 13 Oct 2014 17:43:07 +0000 (13:43 -0400)] 
Use symbolic constants for statuses in microdescs_add_to_cache.

Suggested by Andrea in her review of 11243.

11 years agoCommit the script I used to generate signed ri and ei documents
Nick Mathewson [Tue, 7 Oct 2014 16:36:45 +0000 (12:36 -0400)] 
Commit the script I used to generate signed ri and ei documents

11 years agoDon't reset the download failure status of any object marked as impossible
Nick Mathewson [Tue, 7 Oct 2014 13:34:28 +0000 (09:34 -0400)] 
Don't reset the download failure status of any object marked as impossible

11 years agoUnit tests for 11243: loading ri, ei, mds from lists
Nick Mathewson [Tue, 7 Oct 2014 13:20:44 +0000 (09:20 -0400)] 
Unit tests for 11243: loading ri, ei, mds from lists

These tests make sure that entries are actually marked
undownloadable as appropriate.

11 years agoBase tests for 11243: test parsing for md, ei, and ri.
Nick Mathewson [Mon, 6 Oct 2014 13:06:04 +0000 (09:06 -0400)] 
Base tests for 11243: test parsing for md, ei, and ri.

We didn't really have test coverage for these parsing functions, so
I went and made some.  These tests also verify that the parsing
functions set the list of invalid digests correctly.

11 years agoTreat unparseable (micro)descriptors and extrainfos as undownloadable
Nick Mathewson [Fri, 3 Oct 2014 14:55:50 +0000 (10:55 -0400)] 
Treat unparseable (micro)descriptors and extrainfos as undownloadable

One pain point in evolving the Tor design and implementing has been
adding code that makes clients reject directory documents that they
previously would have accepted, if those descriptors actually exist.
When this happened, the clients would get the document, reject it,
and then decide to try downloading it again, ad infinitum.  This
problem becomes particularly obnoxious with authorities, since if
some authorities accept a descriptor that others don't, the ones
that don't accept it would go crazy trying to re-fetch it over and
over. (See for example ticket #9286.)

This patch tries to solve this problem by tracking, if a descriptor
isn't parseable, what its digest was, and whether it is invalid
because of some flaw that applies to the portion containing the
digest.  (This excludes RSA signature problems: RSA signatures
aren't included in the digest.  This means that a directory
authority can still put another directory authority into a loop by
mentioning a descriptor, and then serving that descriptor with an
invalid RSA signatures.  But that would also make the misbehaving
directory authority get DoSed by the server it's attacking, so it's
not much of an issue.)

We already have a mechanism to mark something undownloadable with
downloadstatus_mark_impossible(); we use that here for
microdescriptors, extrainfos, and router descriptors.

Unit tests to follow in another patch.

Closes ticket #11243.

11 years agoMerge remote-tracking branch 'isis/bug12951_r1'
Nick Mathewson [Mon, 13 Oct 2014 17:22:10 +0000 (13:22 -0400)] 
Merge remote-tracking branch 'isis/bug12951_r1'

11 years agoClean whitespace in last patch.
Nick Mathewson [Mon, 13 Oct 2014 17:20:07 +0000 (13:20 -0400)] 
Clean whitespace in last patch.

11 years agoAvoid overflow in format_time_interval, create unit tests
teor [Sun, 12 Oct 2014 09:50:10 +0000 (20:50 +1100)] 
Avoid overflow in format_time_interval, create unit tests

Fix an instance of integer overflow in format_time_interval() when
taking the absolute value of the supplied signed interval value.
Fixes bug 13393.

Create unit tests for format_time_interval().

11 years agoupdate pointer to faq entry
Roger Dingledine [Sat, 11 Oct 2014 00:16:32 +0000 (20:16 -0400)] 
update pointer to faq entry

11 years agoRemove is_router_version_good_for_possible_guard()
Nick Mathewson [Thu, 9 Oct 2014 19:12:36 +0000 (15:12 -0400)] 
Remove is_router_version_good_for_possible_guard()

The versions which this function would keep from getting the guard
flag are already blocked by the minimum version check.

Closes 13152.

11 years agoMerge remote-tracking branch 'public/bug10816'
Nick Mathewson [Thu, 9 Oct 2014 14:57:19 +0000 (10:57 -0400)] 
Merge remote-tracking branch 'public/bug10816'

11 years agoMerge remote-tracking branch 'teor/bug-13163-AlternateAuthorities-type-handling-fixed'
Nick Mathewson [Thu, 9 Oct 2014 14:55:09 +0000 (10:55 -0400)] 
Merge remote-tracking branch 'teor/bug-13163-AlternateAuthorities-type-handling-fixed'

11 years agoMerge remote-tracking branches 'teor/issue-13161-test-network' and 'teor/issue-13161...
Nick Mathewson [Wed, 8 Oct 2014 19:46:29 +0000 (15:46 -0400)] 
Merge remote-tracking branches 'teor/issue-13161-test-network' and 'teor/issue-13161-TestingDirAuthVoteExit'

11 years agoMerge remote-tracking branch 'teor/test-network-hang-on-make-j2'
Nick Mathewson [Wed, 8 Oct 2014 19:42:20 +0000 (15:42 -0400)] 
Merge remote-tracking branch 'teor/test-network-hang-on-make-j2'

11 years agoBitwise check BRIDGE_DIRINFO
teor [Wed, 1 Oct 2014 09:04:04 +0000 (19:04 +1000)] 
Bitwise check BRIDGE_DIRINFO

Bitwise check for the BRIDGE_DIRINFO flag, rather than checking for
equality.

Fixes a (potential) bug where directories offering BRIDGE_DIRINFO,
and some other flag (i.e. microdescriptors or extrainfo),
would be ignored when looking for bridge directories.

Final fix in series for bug 13163.

11 years agoImprove DIRINFO flags' usage comments
teor [Wed, 1 Oct 2014 08:54:26 +0000 (18:54 +1000)] 
Improve DIRINFO flags' usage comments

Document usage of the NO_DIRINFO and ALL_DIRINFO flags clearly in functions
which take them as arguments. Replace 0 with NO_DIRINFO in a function call
for clarity.

Seeks to prevent future issues like 13163.

11 years agoStop using default authorities with both Alternate Dir and Bridge Authority
teor [Wed, 1 Oct 2014 08:37:19 +0000 (18:37 +1000)] 
Stop using default authorities with both Alternate Dir and Bridge Authority

Stop using the default authorities in networks which provide both
AlternateDirAuthority and AlternateBridgeAuthority.

This bug occurred due to an ambiguity around the use of NO_DIRINFO.
(Does it mean "any" or "none"?)

Partially fixes bug 13163.

11 years agoExit test-network with status of chutney verify
teor [Sat, 4 Oct 2014 22:59:27 +0000 (09:59 +1100)] 
Exit test-network with status of chutney verify

Preserve previous semantics of src/test/test-network.sh by exiting with
the exit status of chutney verify, even though the latest version ends
with chutney stop.

11 years agofix some typos in the man page
Roger Dingledine [Sat, 4 Oct 2014 19:41:05 +0000 (15:41 -0400)] 
fix some typos in the man page

11 years agoStop an apparent test-network hang when used with make -j2
teor [Sat, 4 Oct 2014 03:18:56 +0000 (13:18 +1000)] 
Stop an apparent test-network hang when used with make -j2

If (GNU) Make 3.81 is running processes in parallel using -j2 (or more),
it waits until all descendent processes have exited before it returns to
the shell.

When a command like "make -j2 test-network" is run, this means that
test-network.sh apparently hangs until it either make is forcibly
terminated, or all the chutney-launched tor processes have exited.

A workaround is to use make without -j, or make -j1 if there is an
existing alias to "make -jn" in the shell.

We resolve this bug in tor by using "chutney stop" after "chutney verify"
in test-network.sh.

11 years agoMerge remote-tracking branch 'origin/maint-0.2.5'
Nick Mathewson [Fri, 3 Oct 2014 23:58:25 +0000 (19:58 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.5'

11 years agoMerge remote-tracking branch 'public/bug13325_024' into maint-0.2.5
Nick Mathewson [Fri, 3 Oct 2014 23:57:41 +0000 (19:57 -0400)] 
Merge remote-tracking branch 'public/bug13325_024' into maint-0.2.5

11 years agoRun correctly on OpenBSD systems without SSL_METHOD.get_cipher_by_char
Nick Mathewson [Fri, 3 Oct 2014 16:15:09 +0000 (12:15 -0400)] 
Run correctly on OpenBSD systems without SSL_METHOD.get_cipher_by_char

Also, make sure we will compile correctly on systems where they
finally rip it out.

Fixes issue #13325.  Caused by this openbsd commit:

   â€‹http://marc.info/?l=openbsd-cvs&m=140768179627976&w=2

Reported by Fredzupy.

11 years agoSend back SOCKS5 errors for all of the address related failures.
Yawning Angel [Wed, 1 Oct 2014 14:16:59 +0000 (14:16 +0000)] 
Send back SOCKS5 errors for all of the address related failures.

Cases that now send errors:
 * Malformed IP address (SOCKS5_GENERAL_ERROR)
 * CONNECT/RESOLVE request with IP, when SafeSocks is set
   (SOCKS5_NOT_ALLOWED)
 * RESOLVE_PTR request with FQDN (SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED)
 * Malformed FQDN (SOCKS5_GENERAL_ERROR)
 * Unknown address type (SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED)

Fixes bug 13314.

11 years agoAdd test-network delay option
teor [Wed, 1 Oct 2014 08:05:04 +0000 (18:05 +1000)] 
Add test-network delay option

Add a --delay option to test-network.sh, which configures the delay before
the chutney network tests for data transmission. The default remains at
18 seconds if the argument isn't specified.

Apparently we should be using bootstrap status for this (eventually).

Partially implements ticket 13161.

11 years agotest-network.sh: Use "/bin/echo -n" rather than builtin echo
teor [Wed, 1 Oct 2014 07:56:53 +0000 (17:56 +1000)] 
test-network.sh: Use "/bin/echo -n" rather than builtin echo

The default shell on OS X is bash, which has a builtin echo. When called
in "sh" mode, this echo does not accept "-n". This patch uses "/bin/echo -n"
instead.

Partially fixes issue 13161.

11 years agoAdd TestingDirAuthVoteExit option (like TestingDirAuthVoteGuard)
teor [Wed, 1 Oct 2014 07:44:21 +0000 (17:44 +1000)] 
Add TestingDirAuthVoteExit option (like TestingDirAuthVoteGuard)

Add the TestingDirAuthVoteExit option, a list of nodes to vote Exit for,
regardless of their uptime, bandwidth, or exit policy.

TestingTorNetwork must be set for this option to have any effect.

Works around an issue where authorities would take up to 35 minutes to
give nodes the Exit flag in a test network, despite short consensus
intervals. Partially implements ticket 13161.

11 years agoClear the cached address from resolve_my_address() when our IP changes
Nick Mathewson [Mon, 29 Sep 2014 17:46:30 +0000 (13:46 -0400)] 
Clear the cached address from resolve_my_address() when our IP changes

Closes 11582; patch from "ra".

11 years agocontinue our habit of specifying the default in the manpage
Roger Dingledine [Mon, 29 Sep 2014 17:33:50 +0000 (13:33 -0400)] 
continue our habit of specifying the default in the manpage

11 years agoMerge remote-tracking branch 'origin/maint-0.2.5'
Nick Mathewson [Mon, 29 Sep 2014 17:02:50 +0000 (13:02 -0400)] 
Merge remote-tracking branch 'origin/maint-0.2.5'

11 years agoMerge branch 'bug13295_v2_025' into maint-0.2.5
Nick Mathewson [Mon, 29 Sep 2014 17:02:35 +0000 (13:02 -0400)] 
Merge branch 'bug13295_v2_025' into maint-0.2.5

11 years agoDon't use the getaddrinfo sandbox cache from tor-resolve
Nick Mathewson [Mon, 29 Sep 2014 16:57:07 +0000 (12:57 -0400)] 
Don't use the getaddrinfo sandbox cache from tor-resolve

Fixes bug 13295; bugfix on 0.2.5.3-alpha.

The alternative here is to call crypto_global_init() from tor-resolve,
but let's avoid linking openssl into tor-resolve for as long as we
can.

11 years agoAutomake syntax error :/
Nick Mathewson [Mon, 29 Sep 2014 14:10:37 +0000 (10:10 -0400)] 
Automake syntax error :/

11 years agoAdd missing ed25519_ref10 headers to NOINST_HEADERS.
Nick Mathewson [Mon, 29 Sep 2014 14:10:08 +0000 (10:10 -0400)] 
Add missing ed25519_ref10 headers to NOINST_HEADERS.

11 years agoNote when 13290 was introduced.
Nick Mathewson [Mon, 29 Sep 2014 13:50:27 +0000 (09:50 -0400)] 
Note when 13290 was introduced.

11 years agoMerge remote-tracking branch 'teor/circuitstats-pareto-avoid-div-zero'
Nick Mathewson [Mon, 29 Sep 2014 13:48:02 +0000 (09:48 -0400)] 
Merge remote-tracking branch 'teor/circuitstats-pareto-avoid-div-zero'

11 years agoNote when 13291 was introduced.
Nick Mathewson [Mon, 29 Sep 2014 13:40:33 +0000 (09:40 -0400)] 
Note when 13291 was introduced.

11 years agoWhitespace fixes on 13291 fix
Nick Mathewson [Mon, 29 Sep 2014 13:39:21 +0000 (09:39 -0400)] 
Whitespace fixes on 13291 fix

11 years agoParenthesize macro arguments for 13291 fix
Nick Mathewson [Mon, 29 Sep 2014 13:38:50 +0000 (09:38 -0400)] 
Parenthesize macro arguments for 13291 fix

11 years agoStop spawn test failures due to a race condition with SIGCHLD on process exit
teor [Mon, 29 Sep 2014 11:50:17 +0000 (21:50 +1000)] 
Stop spawn test failures due to a race condition with SIGCHLD on process exit

When a spawned process forks, fails, then exits very quickly, (this
typically occurs when exec fails), there is a race condition between the
SIGCHLD handler updating the process_handle's fields, and checking the
process status in those fields. The update can occur before or after the
spawn tests check the process status.

We check whether the process is running or not running (rather than just
checking if it is running) to avoid this issue.

11 years agoMerge branch 'bug12971_take2_squashed'
Nick Mathewson [Mon, 29 Sep 2014 13:18:03 +0000 (09:18 -0400)] 
Merge branch 'bug12971_take2_squashed'

11 years agoRename socks5 error code setting function again
Nick Mathewson [Mon, 29 Sep 2014 13:17:20 +0000 (09:17 -0400)] 
Rename socks5 error code setting function again

I'd prefer not to use the name "send" for any function that doesn't
really send things.

11 years agoRespond with 'Command not supported' SOCKS5 reply message upon reception of unsupport...
rl1987 [Sun, 21 Sep 2014 16:17:44 +0000 (19:17 +0300)] 
Respond with 'Command not supported' SOCKS5 reply message upon reception of unsupported request.

11 years agoMerge branch 'ticket961_squashed'
Nick Mathewson [Mon, 29 Sep 2014 13:05:18 +0000 (09:05 -0400)] 
Merge branch 'ticket961_squashed'

11 years agoChanges file for ticket 961
Nick Mathewson [Tue, 23 Sep 2014 12:57:22 +0000 (08:57 -0400)] 
Changes file for ticket 961

11 years agoAvoid frequent strcmp() calls for AccountingRule
Nick Mathewson [Tue, 23 Sep 2014 12:46:35 +0000 (08:46 -0400)] 
Avoid frequent strcmp() calls for AccountingRule

Generally, we don't like to parse the same thing over and over; it's
best IMO to do it once at the start of the code.

11 years agoAdd an "AccountingRule" feature to permit limiting bw usage by read+write
Nick Mathewson [Tue, 23 Sep 2014 12:34:22 +0000 (08:34 -0400)] 
Add an "AccountingRule" feature to permit limiting bw usage by read+write

Patch from "chobe".  Closes ticket 961.

11 years agoMerge remote-tracking branch 'yawning/bug13213'
Nick Mathewson [Mon, 29 Sep 2014 12:57:19 +0000 (08:57 -0400)] 
Merge remote-tracking branch 'yawning/bug13213'

11 years agoMerge remote-tracking branch 'rl1987/bug13228'
Nick Mathewson [Mon, 29 Sep 2014 12:55:17 +0000 (08:55 -0400)] 
Merge remote-tracking branch 'rl1987/bug13228'

11 years agoWhitespace fixes
Nick Mathewson [Mon, 29 Sep 2014 12:48:22 +0000 (08:48 -0400)] 
Whitespace fixes

11 years agoAvoid division by zero in circuitstats pareto
teor [Mon, 29 Sep 2014 10:24:40 +0000 (20:24 +1000)] 
Avoid division by zero in circuitstats pareto

In circuit_build_times_calculate_timeout() in circuitstats.c, avoid dividing
by zero in the pareto calculations.

If either the alpha or p parameters are 0, we would divide by zero, yielding
an infinite result; which would be clamped to INT32_MAX anyway. So rather
than dividing by zero, we just skip the offending calculation(s), and
use INT32_MAX for the result.

Division by zero traps under clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error.

11 years agoStop test & bench build failures with --disable-curve25519
teor [Mon, 29 Sep 2014 02:06:15 +0000 (12:06 +1000)] 
Stop test & bench build failures with --disable-curve25519

Ensure test & bench code that references curve25519 is disabled by the
appropriate macros. tor now builds with and without --disable-curve25519.

11 years agoMerge branch 'bug13280'
Nick Mathewson [Mon, 29 Sep 2014 01:01:14 +0000 (21:01 -0400)] 
Merge branch 'bug13280'

11 years agoStop spurious clang shallow analysis null pointer errors
teor [Mon, 29 Sep 2014 00:08:37 +0000 (10:08 +1000)] 
Stop spurious clang shallow analysis null pointer errors

Avoid 4 null pointer errors under clang shallow analysis (the default when
building under Xcode) by using tor_assert() to prove that the pointers
aren't null. Resolves issue 13284 via minor code refactoring.

11 years agoStop ed25519 8-bit signed left shift overflowing
teor [Mon, 29 Sep 2014 00:44:00 +0000 (20:44 -0400)] 
Stop ed25519 8-bit signed left shift overflowing

Standardise usage in ge_scalarmult_base.c for 1 new fix.

11 years agoUse SHL{8,32,64} in ed25519/ref10 to avoid left-shifting negative values
Nick Mathewson [Mon, 29 Sep 2014 00:39:09 +0000 (20:39 -0400)] 
Use SHL{8,32,64} in ed25519/ref10 to avoid left-shifting negative values

This helps us avoid undefined behavior. It's based on a patch from teor,
except that I wrote a perl script to regenerate the patch:

  #!/usr/bin/perl -p -w -i

  BEGIN { %vartypes = (); }

  if (/^[{}]/) {
      %vartypes = ();
  }

  if (/^ *crypto_int(\d+) +([a-zA-Z_][_a-zA-Z0-9]*)/) {
      $vartypes{$2} = $1;
  } elsif (/^ *(?:signed +)char +([a-zA-Z_][_a-zA-Z0-9]*)/) {
      $vartypes{$1} = '8';
  }

  # This fixes at most one shift per line. But that's all the code does.
  if (/([a-zA-Z_][a-zA-Z_0-9]*) *<< *(\d+)/) {
      $v = $1;
      if (exists $vartypes{$v}) {
   s/$v *<< *(\d+)/SHL$vartypes{$v}($v,$1)/;
      }
  }

  # remove extra parenthesis
  s/\(SHL64\((.*)\)\)/SHL64\($1\)/;
  s/\(SHL32\((.*)\)\)/SHL32\($1\)/;
  s/\(SHL8\((.*)\)\)/SHL8\($1\)/;

11 years agoStop signed left shifts overflowing in ed25519: Macros
teor [Mon, 29 Sep 2014 00:34:21 +0000 (20:34 -0400)] 
Stop signed left shifts overflowing in ed25519: Macros

The macros let us use unsigned types for potentially overflowing left
shifts. Create SHL32() and SHL64() and SHL8() macros for convenience.

11 years agoImproving error message.
rl1987 [Sun, 28 Sep 2014 15:09:25 +0000 (18:09 +0300)] 
Improving error message.

11 years agoMerge remote-tracking branch 'public/require_some_c99'
Nick Mathewson [Fri, 26 Sep 2014 15:06:41 +0000 (11:06 -0400)] 
Merge remote-tracking branch 'public/require_some_c99'

11 years agoAvoid a "constant variable guards dead code" warning from coverity
Nick Mathewson [Fri, 26 Sep 2014 13:40:30 +0000 (09:40 -0400)] 
Avoid a "constant variable guards dead code" warning from coverity

Fixes CID 752028

11 years agoRegenerate pwbox.c with the latest trunnel
Nick Mathewson [Fri, 26 Sep 2014 13:33:24 +0000 (09:33 -0400)] 
Regenerate pwbox.c with the latest trunnel

This one should no longer generate dead-code warnings with coverity.
Fingers crossed?  This was CID 1241498

11 years agoComment-out dead code in ed25519/ref10
Nick Mathewson [Fri, 26 Sep 2014 13:07:44 +0000 (09:07 -0400)] 
Comment-out dead code in ed25519/ref10

There are some loops of the form

       for (i=1;i<1;++i) ...

And of course, if the loop index is initialized to 1, it will never
be less than 1, and the loop body will never be executed.  This
upsets coverity.

Patch fixes CID 1221543 and 1221542

11 years agoCheck key_len in secret_to_key_new()
Nick Mathewson [Fri, 26 Sep 2014 13:06:36 +0000 (09:06 -0400)] 
Check key_len in secret_to_key_new()

This bug shouldn't be reachable so long as secret_to_key_len and
secret_to_key_make_specifier stay in sync, but we might screw up
someday.

Found by coverity; this is CID 1241500

11 years agoFix a double-free in failing case of handle_control_authenticate.
Nick Mathewson [Thu, 18 Sep 2014 15:13:57 +0000 (11:13 -0400)] 
Fix a double-free in failing case of handle_control_authenticate.

Bugfix on ed8f020e205267e6270494634346ab68d830e1d8; bug not in any
released version of Tor.  Found by Coverity; this is CID 1239290.

[Yes, I used this commit message before, in 58e813d0fcfcecfc2017.
Turns out, that fix wasn't right, since I didn't look up a
screen. :P ]

11 years agoFix on that last fix.
Nick Mathewson [Thu, 25 Sep 2014 21:59:10 +0000 (17:59 -0400)] 
Fix on that last fix.

11 years agoFix warnings on 32-bit builds.
Nick Mathewson [Thu, 25 Sep 2014 21:50:13 +0000 (17:50 -0400)] 
Fix warnings on 32-bit builds.

When size_t is the most memory you can have, make sure that things
referring to real parts of memory are size_t, not uint64_t or off_t.

But not on any released Tor.

11 years agoMerge branch 'ed25519_ref10_squashed'
Nick Mathewson [Thu, 25 Sep 2014 19:11:34 +0000 (15:11 -0400)] 
Merge branch 'ed25519_ref10_squashed'

Conflicts:
src/common/include.am
src/ext/README

11 years agoComments and tweaks based on review by asn
Nick Mathewson [Thu, 25 Sep 2014 19:03:55 +0000 (15:03 -0400)] 
Comments and tweaks based on review by asn

Add some documentation

Rename "derive" -> "blind"

Check for failure on randombytes().

11 years agoAdd benchmarks for ed25519 functions
Nick Mathewson [Thu, 25 Sep 2014 14:13:25 +0000 (10:13 -0400)] 
Add benchmarks for ed25519 functions

11 years agoAdd comments to ed25519_vectors.inc
Nick Mathewson [Mon, 1 Sep 2014 00:01:53 +0000 (20:01 -0400)] 
Add comments to ed25519_vectors.inc

11 years agoCut the time to run the python ed25519 tests by a factor of ~6
Nick Mathewson [Sun, 31 Aug 2014 23:45:56 +0000 (19:45 -0400)] 
Cut the time to run the python ed25519 tests by a factor of ~6

I know it's pointless to optimize them, but I just can't let them
spend all that time in expmod() when native python pow() does the same
thing.

11 years agoAdd a reference implementation of our ed25519 modifications
Nick Mathewson [Sun, 31 Aug 2014 23:39:43 +0000 (19:39 -0400)] 
Add a reference implementation of our ed25519 modifications

Also, use it to generate test vectors, and add those test vectors
to test_crypto.c

This is based on ed25519.py from the ed25519 webpage; the kludgy hacks
are my own.

11 years agoAdd the pure-python ed25519 implementation, for testing.
Nick Mathewson [Sat, 30 Aug 2014 16:29:35 +0000 (12:29 -0400)] 
Add the pure-python ed25519 implementation, for testing.

11 years agoMore documentation for ed25519 stuff.
Nick Mathewson [Fri, 29 Aug 2014 13:24:27 +0000 (09:24 -0400)] 
More documentation for ed25519 stuff.

11 years agoFix linux compilation of ed25519_ref10
Nick Mathewson [Thu, 28 Aug 2014 00:12:57 +0000 (20:12 -0400)] 
Fix linux compilation of ed25519_ref10

Our integer-definition headers apparently suck in a definition for
select(2), which interferes with the select() in ge_scalarmult_base.c

11 years agoDraft implementation for ed25519 key blinding, as in prop224
Nick Mathewson [Wed, 27 Aug 2014 21:59:15 +0000 (17:59 -0400)] 
Draft implementation for ed25519 key blinding, as in prop224

This implementation allows somebody to add a blinding factor to a
secret key, and a corresponding blinding factor to the public key.

Robert Ransom came up with this idea, I believe.  Nick Hopper proved a
scheme like this secure.  The bugs are my own.