Commit Graph

2161 Commits

Author SHA1 Message Date
Nick Mathewson 30b3818a9e Make the native-tls crate optional.
This commit puts the native-tls crate behind a feature.  The feature
is off-by-default in the tor-rtcompat crate, but can be enabled
either from arti or arti-client.

There is an included script that I used to test that tor-rtcompat
could build and run its tests with all subsets of its features.

Closes #300
2022-01-26 14:06:58 -05:00
Nick Mathewson 8af3528cd3 Define aliases for "the best enabled runtime".
This helps us simplify our code in a few ways, and will help even
more once native_tls is optional.
2022-01-26 14:06:58 -05:00
Nick Mathewson 6f29d485e4 Make current/create functions into runtime member functions.
This should help avoid some amount of temptation towards API
proliferation.
2022-01-26 14:06:58 -05:00
Nick Mathewson 2333d0466e Rename FooRuntime to FooNativeTlsRuntime for consistency. 2022-01-26 14:06:58 -05:00
Nick Mathewson 05a04220cc Limit the inner types in tor-rtcompat that have to implement Clone
If we implement our own clone on CompoundRuntime, we no longer need
Clone implementations on our TlsProvider implementations.
2022-01-26 14:06:58 -05:00
Nick Mathewson 99c59a8f2b Remove no-longer-needed tokio runtime helper macro 2022-01-26 14:06:58 -05:00
Nick Mathewson 668364d75d Unify TokioRuntime and TokioRuntimeHandle
Having separate types here doesn't justify the (very limited)
benefit of distinguishing between the case where we have created an
executor that we own and the case where we have a handle to an
already-running tokio executor.

Part of #301.
2022-01-26 14:06:58 -05:00
Nick Mathewson 884d614a61 Remove a now-incorrect comment in tor-proto. 2022-01-26 14:06:58 -05:00
Nick Mathewson 5af8a1bf28 Remove misspellings of "rusttls". 2022-01-26 14:05:05 -05:00
Nick Mathewson e145f2b600 Merge branch 'rustls_v2' into 'main'
tor-rtcompat: Add support for a rustls backend

Closes #86

See merge request tpo/core/arti!260
2022-01-25 20:10:58 +00:00
Nick Mathewson e4e691a790 More comments on the limitations of tor-rtcompat's TLS API
Also, more comments on why these limitations are safe within the
context of Tor, but you wouldn't want to use them elsewhere.
2022-01-25 13:16:39 -05:00
Nick Mathewson 0898b485aa Comment-only: document sni_hostname more.
Previously we expected the reader to automatically know why it was
called "SNI", which really isn't fair.
2022-01-25 13:16:39 -05:00
Nick Mathewson d1d121aac6 Refactor native_tls usage into its own module
This change uses the async-native-tls crate for everything, and
deletes some duplicated code.
2022-01-25 13:16:39 -05:00
Nick Mathewson 8def5a0d89 tor-rtcompat: Add support for rustls.
This is based on @janimo's approach in !74, but diverges in a few
important ways.

1. It assumes that something like !251 will merge, so that we can
   have separate implementations for native_tls and rustls compiled
   at the same time.

2. It assumes that we can implement this for the futures::io traits
   only with no real penalty.

