cypherpunks
a56451af42
evloop: fix docs for threadpool_register_reply_event
...
Commit 6a5f62f68f
ultimately didn't
include the base argument, and the callback is named cb.
2018-10-17 20:27:19 +00:00
cypherpunks
f07ab5b95c
evloop: fix docs
...
alert_sockets_t was moved in 544ab27a94
.
2018-10-17 20:27:19 +00:00
Nick Mathewson
8b3ec74e5f
Merge remote-tracking branch 'public/bug27990'
2018-10-16 08:02:01 -04:00
Nick Mathewson
feed41bed3
Merge branch 'maint-0.3.4'
2018-10-15 12:47:46 -04:00
Nick Mathewson
23ce9a60fb
Merge branch 'maint-0.3.4'
2018-10-15 10:48:35 -04:00
Nick Mathewson
4983322cc7
Merge branch 'maint-0.3.4'
2018-10-15 10:37:53 -04:00
Nick Mathewson
2dccef0eb4
Merge branch 'bug27772_squashed'
2018-10-14 15:31:52 -04:00
Nick Mathewson
7c8f20ba44
In tor_tls_get_my_certs(), set cert ptrs even on failure
...
Nothing should ever look at them on failure, but in some cases,
the unit tests don't check for failure, and then GCC-LTO freaks out.
Fixes part of 27772.
2018-10-14 15:25:16 -04:00
Nick Mathewson
267b8d16b1
Add timeval.h include to compat_pthreads.c for timeradd()
...
OpenSolaris apparently doesn't have timeradd(), so we added a
replacement, but we weren't including it here after the big
refactoring in 0.3.5.1-alpha.
Fixes bug 27963; bugfix on 0.3.5.1-alpha.
2018-10-10 12:19:56 -04:00
Nick Mathewson
d3d6c59557
Add sys/time.h include back to procmon.c
2018-10-10 11:26:38 -04:00
Nick Mathewson
361eaa9931
Merge remote-tracking branch 'public/ticket27856'
2018-10-09 09:04:53 -04:00
Nick Mathewson
58299b2927
Merge remote-tracking branch 'public/bug27728'
2018-10-01 12:06:39 -05:00
Nick Mathewson
b058f64cc0
Detect an unlikely integer overflow.
2018-09-27 16:30:02 -04:00
Nick Mathewson
9e1a3be064
Prevent duplicate initialization of NSS DH module
...
Allowing this didn't do any actual harm, since there aren't any
shared structures or leakable objects here. Still, it's bad style
and might cause trouble in the future.
Closes ticket 27856.
2018-09-27 13:26:47 -04:00
Nick Mathewson
34402ece8c
geoip: fix windows compilation
2018-09-27 11:02:58 -04:00
Nick Mathewson
c8f2a6d2fe
Extract the non-stats part of geoip into a new src/lib/geoip.
2018-09-27 10:26:01 -04:00
Nick Mathewson
6c739c3fb2
Fix arm compilation with openssl <1.1
...
Bug 27781; bugfix on 0.3.5.1-alpha.
2018-09-24 11:11:29 -04:00
Nick Mathewson
4e2028152d
Fix an NSS socket leak-on-error found by dgoulet
2018-09-20 13:53:04 -04:00
Nick Mathewson
d6c564e09a
Use the correct macro to detect an invalid socket in tortls_nss.c
...
Fixes bug 27782; bugfix on 0.3.5.1-alpha
2018-09-20 12:55:31 -04:00
Nick Mathewson
62b709bc26
Release ownership of the dummy socket that tortls_nss.c will close
...
Related to #27795 -- since NSS will close the socket, we must not
count it as owned by Tor.
2018-09-20 12:53:39 -04:00
Nick Mathewson
1c1e84281d
Add a tor_release_socket_ownership() function.
2018-09-20 12:46:47 -04:00
Nick Mathewson
1f377e910f
Merge branch 'maint-0.3.4'
2018-09-20 10:43:08 -04:00
Nick Mathewson
7ace8d5a61
Assert that some trunnel _new() functions return non-NULL
...
The trunnel functions are written under the assumption that their
allocators can fail, so GCC LTO thinks they might return NULL. In
point of fact, they're using tor_malloc() and friends, which can't
fail, but GCC won't necessarily figure that out.
Fixes part of #27772 .
2018-09-18 14:43:57 -04:00
Nick Mathewson
ea5792f333
Make crypto_strongest_rand() non-mockable
...
Instead, have it call a mockable function. We don't want
crypto_strongest_rand() to be mockable, since doing so creates a
type error when we call it from ed25519-donna, which we do not build
in a test mode.
Fixes bug 27728; bugfix on 0.3.5.1-alpha
2018-09-18 12:40:18 -04:00
George Kadianakis
43324b0e4d
Fix minor memleak in edge-case of crypto_rsa.c function.
2018-09-18 14:01:15 +03:00
Nick Mathewson
f606b3cfd1
Lower the maximum size of a private key file to 16 MB
...
This shouldn't be a user-visible change: nobody has a 16 MB RSA
key that they're trying to use with Tor.
I'm doing this to fix CID 1439330 / ticket 27730, where coverity
complains (on 64-bit) that we are making a comparison that is never
true.
2018-09-17 11:08:56 -04:00
Nick Mathewson
991bec67ee
When Tor is compiled with NSS, don't claim support for LinkAuth=1
...
Closes ticket 27288
2018-09-16 13:28:29 -04:00
Nick Mathewson
035166e7bf
Add a missing function for windows
2018-09-14 15:02:11 -04:00
Nick Mathewson
af39649aad
Explicitly ignore BIO_set_close() return val to fix #27711
2018-09-14 13:09:10 -04:00
Nick Mathewson
79f8641ee5
Merge branch 'nss_countbytes_squashed'
2018-09-14 12:45:30 -04:00
Nick Mathewson
ac93c911ce
Allow malloc includes in tls library
2018-09-14 12:44:56 -04:00
Nick Mathewson
126819c947
Add support for lower-level byte counting with NSS
...
This is harder than with OpenSSL, since OpenSSL counts the bytes on
its own and NSS doesn't. To fix this, we need to define a new
PRFileDesc layer that has its own byte-counting support.
Closes ticket 27289.
2018-09-14 12:44:56 -04:00
Nick Mathewson
0e4fcd3996
Merge branch 'nss_27664'
2018-09-14 10:24:46 -04:00
Nick Mathewson
e43ae24e7d
Merge branch 'nss_27451'
2018-09-14 10:22:38 -04:00
Nick Mathewson
d8280216c0
Include torint.h in socketpair.c for intptr_t definition.
2018-09-13 17:54:26 -04:00
Nick Mathewson
92357a07bd
Fix a 32-bit off_t/size_t warning in crypto_rsa.c
...
Bug not in any released Tor.
2018-09-13 17:49:39 -04:00
Nick Mathewson
2d05500a1e
Merge remote-tracking branch 'UntoSten/inform-about-conf-includes'
2018-09-13 13:35:59 -04:00
Nick Mathewson
75d6609eb1
Run crypto_prefork() before start_daemon().
...
Without this, RunAsDaemon breaks NSS.
Fixes bug 27664; bug not in any released Tor.
2018-09-13 08:58:28 -04:00
Nick Mathewson
b4f20ec8a6
Merge remote-tracking branch 'tor-github/pr/280'
2018-09-12 16:13:23 -04:00
Nick Mathewson
ae5692994f
Add a tor_tls_release_socket() function.
...
This function tells the underlying TLS object that it shouldn't
close the fd on exit. Mostly, we hope not to have to use it, since
the NSS implementation is kludgey, but it should allow us to fix
2018-09-12 11:12:05 -04:00
Nick Mathewson
19dbc385d5
Merge remote-tracking branch 'tor-github/pr/298'
2018-09-12 09:38:52 -04:00
Nick Mathewson
8294c40c96
Merge remote-tracking branch 'tor-github/pr/318'
2018-09-12 08:12:19 -04:00
Nick Mathewson
a52d5d5309
Refactor initialization in curve25519_basepoint_spot_check
...
This is an attempt to work around what I think may be a bug in
OSS-Fuzz, which thinks that uninitialized data might be passed to
the curve25519 functions.
2018-09-09 10:21:13 -04:00
Nick Mathewson
9ca1af9a87
Merge remote-tracking branch 'dgoulet/ticket20700_035_03'
2018-09-07 15:03:32 -04:00
Suphanat Chunhapanya
10f4c46e50
test: Build an HSv3 descriptor with authorized client
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07 13:59:22 -04:00
Nick Mathewson
13d0855a89
Merge remote-tracking branch 'teor/bug27521'
2018-09-07 10:29:45 -04:00
Nick Mathewson
ee6d8bcf71
Merge branch 'maint-0.3.4'
2018-09-07 09:15:56 -04:00
teor
3b6d1676ec
Comment: Fix typos in get_interface_addresses_win32()
...
Closes 27521.
2018-09-07 11:32:57 +10:00
Nick Mathewson
22e2403145
Revert "Avoid double-close on TCP sockets under NSS."
...
This reverts commit b5fddbd241
.
The commit here was supposed to be a solution for #27451 (fd
management with NSS), but instead it caused an assertion failure.
Fixes bug 27500; but not in any released Tor.
2018-09-06 11:06:30 -04:00
Nick Mathewson
bcfab63ca5
Merge remote-tracking branch 'teor/ticket27467'
2018-09-06 09:24:47 -04:00
teor
d0965561a5
Remove GetAdaptersAddresses_fn_t
...
The code that used it was removed as part of the 26481 refactor.
Closes ticket 27467.
2018-09-06 12:54:03 +10:00
Nick Mathewson
b8a2bdbdc8
Backport to older NSS, which does not have SEC_DerSignDataWithAlgorithmID
2018-09-05 16:49:15 -04:00
Nick Mathewson
5656144290
Fix checkspaces
2018-09-05 16:48:53 -04:00
Nick Mathewson
710aa122e4
Suppress strict-prototypes warnings in one more batch of NSS headers
2018-09-05 16:36:18 -04:00
Nick Mathewson
8cd091a8d3
Add a last-ditch memwipe() implementation for nss+old glibc
...
On new glibc versions, there's an explicit_bzero(). With openssl,
there's openssl_memwipe().
When no other approach works, use memwipe() and a memory barrier.
2018-09-05 16:34:01 -04:00
Nick Mathewson
824160fd82
Fix a type, and hopefully the win64 builds.
2018-09-05 09:36:15 -04:00
Nick Mathewson
dc7c979453
Add note about use of tor_memcmp()
2018-09-05 09:11:53 -04:00
Nick Mathewson
79a7fbb79b
Fix a reverse-inull warning from coverity in new code.
2018-09-05 08:34:14 -04:00
Nick Mathewson
03efb67b42
Debug one last reference-counting issue that only appeared on openssl master
2018-09-04 20:46:46 -04:00
Nick Mathewson
0db5c54957
Merge branch 'nss_squashed' into nss_merge
2018-09-04 20:21:07 -04:00
Nick Mathewson
d644c93ae9
Resolve openssl-only memory leaks
2018-09-04 19:45:28 -04:00
Nick Mathewson
c50537fd94
Fix a pair of remaining leaks in tortls_nss.c
...
Fun fact: PR_Close leaks memory if its socket is not valid.
2018-09-04 19:45:21 -04:00
Nick Mathewson
274efb1263
Use FREE_AND_NULL for impl types
2018-09-04 14:52:35 -04:00
Nick Mathewson
ad94d43fc5
Port test_tortls_verify to not depend on openssl internals
2018-09-04 14:52:35 -04:00
Nick Mathewson
59c1b34b72
Remove tor_tls_check_lifetime as unused.
...
Everything that might have used it, uses tor_tls_cert_is_valid() instead.
2018-09-04 14:52:35 -04:00
Nick Mathewson
7acb8c8d18
Document winsock includes better
2018-09-04 14:52:35 -04:00
Nick Mathewson
70c27b7e39
Fix documentation of initialized fields in crypto_init.c
2018-09-04 14:52:35 -04:00
Nick Mathewson
edbb5ef5b2
Make some additional RSA functions const
2018-09-04 14:52:35 -04:00
Nick Mathewson
600e046ed3
Rename crypto_pk_check_key(), use it more reasonably, add tests
...
This function was a wrapper around RSA_check_key() in openssl, which
checks for invalid RSA private keys (like those where p or q are
composite, or where d is not the inverse of e, or where n != p*q).
We don't need a function like this in NSS, since unlike OpenSSL, NSS
won't let you import a bogus private key.
I've renamed the function and changed its return type to make it
more reasonable, and added a unit test for trying to read a key
where n != p*q.
2018-09-04 14:52:35 -04:00
Nick Mathewson
3b5d6ef15b
Unify functions for reading/writing PEM keys, to avoid duplication.
2018-09-04 14:52:35 -04:00
Nick Mathewson
f46a7eafb8
Do not leak a reference to "slot" when decoding private key.
2018-09-04 14:52:35 -04:00
Nick Mathewson
36f3bdac03
Update prefork and postfork NSS code for unit tests.
2018-09-04 14:52:35 -04:00
Nick Mathewson
52ac539b99
Test a few more tortls.c functions
2018-09-04 14:52:35 -04:00
Nick Mathewson
7163389b55
Several unit tests to improve test coverage of x509*.c
2018-09-04 14:52:35 -04:00
Nick Mathewson
02086a216f
Remove tor_x509_get_cert_impl as unneeded.
2018-09-04 14:52:35 -04:00
Nick Mathewson
b5fddbd241
Avoid double-close on TCP sockets under NSS.
2018-09-04 14:52:35 -04:00
Nick Mathewson
52d5f4da12
Avoid spurious error logs when using NSS
...
The tls_log_errors() function now behaves differently for NSS than
it did for OpenSSL, so we need to tweak it a bit.
2018-09-04 14:52:35 -04:00
Nick Mathewson
dd04fc35c6
Remove tor_tls_shutdown()
...
This function was supposed to implement a half-duplex mode for our
TLS connections. However, nothing in Tor actually uses it (besides
some unit tests), and the implementation looks really questionable
to me. It's probably best to remove it. We can add a tested one
later if we need one in the future.
2018-09-04 14:52:35 -04:00
Nick Mathewson
5205c7fd90
Initial NSS support for TLS.
...
This is enough to get a chutney network to bootstrap, though a bunch
of work remains.
2018-09-04 14:52:35 -04:00
Nick Mathewson
3507fead10
Merge branch 'tor_api_owning_control'
2018-09-04 11:04:21 -04:00
cypherpunks
d32b08af6f
string: add string_is_utf8() helper
...
Ticket #27373 .
2018-09-03 13:54:43 +00:00
rl1987
01eb164574
Reject addresses with needless trailing colon
2018-08-31 19:34:14 +03:00
rl1987
23ed863da4
Improve bracket handling in tor_addr_parse()
...
* Actually check for second bracket
* Only attempt parsing IPv4 address when no brackets found
2018-08-31 18:55:36 +03:00
Mike Perry
93ff8b411a
Merge branch 'ticket25573-034' into ticket25573-master
2018-08-29 17:10:06 +00:00
Nick Mathewson
219f6ea516
Fix log.c comments about assert vs tor_assert vs raw_assert.
2018-08-28 15:58:16 -04:00
Nick Mathewson
c567b8fcb4
NSS support for x509 certs
...
7 unit tests are failing at this point, but they're all TLS-related.
2018-08-22 16:11:45 -04:00
Nick Mathewson
7c5339677f
Log error strings in crypto_nss_log_errors().
...
I'll need this for debugging.
2018-08-22 12:36:25 -04:00
Nick Mathewson
de66bd397c
Merge branch 'maint-0.3.4'
2018-08-21 19:20:37 -04:00
Nick Mathewson
5245a296c5
Make some x509 functions generic; remove some fields NSS doesn't need
2018-08-21 12:25:33 -04:00
Nick Mathewson
b9ca8f2356
Extract internal-only parts of x509.h
2018-08-21 12:25:33 -04:00
Nick Mathewson
108d9879eb
Extract the non-generic part of tor_tls_context_decref().
2018-08-21 12:25:33 -04:00
Nick Mathewson
96f8e19802
Implement PBKDF2 with NSS.
...
This was a gap that we left in the last commit.
2018-08-21 12:25:33 -04:00
Nick Mathewson
6a88d8f6b4
When enabling NSS, disable OpenSSL.
...
We used to link both libraries at once, but now that I'm working on
TLS, there's nothing left to keep OpenSSL around for when NSS is
enabled.
Note that this patch causes a couple of places that still assumed
OpenSSL to be disabled when NSS is enabled
- tor-gencert
- pbkdf2
2018-08-21 12:25:33 -04:00
Nick Mathewson
1992c76130
Split tls modules and their tests into openssl and generic.
...
Also, add a stubbed-out nss version of the modules. The tests won't
pass with NSS yet since the NSS modules don't do anything.
This is a good patch to read with --color-moved.
2018-08-21 12:25:33 -04:00
Nick Mathewson
91c1e88b7a
Refactor some of the certificate-manipulation logic
2018-08-21 12:25:33 -04:00
Nick Mathewson
598bc78bfa
Extract tortls structures into a new header; clean up a little
2018-08-21 12:25:33 -04:00
Nick Mathewson
9a4f05b05c
Split X509 code out of tortls.c
2018-08-21 12:25:33 -04:00
Nick Mathewson
aa45511250
Implement RSA for NSS.
2018-08-21 12:24:08 -04:00
Nick Mathewson
b94e7de7db
Refactor crypto_rsa to use pem module.
...
This cleans up a lot of junk from crypto_rsa_openssl, and will
save us duplicated code in crypto_rsa_nss (when it exists).
(Actually, it already exists, but I am going to use git rebase so
that this commit precedes the creation of crypto_rsa_nss.)
2018-08-21 12:24:08 -04:00
Nick Mathewson
9566ed6fd9
Add rudimentary support for PEM-encoding, since NSS doesn't do that.
2018-08-21 12:24:08 -04:00