3. It uses the `x509-signature` crate to work around the pickiness of
   the `webpki` crate.  If webpki eventually solves their
   [bug 219](https://github.com/briansmith/webpki/issues/219), we
   can remove a lot of that workaround.

Closes #86.
2022-01-25 13:16:39 -05:00
Nick Mathewson 979cfb46d1 Add a C program to make Tor-style X509 link certificates
We should never use this for anything but making the testing
certificates we use for making sure our TLS implementation works.
2022-01-24 14:22:07 -05:00
eta b893f88c70 Merge branch 'ticket_277' into 'main'
More documentation about refining build process and getting help

Closes #277

See merge request tpo/core/arti!259
2022-01-24 14:15:00 +00:00
eta a83b8c4374 Merge branch 'error-plan' into 'main'
Error plan

See merge request tpo/core/arti!257
2022-01-24 14:11:11 +00:00
eta 146fbbaaa8 Merge branch 'ticket255' into 'main'
Refactor our Runtime implementations to allow replacement parts

Closes #255

See merge request tpo/core/arti!251
2022-01-24 14:09:51 +00:00
Ian Jackson ba591a813f Merge branch 'conn-prefs-rename' into 'main'
StreamPrefs: rename from ConnectPrefs

See merge request tpo/core/arti!256
2022-01-21 17:29:57 +00:00
Ian Jackson a79a2e87be Rename TorClient::set_stream_prefs
In line with the rest of the renaming.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/256#note_2771617
2022-01-21 17:12:08 +00:00
eta 87326afe75 Error plan: typos/fixes 2022-01-21 17:00:49 +00:00
Nick Mathewson c3f82ee14d README,CONTRIBUTING: More links.
Explain how to report bugs and how get accounts on the bugtracker;
add link to the troubleshooting document.

Part of #277
2022-01-21 10:59:14 -05:00
Nick Mathewson 33e70eec3d TROUBLESHOOTING.md: More information+links about build process.
Part of #277
2022-01-21 10:59:14 -05:00
Ian Jackson dcf26466f3 StreamPrefs: Re-alphabetise imports following rename
Placates rustfmt
2022-01-21 11:07:21 +00:00
Ian Jackson aa4d8de16e StreamPrefs: rename from ConnectPrefs
The docs even say this is about stream.

As @nickm writes in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771289

  we generally call end-to-end connections that are tunneled over Tor
  "Streams" to distinguish them from everything else in the Tor
  protocols that could possibly be called a "Connection".

That seems to apply here too.
2022-01-21 11:07:15 +00:00
Ian Jackson 695a33c1fd Merge branch 'always-isolate' into 'main'
Provide isolate-all-streams function

Closes #279

See merge request tpo/core/arti!252
2022-01-20 19:08:05 +00:00
Ian Jackson f0f296450a Errors: fold in people's views so is mostly unattributed now 2022-01-20 18:28:06 +00:00
Ian Jackson e762679a06 Errors: sort out markdown formatting 2022-01-20 18:27:52 +00:00
Ian Jackson 446d72329b Errors: c&p raw text of consensus conclusions from pad to git 2022-01-20 18:27:31 +00:00
Nick Mathewson c41216ce70 Merge branch 'docs-build' into 'main'
CONTRIBUTING: Document how to build the docs

See merge request tpo/core/arti!255
2022-01-20 18:10:24 +00:00
Ian Jackson 7bc8941742 isolation: Rename isolate_every_stream from ..._connection
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771291
2022-01-20 17:53:09 +00:00
Ian Jackson 23c1fc8c56 isolation: Rename (internal) EveryStream enum variant
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771289
2022-01-20 17:53:09 +00:00
Nick Mathewson 06c15f21b4 isolation: Much better wording for always isolate setting 2022-01-20 17:52:10 +00:00
Ian Jackson 1250fc68ce CONTRIBUTING: Document how to build the docs
Eventually we may need a separate HACKING.md
2022-01-20 17:36:37 +00:00
Nick Mathewson b2582b29c2 Merge branch 'pathconfig_fixing' into 'main'
Refactor, fix, test PathConfig type

See merge request tpo/core/arti!254
2022-01-20 15:16:51 +00:00
Nick Mathewson a58e4e3688 Test for PathConfig::at_least_as_permissive_as().
This is totally not just an exercise to get combined test coverage
for tor-circmgr over 90% because I needed something to do that
wouldn't distract anybody else. :)
2022-01-20 09:57:19 -05:00
Nick Mathewson a5288aa15f Rename PathConfig::more_permissive_than()
Since it implements a "<=" type relationship, it should be called
"at_least_as_permissive_as()."  Since it's a crate-private function,
the long name isn't too bad.
2022-01-20 09:55:54 -05:00
Nick Mathewson b0ea74aa60 Remove "self" arg from PathConfig::builder()
This was added by mistake.
2022-01-20 09:53:12 -05:00
Nick Mathewson a57b4962b3 Merge branch 'stuff-prefs' into 'main'
Provide TorClient::set_default_prefs and clone_with_prefs

Closes #290

See merge request tpo/core/arti!250
2022-01-20 14:36:41 +00:00
eta 6e94d5fd7b Merge branch 'coverage_toolchain' into 'main'
with_coverage: Allow toolchain selection.

See merge request tpo/core/arti!253
2022-01-20 14:31:55 +00:00
Nick Mathewson ef5dc3cb3e with_coverage: Allow toolchain selection.
There's some kind of bug in nightly that (for me) keeps grcov from
generating correct results. Instead, it misses some crates entirely.

No trouble, though: I can just use an older nightly until they get
this issue fixed!

This patch makes using a different version of nightly possible with
a new RUST_COVERAGE_TOOLCHAIN environment variable.
2022-01-20 09:01:36 -05:00
eta e55f8f8dad Merge branch 'msrv' into 'main'
Adopt an initial MSRV policy.

Closes #283

See merge request tpo/core/arti!247
2022-01-20 13:59:37 +00:00
Ian Jackson ced24b1974 connection preferences: Make `set_default_prefs` private for now 2022-01-20 13:52:30 +00:00
Ian Jackson e04e41a1db connection preferences: Make `clone_with_prefs` must_use
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/250#note_2771239
2022-01-20 13:50:12 +00:00
Ian Jackson 9e904167e4 isolation: Provide isolate-every-connection option 2022-01-20 12:08:22 +00:00
Ian Jackson a5356aed65 isolation: Provide new_isolation_group method
In the usual case, set_isolation_group is awkward.

This is perhaps slightly duplicative with TorClient::isolated_client().
If so then perhaps the *latter* should be abolished.
2022-01-20 12:08:22 +00:00
Ian Jackson 639db26d58 isolation: Refactor to introduce a bespoke enum
No functional change.

This will grow a new variant shortly.
2022-01-20 12:08:22 +00:00
Nick Mathewson 17920e43f8 Refactor Runtimes to use separate TLS implementations internally.
This will make it easier to implement them using some other TLS
provider as well, without having to duplicate all of our code.
2022-01-19 15:47:26 -05:00
Nick Mathewson 8d3e4576da Add a macro to help with opaque Runtime wrappers.
We're soon going to have our different Runtime types be built as
CompoundRuntime instances.  We don't want to expose that detail,
though, so we'll use this macro to make them implement the right
traits.
2022-01-19 15:47:26 -05:00
Nick Mathewson dd72607601 Add a CompoundRuntime type for runtime construction.
This type can solve two problems at once.

First, it lets users replace parts of an existing runtime
implementation without replacing the whole thing.  For example, you
can use it to override your TcpProvider implementation to solve
problems like #235.

Second, we can use it internally to tor-rtcompat to define Runtimes
piece-by-piece.  Mostly we'll use this to separate our Tls
implementations from our implementations of the rest of the Runtime.
2022-01-19 15:47:26 -05:00