Commit Graph

690 Commits

Author SHA1 Message Date
Ian Jackson 1cdfd4f109 Update to shellexpand 3.1.0 so we can use dirs 5 everywhere
Results of precisely
  cargo update -p shellexpand

Incorporates changes I have made to shellexpand to allow use of
dirs 4 *or* dirs 5.
2023-03-24 13:18:11 +00:00
Nick Mathewson 3459d39906 Update required openssl version
cargo-audit is complaining about 0.10.45.
2023-03-24 08:02:59 -04:00
Alexander Færøy 6fae5cc7e9 Merge branch 'upgrade_dirs' into 'main'
Bump to the lastest versions of dirs and directories.

See merge request tpo/core/arti!1072
2023-03-23 16:00:50 +00:00
Ian Jackson 3d33ad7fdf arti-client: Create an HsClientConnector 2023-03-23 11:50:18 +00:00
Nick Mathewson 19cdb239bf Bump to the lastest versions of dirs and directories. 2023-03-22 15:15:42 -04:00
Nick Mathewson 35967ca38d circmgr: Declare builder() unconditionally.
(Still, only expose it when experimental-api is enabled.)
2023-03-22 12:35:41 -04:00
Nick Mathewson d6bb8fee0b Upgrade to bitflags 2.0
This version of bitflags now requires us to explicitly list the
traits that we want to derive for our bit-flags structs.
2023-03-13 08:47:14 -04:00
Ian Jackson c198a26bf7 arti-client: Parse .onion addresses and dispatch to client.rs
Now, a Host has a separate variant for `.onion` which is always used,
even when HS is disabled.

Currently it ends in a todo!.
2023-03-09 13:41:12 +00:00
Nick Mathewson bc83d1e1de tor-proto: Implement functionality to send a message and accept replies
This new function combines "sending a message" and "accepting
replies in a stream" into a single call, so that there is no gap
between when the message is sent and the replies are available.

There are a number of compromises here, in order to avoid API
proliferation. I've tried to contain them as best I can.

See comments for additional design discussion.
2023-03-08 14:21:33 -05:00
Ian Jackson 7081b73c92 Impl Redactable for HsId 2023-03-07 19:03:28 +00:00
Ian Jackson 641e99af98 impl Display for HsId 2023-03-07 16:32:27 +00:00
Ian Jackson b6fc44aa71 hsclient state: Split off MultikeyIsolatedMap 2023-03-01 16:39:03 +00:00
Ian Jackson 1f03e118ef hsclient state: Restructure using a scope to drop the mutex guard
Explicit drops don't work.  Instead, introduce a scope.

We need two scopes, actually: one where we do the initial table
wrangling, and one for the retries after relock.

So we must put the meat in a closure so we can reuse it.
And we must return the flow control as an enum.  Bah, etc.

Avoid reformatting this for the moment.  This makes the delta legible...
2023-03-01 16:39:03 +00:00
Ian Jackson ab163cf81a hsclient state: Test most important code paths 2023-03-01 16:27:19 +00:00
Ian Jackson d384c3b475 hsclient state: Provide one test 2023-03-01 16:27:17 +00:00
Ian Jackson d7602c5be4 hsclient: Use a generic to provide a mock for connect()
This will allow us to test state.rs.
2023-03-01 16:20:16 +00:00
Ian Jackson feab6faa9e tor-circmgr: Provide testing feature and TestConfig
Like the similar thing in tor-guardmgr.
2023-03-01 16:20:16 +00:00
Ian Jackson e8b5195281 hsclient: Implement connection attempt tracking state machine
This compiles, but it cannot work yet.  Nor can it conveniently be tested.
2023-03-01 16:20:16 +00:00
Ian Jackson 4ec9ec92bc HS secret keys: Move aggregate/config to tor-hsclient
Provide a more cookied "secret keys for use to connecting to a
particular HS" type, with a builder.

This wants to use config stuff, so oughtn't to be in tor-*crypto.
The individual types remain there.
2023-03-01 16:19:31 +00:00
Nick Mathewson d69ed3bc62 hscrypto: Make several types Readable+Writeable
Specifically, RendCookie, Subcredential, HsId, and HsBlindId.
2023-02-28 11:08:31 -05:00
Nick Mathewson 2c9f8e3547 Follow-on patchlevel bumps for crates with changed dependencies
These crates didn't have any changes until now, when I bumped
the versions of some other crates they depend on:

tor-consdiff
arti-hyper
arti-bench
arti-testing
2023-02-28 07:18:37 -05:00
Nick Mathewson f41449d0bd Patchlevel bumps for remaining changed crates.
These crates have had small code changes, but no API additions:

tor-config
tor-socksproto
tor-cert
tor-chanmgr
tor-ptmgr
tor-guardmgr
tor-circmgr
tor-dirclient
tor-dirmgr
arti
tor-hsservice
tor-congestion

These crates have had API extensions:

fs-mistrust
tor-llcrypto
tor-bytes
tor-checkable
tor-linkspec
tor-netdoc
tor-persist
arti-client
2023-02-28 07:13:27 -05:00
Nick Mathewson 3e1ae65212 Bump tor-units version for breaking change.
(The breaking change was removing `as_days()` from IntegerMinutes.)

We are _not_ calling this a downstream-api breaking change, per
discussion at
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012?commit_id=bb2ab7c2a3e0994bb438188511688b5b039cae29#note_2876819
2023-02-28 07:10:00 -05:00
Nick Mathewson 4479d52a88 Bump patch-versions for breaking changes in tor-hs{crypto,client}
These are API breaks, but the crates themselves are currently
100% experimental, so there's no need to bump the minor versions
according to our semver rules.
2023-02-28 07:06:15 -05:00
Nick Mathewson 3e257a7cb5 Bump minor versions for significant breaking changes.
This includes tor-cell, tor-proto, and tor-netdir.
2023-02-28 07:05:15 -05:00
Nick Mathewson 5769cdd9be Run cargo update in preparation for Wednesday Release 2023-02-27 07:47:11 -05:00
Nick Mathewson a300bed405 Run "cargo update" in preparation for the release in 2 weeks. 2023-02-17 14:22:57 -05:00
Nick Mathewson 0f2218f4d3 Merge branch 'ticket_525_part3_take2' into 'main'
Finish #525 for relay messages: Only parse messages at the last instant.

Closes #773 and #525

See merge request tpo/core/arti!1017
2023-02-15 16:35:27 +00:00
Nick Mathewson ca3b33a1af tor-cell: Refactor relay cells to copy much less
We now manipulate raw relay cell bodies as (an alias for)
`Box<[u8;509]>` rather than as (an alias for) `[u8;509]`.  This
enables us to do much less copying.  It will become more important
soon, as we defer parsing relay cell bodies even longer.

Related to #7.

We also use SliceWriter to avoid allocating a Vec<> for every relay
message we want to encode, and instead encode directly into the
cell.
2023-02-15 10:48:19 -05:00
Nick Mathewson f1ec64bfe5 Upgrade to latest toml crate.
(None of the breaking changes affect us this time.)
2023-02-14 11:06:00 -05:00
Nick Mathewson 696b9bd2d5 Merge branch 'ticket_525_part2' into 'main'
Apply restricted_msg to ChanMsg parts of tor-proto

See merge request tpo/core/arti!1013
2023-02-09 18:06:39 +00:00
Nick Mathewson 16b9d23a7c tor-cell: Make RelayEarly a separate type.
This allows us to remove a shenanigan from `restricted_msg!{}`.
2023-02-09 10:20:28 -05:00
Ian Jackson fe1113bd6b hsdir representation: Introduce HsDirs generic type
This already allows us to get rid of some duplication, and will be
useful more widely in a moment.
2023-02-09 13:01:37 +00:00
Ian Jackson 4626ccfcaa hs time handling: Make TimePeriod contain length as IntegerMinutes
Locally, the only functional effect is that now we refuse to handle
non-whole-number-of-minutes lengths - but since the consensus
parameter can't represent those, there's no overall functional change.
2023-02-09 12:56:18 +00:00
Nick Mathewson 0a80c468df hsdesc: Use an IntegerMinutes<u16> to hold lifetime. 2023-02-08 13:33:07 -05:00
Nick Mathewson f5f8402d50 tor-cell: Macro to generate restricted RelayMsg and ChanMsg.
This is the main implementation part of #525.
2023-02-07 16:03:14 -05:00
Nick Mathewson 698b997228 Bump openssl-src to 1.1.1t. 2023-02-07 15:16:44 -05:00
Nick Mathewson 23757d90c1 netdoc: Parse the inner layer of an onion service descriptor.
There are some places where I note certificates which are not
currently validated, because there is no cryptographic point in
doing so.  We should either document that this is okay, or validate
the certificates anyway.

This code might benefit from refactoring to make it prettier.
2023-02-07 09:02:15 -05:00
Nick Mathewson 02fa682bc0 netdoc: implement onion service descryptor encryption
This is tested via a round-trip check, and via a successful
decryption of our example descriptor's outer layer.
2023-02-07 09:02:13 -05:00
Ian Jackson 2dbffa1208 tor-netdir: Use typed-index-collections for router status index 2023-02-01 19:40:17 +00:00
Nick Mathewson a2b1f20216 Bump minor version of tor-cell.
In !948 we renamed a couple of accessor functions, which is a
breaking change in `tor-cell`'s API.

In retrospect, perhaps we should have deprecated the old names and
added the new ones, so we wouldn't have to break the API.  (This is
the only API break AFAICT since 1.1.0.)
2023-02-01 10:42:58 -05:00
Nick Mathewson 7c1b6a5a81 Bump the patch version of every crate that had API additions
These crates had API or behavior changes that may affect downstream
crates. Fortunately, they're all version 0.x, and don't need minor
bumps for this.
2023-02-01 10:36:29 -05:00
Nick Mathewson 66f594a4b6 Bump the patch-level version of crates with _minor_ changes.
These changes influence behavior, but not effect compatibility.
(If I messed up, and any crate except for `arti` has non-breaking
API changes, that's still fine, since they are all version
0.x.)
2023-02-01 10:23:58 -05:00
Nick Mathewson 592d6bf8a3 Bump the patch version of each crate with _trivial_ changes.
These crates have not had changes to their behavior; as such it is
not necessary to bump their dependencies to require the new versions.
2023-02-01 10:10:36 -05:00
Nick Mathewson 970cc6cb29 Run cargo update in preparation for release tomorrow 2023-01-31 15:37:48 -05:00
Nick Mathewson 4e7a552171 netdir: remove the vestigial smallvec implementation I added
It's cute, but I don't think it will help performance, and I'm
undecided about whether the semantic implications are true.
2023-01-28 12:43:08 -05:00
Nick Mathewson 5236c5cf88 netdir: Implement ring-param constructors and time period accessors
This logic is a bit tricky, so I've tried to document it and add
fairly good tests.  The silver lining is that the external API for
all of this logic will make it invisible and hidden.

There are some cases where I added functions that I think might
eventually get lowered into MdConsensus: But I don't want to lower
too much right now, since the convention for our netdoc accessors is
that they are fairly unsophisticated, and they show you the document
as it is.

Closes #686
2023-01-28 12:43:08 -05:00
Ian Jackson f2e254e63d Merge branch 'toml_0.6' into 'main'
Upgrade toml to version 0.6.

See merge request tpo/core/arti!989
2023-01-26 17:34:52 +00:00
Nick Mathewson f9903789d1 Upgrade toml to version 0.6.
This required rewriting some of our error handling code in
command-line processing, since the toml crate now displays and
reports errors differently.  (Admittedly, this code still is kind of
ugly, but at least it is nicely hidden.)
2023-01-25 16:29:53 -05:00
Nick Mathewson 386de7587e hscrypto: Use derive_more, and derive Deref for public keys. 2023-01-25 13:48:40 -05:00
Nick Mathewson f192429442 hscrypto: Implement key blinding.
This implementation was made based on the specification, and then
validated against itself, and against C Tor.
2023-01-24 13:40:59 -05:00
Nick Mathewson 3dfeb5b144 hscrypto: Add an implementation for TimePeriod
This required some API tweaks, which is probably to be expected;
these time periods are a wonky kind of thing.
2023-01-24 13:33:48 -05:00
Nick Mathewson 0a52d90af3 hscrypto: Implement hs_mac. 2023-01-24 13:33:48 -05:00
Nick Mathewson 7e4ad381a8 hscrypto: Add and use a macro to define all PK types. 2023-01-24 13:33:46 -05:00
Nick Mathewson a210686c80 Sketch an API for onion services. 2023-01-24 12:32:21 -05:00
Nick Mathewson 32ae6dfa09 Add a new stub hsclient module to connect to onion services. 2023-01-24 12:32:21 -05:00
Nick Mathewson 190f24e66d CircMgr: Draft APIs used to implement onion service clients. 2023-01-24 12:32:21 -05:00
Nick Mathewson 131775bf36 Upgrade to latest rsa crate. 2023-01-20 08:06:30 -05:00
Nick Mathewson 02a1f9a3e4 Upgrade to latest async-broadcast
(We don't yet use the code that uses it, but we might as well have
our unused code be up-to-date.)
2023-01-20 08:06:30 -05:00
Nick Mathewson 707efc944d upgrade to latest serial_test 2023-01-20 08:06:30 -05:00
Nick Mathewson 889206cde4 Complete our migration to base64ct.
This is in lieu of upgrading to the latest base64 crate, which has
a different API from the old one.  Since we have to migrate either
way, we might as well use base64ct everywhere.

I don't think that most of these cases _require_ constant-time
base64, but it won't hurt.
2023-01-20 08:06:30 -05:00
Nick Mathewson 6cb0528cc1 Upgrade to latest rlimit crate. 2023-01-19 14:10:54 -05:00
eta 065ae24fc6 Merge branch 'onion-api-client-toplevel' into 'main'
Make a top-level API for connecting to onion services.

See merge request tpo/core/arti!971
2023-01-17 11:18:06 +00:00
Nick Mathewson ac3f04fcf5 Bump Cargo.lock to ed25519 1.5.3 to fix CI.
ed25519 1.5.2 has been yanked.
2023-01-16 11:39:35 -05:00
Nick Mathewson 56cb2d2a10 Make a top-level API for connecting to onion services.
Fortunately, it adds very little to the arti-client API surface.
2023-01-12 09:28:58 -05:00
Nick Mathewson f24f8d295c Sketch APIs for the onion service directory ring.
These are a bit complex internally, but the API they present is
pretty simple.  I've left some discussion of points where the design
isn't totally fleshed out, and where we need to look harder at the
spec.

Part of #716.
2023-01-11 09:04:13 -05:00
Nick Mathewson 78a89c0057 Upgrade to latest tokio, for security fix.
On 1.22, cargo audit is complaining about RUSTSEC-2023-0001.

We aren't affected, since we don't use windows named pipes (yet),
but let's make cargo audit happier.
2023-01-09 12:58:04 -05:00
eta 371bcdc554 Merge branch 'arti-hyper-fixing-715' into 'main'
Temporary fix for #715 and #569

Closes #715

See merge request tpo/core/arti!958
2023-01-09 14:43:37 +00:00
Nick Mathewson 8472acf3ac Merge branch 'onion-api-v0.2' into 'main'
Onion service APIs, part 1.

See merge request tpo/core/arti!959
2023-01-06 18:32:36 +00:00
Nick Mathewson 91d9ffe0b6 Sketch out new required APIs in tor-cell 2023-01-06 13:03:50 -05:00
Nick Mathewson eba937e54c netdoc: Outline some basic types for encoding HsDescs. 2023-01-06 13:03:50 -05:00
Nick Mathewson 0203634ec5 Create a new tor-hscrypto crate.
This module has types and operations needed in multiple places
for an onion service implementation.  There are a bunch of
TODO hs-crypto comments that we'll need to fill in.
2023-01-06 13:03:50 -05:00
Michael van Straten b3d458280d Updated Cargo.lock 2023-01-06 18:35:32 +01:00
Ian Jackson 8c925499f8 tor-proto: When relay IDs mismatch, the IDs are sensitive in errors 2023-01-06 17:26:54 +00:00
Neel Chauhan 11958c9241 Use parse_rfc3339() in the tor-rtmock crate 2022-12-16 13:07:49 -08:00
coral 25f113b8b3 Tackling issue #663 (Use humantime in tests) 2022-12-12 17:41:22 +00:00
Ian Jackson ba338bdf37 tor-config: Update to shellexpand 3.x
This is the new upstream version (published by me, recently).
It has the same MSRV and one breaking change:

The caller who specifies a home dir function for substituting into
strings, must now supply a string, not Path.  Previously shellexpand
would allow the caller to supply non-unicode data, and then simply not
substitute it.  That was an infelicity in the shellexpand API.

Now this infelicity is pushed into our code.  The overall behaviour of
Arti hasn't changed as a result.  And it seems reasonable to me.

shellexpand 3.x also has a module for expanding Paths instead, in
response to requests for this filed as upstream tickets.  We *could*
use that but I am not sanguine about that approach: the Pathness would
spread throughout much of our config and file handling code.

I think we should at the very least postpone trying to work with
invalid-unicode-paths as long as we can.
2022-12-06 15:15:22 +00:00
Nick Mathewson 38bef96b99 Bump the minor version of every crate.
We made this job easy this time around: by incrementing our MSRV, we
have forced ourselves to do at least a minor bump everywhere.
2022-11-30 15:10:16 -05:00
Nick Mathewson 9765fdc2e6 ptmgr: Use anonymize_home when displaying paths in errors 2022-11-29 19:30:50 -05:00
Nick Mathewson bdddb78828 Merge branch 'more-linkspec-tests' into 'main'
Add tests for a bunch of code in tor-linkspec

See merge request tpo/core/arti!867
2022-11-29 18:41:54 +00:00
Nick Mathewson f08cfb6567 Merge branch 'ptmgr-cleanup' into 'main'
Post-merge cleanups for PtMgr

Closes #667 and #659

See merge request tpo/core/arti!893
2022-11-29 14:46:55 +00:00
Nick Mathewson 9a17a6a8aa Switch from sha-1 back to sha1.
As near as I can tell, the rust-crypto SHA1 crate was called `sha-1`
for a while because of a conflict with a different SHA1 crate.  Now
they apparently have the `sha1` name back and have deprecated the
`sha-1` name.
2022-11-29 08:24:58 -05:00
Nick Mathewson af0984bcaa Run cargo update in preparation for next release 2022-11-29 08:13:56 -05:00
Nick Mathewson e317c0ad6b Merge branch 'repro-less-shm' into 'main'
reproducible builds without shm

Closes #614

See merge request tpo/core/arti!818
2022-11-29 13:06:06 +00:00
Ian Jackson 8835c1b170 Merge branch 'redacted' into 'main'
Define a "redactable" trait, and use it when logging guard info

Closes #648 and #627

See merge request tpo/core/arti!882
2022-11-29 12:29:48 +00:00
trinity-1686a 3d5d4ada01 use newer version of zstd and lzma 2022-11-29 12:54:25 +01:00
Nick Mathewson 820657b6bc PtMgr: Use a persistent state directory for PT state.
This makes a `pt_state` directory inside .local/share/arti (or the
local equivalent), right next to our existing `state` dir.

Ideally we would use a separate directory for each PT, but we have a
very fuzzy "what is a specific PT" notion.

Closes #667
2022-11-28 17:29:32 -05:00
Nick Mathewson 8d0ac9bdc8 ptmgr: Mark PtMessage and next_message as experimental-api.
These are implementation details and we don't want to mark them as
stable.

To do this, I needed to apply some additional options to the example
code's configuration in Cargo.toml.
2022-11-28 17:29:23 -05:00
eta 3b41c78d6f Draft: Pluggable transport manager
This commit implements `PtMgr`, a pluggable transport manager
responsible for keeping track of spawned PTs and spawning them to
satisfy client requests on demand.

It does this in two parts: the `PtMgr` type exported to the rest of the
code, and the background `PtReactor` that actually does the spawning;
this design ensures that only one attempt to spawn a PT is active at a
time, and will prove useful later for implementing e.g. timeouts.

A few changes were necessary to the rest of the code in order to make
this all work out. Namely:
- `TransportRegistry`'s API didn't make any sense for two reasons:
  - It wasn't feasible for implementors to implement `ChannelFactory`,
    since that'd require constructing a `ChanBuilder` (which requires a
    bootstrap reporting event sender).
  - Treating the PT manager as a registry is over-general; it's only
    necessary for it to spawn pluggable transports, so saddling it with
    other concerns didn't make any sense.
  - (It's possible to get extensibility for arbitrary user customization
    by just letting the user swap in a new `ChannelFactory`, anyway.)
- Therefore, the `PtMgr` implements the new `AbstractPtMgr` trait, which
  is far more narrowly focused; this only exists to solve a dependency
  loop, and is documented as such.
  - This provides a `TransportHelper` instead of a `ChannelFactory`.
2022-11-28 13:52:21 -05:00
Nick Mathewson 777b6bee3d linkspec: Add some tests for ChannelMethod 2022-11-28 08:20:57 -05:00
Nick Mathewson a77172e20d safelog: Make MaybeRedacted<T> opaque. 2022-11-28 08:01:53 -05:00
Nick Mathewson 2aa0ae4016 linkspec: Give a Redacted form for chantarget. 2022-11-28 08:01:50 -05:00
trinity-1686a 0a917a1abc upgrade rustls to 0.20, ignoring all deprecation warnings 2022-11-26 10:23:05 +01:00
Ian Jackson 45a79bf725 tor-linkspec: Provide LoggedChanTarget type alias and utility method
This makes it easy to talk about, and construct, a
BoxSensitive<OwnedChanTarget>, which is what we'll use in errors.
2022-11-23 18:28:38 +00:00
Ian Jackson 91536da10a tor-basic-utils: Provide helper for serde flexible parsing 2022-11-21 14:58:24 +00:00
Ian Jackson cd2070b3ba BridgeConfigBuilder: Introduce build() function
And test cases for it, and its errors.
2022-11-21 14:58:24 +00:00
Ian Jackson 589f74a78f BridgeConfigBuilder: Introduce the struct with the dictionary repr
This struct is going to be the principal "dictionary-style" serde
representation for a bridge, and the builder, making this all in
keeping with our usual approach.

In this commit:
 * Introduce the struct (defining the serialisation)
 * Provide the setters (defining the Rust API)
 * Add success test cases (not all of the data in which is used yet)
2022-11-21 14:58:24 +00:00
Nick Mathewson 8dfbbca4e5 GuardMgr: Log when a guard status changes (significantly).
We previously had a trace message on _every_ change.  That's fine,
but we also want to log more important changes where the user
can see them.  Namely:

  * If we go from any other status to Reachable, we want to tell
    the user. (We don't want to spam them if it was already
    reachable.)
  * If we go from Untried or Reachable to Unreachable, we want to
    tell the user. (We don't tell them about changes from Retriable
    to Unreachable, since that just means that a retry attempt
    was not successful.)

Closes #627.
2022-11-17 12:32:57 -05:00
eta 1c9f6fb179 tor-ptmgr: make configuration use builders, plumb into arti-client
This brings the draft configuration mechanisms in tor-ptmgr in line with
the config in other crates, using builders. It also plumbs the config
type through into the main `arti-client` config, and adds some example
lines to `arti-example-config.toml`.
2022-11-16 11:39:25 +00:00
Nick Mathewson e5c26a123f Actually, require rsa 0.7.1.
rsa 0.7.0 has been yanked.
2022-11-10 11:26:35 -05:00
Nick Mathewson e19ff0ec21 Upgrade rsa to 0.7. Closes #613. 2022-11-10 11:04:20 -05:00
Nick Mathewson 34ae02e75f Upgrade to serde_with 2, phf 0.11. Closes #526. 2022-11-10 11:04:18 -05:00
Nick Mathewson 2c13a78c57 Upgrade to tinystr 0.7. Closes #591. 2022-11-10 10:57:33 -05:00
Ian Jackson 4f893648b8 Merge branch 'clap-v3' into 'main'
Upgrade to clap 3

Closes #616

See merge request tpo/core/arti!830
2022-11-08 17:11:04 +00:00
Ian Jackson d9d9cdeac9 bridge descs: Apply sensitive() to bridge identity in error log msg 2022-11-08 13:19:42 +00:00
Ian Jackson 5bc1d40a2b bridge desc: Implement cache reuse logic and if-modified-since
This introduces the new API functions to Store.
But currently they are all no-ops.
So all this machinery doesn't actually do anything.

Also, it changes the API to the mockable downloader, to allow it to
support if-modified-since.  So this isn't used either.  But it is more
convenient to do this all at once in BridgeDescManager, since care
needs to be taken about the intraction between if-modified-since and
the persistent cache.
2022-11-04 19:08:32 +00:00
Ian Jackson 1fa9dd62b3 bridge desc tests: Apply tracing_test::traced_test
This lets us see the log messages.  They look fine, as it happens.
2022-11-04 19:02:23 +00:00
Gabriel de Perthuis bc08ea48f7 Upgrade to clap 3 with minimal changes
This removes the last cargo audit override (for the unmaintained
ansi_term).

Don't mark options as required when they have default values:
see <https://github.com/clap-rs/clap/pull/3793>.
2022-11-04 19:28:38 +01:00
Ian Jackson 8eb7c731a2 bridge descriptors: Tests 2022-11-03 11:37:05 +00:00
Ian Jackson 51b4588cc0 bridge descriptors: Provide an implementation of BridgeDescProvider
Tests will come in a moment.
2022-11-03 11:37:05 +00:00
trinity-1686a e6e064ac8a remove unused dependancies 2022-10-29 13:29:55 +02:00
Nick Mathewson 0c7cdae8f9 Upgrade dependencies in preparation for upcoming release(s) 2022-10-28 14:51:01 -04:00
Ian Jackson 26a7aa9aa6 BridgeDescProvider: Make BridgeDescEvent repr(u16) and derive traits
This will enable us to impl FlagEvent for it.
2022-10-27 15:57:54 +01:00
eta a118a639ed tor-ptmgr/ipc: First cut of pluggable transport spawning
The new `ipc` module inside `tor-ptmgr` implements the Pluggable
Transport Specification version 1 (`pt-spec.txt`,
https://gitlab.torproject.org/tpo/core/torspec/-/blob/main/pt-spec.txt).

This enables module users to spawn pluggable transport binaries inside a
child process asynchronously, and receive structured information about
how to connect to the transports provided by said binaries.

Internally, this is structured as a pure set of serialisers and
deserialisers for the protocol in the specification (in the form of
environment variables, and the PT's stdout), a wrapper to run the PT
binary and enable accessing its output asynchronously, and a user-facing
wrapper that handles ensuring all the requested transports launched
properly.

The included `run-pt` example is an exceedingly minimal wrapper program
that was useful in testing. More tests can and should be added in a
further MR.

closes arti#394; part of arti#69
2022-10-26 16:07:30 +01:00
Ian Jackson 9a175ee323 FlagEvent trait: Implement using macros
The explicit list of variant names, that needs to be kept in sync, and
is a test failure semver break hazard, is now gone.

All the necessary code is now generated automatically, and cannot be
wrong.

I want this because I find myself wanting to add a second
implementation of FlagEvent, for another type.
2022-10-25 10:33:28 +01:00
Nick Mathewson 40ec12b0cb Merge branch 'guards_as_bridges_part1' into 'main'
Allow GuardMgr to expose bridges as guards (part 1)

See merge request tpo/core/arti!785
2022-10-24 13:30:02 +00:00
Ian Jackson 0924fb3623 tor-guardmgr: descs: Make BridgeDescError DynClone 2022-10-21 16:22:17 +01:00
Nick Mathewson 19fdf196d8 guardmgr: Add bridges sample, encode sample ID in FirstHopId.
The most important part of this commit is to make sure that each
`FirstHopId` includes the `GuardSetSelector` from which the guard
was selected.  Doing this lets us be certain that when we report
that a guard has succeeded or failed, we're reporting it in the
right context.

Additionally, this commit uses strum to make an iterator over the
samples, so that we can make sure that our "for each sample" code is
robust against future changes, and we don't miss the bridge sample.
2022-10-21 09:21:43 -04:00
Nick Mathewson f23adcd4c8 Merge branch 'pt-serde' into 'main'
serde support for PtTarget

See merge request tpo/core/arti!780
2022-10-20 17:13:19 +00:00
Nick Mathewson 34aa352d16 Implement serde for PtTarget and its members.
This will let us remember bridges that use pluggable transports.
2022-10-20 12:37:41 -04:00
Nick Mathewson 50b65b217d chanmgr: Begin a socks-client implementation.
This code is _not_ conditional, since we want to support running
with a proxy even if we don't support pluggable transports.

We may eventually want to refactor this into a new create.
2022-10-20 08:09:18 -04:00
Nick Mathewson 0c8a5a1fa4 linkspec: Add an "all_overlapping" accessor to ByRelayIds.
Also, add a few tests for this and the other accessors.

We'll need this accessor to find whether we have any channels to
_any_ of the identities that we're trying to connect to.
2022-10-18 11:49:21 -04:00
Nick Mathewson 8e2ce9de1d Write tests for RelayIdSet. 2022-10-15 10:06:02 -04:00
Nick Mathewson b84224feb4 Add builders for OwnedChanTarget/OwnedCircTarget
This will become the preferred way to make one of these objects, and
insulate us against future API changes.
2022-10-06 15:13:05 -04:00
Nick Mathewson 1d70bf4ddd Merge branch 'bridge_containers' into 'main'
Start implementing more data structures to hold Bridge descriptors.

See merge request tpo/core/arti!755
2022-10-06 17:16:44 +00:00
trinity-1686a f230cb5c03 remove manual limitation of coredump size
it's already disabled by secmem_proc
2022-10-05 18:32:16 +02:00
Nick Mathewson 23b3b0553f BridgeRelay: Implement more traits.
Also add a BridgeRelayWithDesc type (name tbd) to guarantee that
a bridge relay really does have a known descriptor before you
try to build a circuit with it.
2022-10-04 17:49:32 -04:00
Nick Mathewson 11caa46525 tor-linkspec: ByRelayIds<> type to hold a set of HasRelayIds
This is based on the type generated with n_key_set, with a
couple of extra methods to take advantage of RelayId and RelayIdRef.
2022-10-04 16:05:40 -04:00
Nick Mathewson 0d985b0def Merge branch 'hostname-validation' into 'main'
Use hostname-validator crate for hostname validation

See merge request tpo/core/arti!739
2022-10-03 19:01:56 +00:00
Nick Mathewson 7402578af4 Merge branch 'multi_keyed_set' into 'main'
Include a HashSet variant that can be keyed on multiple keys.

See merge request tpo/core/arti!747
2022-10-03 18:16:10 +00:00
Nick Mathewson c2d4b4ed3b Include a HashSet variant that can be keyed on multiple keys.
Every element in the set has up to N keys, each of which may have differnt
types.  No value for any key may correspond to more than one element in
the set.

These properties can be provided, via a macro, for values of N between 1
and $BIG_ENOUGH.

We'll use this to implement a type that holds HasRelayIds.
2022-10-03 13:30:37 -04:00
Nick Mathewson 05868fea7f Merge branch 'socks_client' into 'main'
Implement a SOCKS client handshake

See merge request tpo/core/arti!746
2022-10-03 17:23:24 +00:00
Nick Mathewson f12202d707 Make sure that socks4 auth doesn't have any 0 bytes.
Try to do it in constant time, to avoid even the smell of
side-channel attacks.
2022-10-03 12:52:38 -04:00
Nick Mathewson dc55272602 Fuzzer code for socks client implementation. 2022-10-03 12:52:38 -04:00
Reylaba 6a6931e2c3 Use hostname-validator crate for hostname validation 2022-10-03 16:47:03 +02:00
Nick Mathewson f2658437ff Oops: propagate bumps to Cargo.lock. 2022-10-03 10:15:37 -04:00
Nick Mathewson c1e70b7af4 Bump patchlevels of binary crates.
Since these don't expose any Runtime-based APIs, they don't have
a breaking change.
2022-10-03 10:07:19 -04:00
Nick Mathewson 102e3c221d Bump minor version of tor-rtcompat and most of its dependents
(Since the APIs for the `Schedule::sleep*` functions changed, this
is a breaking change in tor-rtcompat.  Therefore, the Runtime trait
in tor-rtcompat is now a different trait.  Therefore, anything that
uses the Runtime trait in its APIs has also broken.)
2022-10-03 10:01:46 -04:00
Nick Mathewson 388e0cbab5 Bump crates that have had backward compatible API changes. 2022-10-03 09:52:34 -04:00
Nick Mathewson 627a8f09bd Run cargo update in preparation for upcoming release. 2022-09-30 15:19:39 -04:00
Nick Mathewson 66ddbee1a4 Upgrade dependencies in preparation for upcoming release 2022-09-30 15:19:32 -04:00
Nick Mathewson e412d7400c Add the skeleton of a tor-ptmgr crate
When complete, this crate will handle launching and using pluggable
transports on demand.
2022-09-23 14:08:24 -04:00
Nick Mathewson 63dbc7b22d Create an API for TransportId 2022-09-23 09:55:33 -04:00
trinity-1686a edfd416ba4 enumerate platform with getresuid support 2022-09-10 14:13:26 +02:00
eta d9c140992f Merge branch 'fix-async-std' into 'main'
fix compilation error with async-std

See merge request tpo/core/arti!723
2022-09-07 17:16:28 +00:00
Nick Mathewson 86e479ae13 `TaskSchedule`: give error on `sleep*()` if last handle is dropped
This fixes an busy-loop.

When the last `TaskHandle` on a `TaskSchedule` is dropped, the
schedule is permanently canceled: whatever operation it was
scheduling should no longer be performed.  But our code was broken:
the `sleep()` and `sleep_until_wallclock()` functions don't verify
whether the handles are dropped or not.

This breakage caused an CPU-eating busy-loop in
`sleep_until_wallclock`.

With this patch, we now return a `Result<(), SleepError>` from these
functions.

Fixes #572.
2022-09-07 09:22:38 -04:00
trinity-1686a 4c543b570a fix compilation error with async-std 2022-09-06 21:32:20 +02:00
Ian Jackson 905aa29a9f Merge branch 'update-notify' into 'main'
update to notify v5.0.0

Closes #454

See merge request tpo/core/arti!679
2022-09-01 16:18:20 +00:00
Nick Mathewson 96875ea208 Bump crate versions in preparation for Arti 1.0.0 release.
Because we want to work more on ensuring that our semver stability
story is solid, we are _not_ bumping arti-client to 1.0.0 right now.

Here are the bumps we _are_ doing.  Crates with "minor" bumps have
had API breaks; crates with "patch" bumps have had new APIs added.

Note that `tor-congestion` is not bumped here: it's a new crate, and
hasn't been published before.

```
tor-basic-utils         minor
fs-mistrust             minor
tor-config              minor
tor-rtcompat            minor
tor-rtmock              minor
tor-llcrypto            patch
tor-bytes               patch
tor-linkspec            minor
tor-cell                minor
tor-proto               minor
tor-netdoc              patch
tor-netdir              minor
tor-persist             patch
tor-chanmgr             minor
tor-guardmgr            minor
tor-circmgr             minor
tor-dirmgr              minor
arti-client             minor
arti-hyper              minor
arti                    major
arti-bench              minor
arti-testing            minor
```
2022-09-01 08:59:49 -04:00
Nick Mathewson b3f989d689 Update patch-versions on crates without API changes.
Since our last round of releases, these crates have had either
trivial changes, or changes that did not affect their APIs.
Therefore we are bumping their versions, but not changing which
versions of them other crates depend on.
2022-09-01 08:45:02 -04:00
trinity-1686a e1e3f912b3 update to v5.0.0 2022-08-31 19:08:06 +02:00
Nick Mathewson 03a6338ee0 Run cargo update again, in preparation for release 2022-08-31 11:09:26 -04:00
Nick Mathewson 77cb5acceb Merge branch 'compact_home_2' into 'main'
Represent the home directory as ${HOME} or %UserProfile%

Closes #555

See merge request tpo/core/arti!700
2022-08-31 13:57:11 +00:00
Nick Mathewson 7888ca09d2 fs-mistrust: Add a `anonymize_home` extension fn for Path.
This function transforms `/home/nickm/.config` to
`${HOME}/.config/`, so that we can expose the username less in our
logs.
2022-08-31 09:38:09 -04:00
Nick Mathewson 8d6a1ea6ec Merge branch 'refactor-anyhow-arti-crate' into 'main'
Remove `anyhow` from `tor-config` crate

See merge request tpo/core/arti!707
2022-08-31 13:14:46 +00:00
Nick Mathewson f2699cb715 Run cargo update in preparation for release. 2022-08-30 20:09:19 -04:00
Nick Mathewson db50d57880 Upgrade serial_test in preparation for release. 2022-08-30 20:09:19 -04:00
Nick Mathewson 79860041fe Upgrade statrs in preparation for release. 2022-08-30 20:09:19 -04:00
Arturo Marquez 7d3d24cddf
Remove `anyhow` from `tor-config` crate 2022-08-28 18:07:53 -05:00
Nick Mathewson 2c4a176e66 Add functionality to listen for SIGHUPs. 2022-08-26 15:33:56 -04:00
Ian Jackson 56fd5ac779 Merge branch 'safelog_more' into 'main'
Apply safelog to more of the things that we log

See merge request tpo/core/arti!693
2022-08-26 13:20:00 +00:00
Ian Jackson 12476bf0d4 arti: cfg: Rename `*_port` to `*_listen` and change the type
This commit largely follows the example for resolve_alternative_specs.

The difference is that there are two fields, so we use a macro to
avoid recapitulating the field names.
2022-08-25 18:41:28 +01:00
Ian Jackson f588268128 tor-config: Provide misc::Listen 2022-08-25 18:40:14 +01:00
Ian Jackson 2fa75be660 tor-basic-utils: Provide IoErrorExt is_not_a_directory()
We're going to want this functionality, which isn't in the stable
stdlib.
2022-08-25 15:58:29 +01:00
Nick Mathewson 920f7a3f53 tor-chanmgr: don't log addresses so much.
We now log connection attempts at debug!, and mark relay target
addresses as sensitive.
2022-08-25 10:54:50 -04:00
Nick Mathewson a8b3e147fe arti_client: Refuse to build a client if we are setuid.
Arti is not designed to be a setuid-safe program.

Part of #523.
2022-08-24 15:23:24 -04:00
Ian Jackson 14c6e17797 tor-cell: PaddingNegotiate::start: take IntegerMilliseconds 2022-08-17 10:54:41 +01:00
Ian Jackson 18a6234101 channel padding: Test through most of the layers 2022-08-17 10:54:41 +01:00
Ian Jackson 50ca64218e channel padding: Send negotiation cells 2022-08-16 18:43:23 +01:00
Ian Jackson 76a1c45202 Introduce ChannelConfig
This commit is just the necessary plumbing.  The config is currently
empty.  We'll add something to it, for padding control, later.
2022-08-16 18:39:57 +01:00
Ian Jackson 2fbc196f8e tor-config: Introduce PaddingLevel
This will be used for controlling channel padding, for now.
2022-08-16 18:38:53 +01:00
Ian Jackson 806828c01c tor-proto: padding::Parameters: use impl_standard_builder
This is more standard.  It also provides the ::build() method.

This isn't a config type, and build failures ought not to happen,
so we use Bug for the error.
2022-08-16 18:37:06 +01:00
Nick Mathewson 3c1bfb4916 arti: Add support for process hardening
This is a compile-time feature with an associated configuration
flag, both enabled by default.

When it's turned on, hardening prevents the arti process from
dumping core or being attached to by low-privileged processes.
(This is a defense-in-depth measure, not an absolute way to prevent
attacks.  For more information, see
[`secmem_proc`](https://docs.rs/secmem-proc/0.1.1/secmem_proc/).)

Closes #364.
2022-08-15 12:59:56 -04:00
Nick Mathewson e74612456f Merge branch 'less_arti_surface' into 'main'
Reduce the arti crate's API surface; improve semver documentation.

Closes #522, #530, and #532

See merge request tpo/core/arti!664
2022-08-11 20:09:53 +00:00
Nick Mathewson f548a6ac55 arti: Move most public APIs behind `experimental-api`.
The remaining unconditionally public APIs are those related to our
configuration objects, and the main_main() API.

The rationale for making main_main() public is to have an actual
entry point.

The rationale for making the config APIs public is:

  1. We really do intend for others to be able to read our
     configuration files using this API.
  2. The structure of our configuration files is already part of our
     interface.

Closes #530.
2022-08-11 15:35:32 -04:00
eta 0775b6d42d tor-congestion: implement the RTT estimation algorithm from prop#324
This commit implements the round-trip-time estimation algorithm from Tor
proposal 324, validating the implementation against the test vectors
found in C tor. (Note that at the time of writing, the new test vectors
may not be committed to C tor yet, but they will be soon.)

This also adds the necessary consensus parameters to `NetParameters`.
Some of them have been renamed in order to (hopefully) make them more
understandable.
2022-08-11 15:33:50 +01:00
Nick Mathewson 36a28a8587 Merge branch 'main' into 'linkspec_refactor_v3'
# Conflicts:
#   crates/tor-netdir/semver.md
2022-08-10 14:48:57 +00:00
Nick Mathewson 19079c5a7d tor-proto: Unify the check_match code in channel and handshake
This had to become a new internal function, since at the point that
the handshake needs this code, it does not yet have a Channel to use.

This change made the error messages in the handshake code more
informative: and now they require a regex to check.  Later, we might
want to defer formatting these strings, but I don't think we need
to do it now.
2022-08-10 10:39:47 -04:00
Nick Mathewson 9b91edcb19 tor-netdir: Add a static assertion about RelayIdType::COUNT
Doing this will make sure that we fix a correctness issue in netdir that
will be caused if we add more IDs.

(Also add RelayIdType::COUNT in tor-linkspec.)
2022-08-10 10:39:47 -04:00
Nick Mathewson d60d875749 Parsing, encoding, and serde for RelayId.
The formats used here are backward-compatible with those used by C
tor and those used elsewhere in our code.  We need a way to encode
_both_ current kinds of identities as a string that tells you what
kind of ID they are.  Traditionally we have used hexadecimal,
sometimes with a $, for RSA ids, and we have used base64 for Ed25519
IDs.

We also introduce a new forward-compatible format for new identity
keys in the future.  (The new format is the key identity type, a
colon, and the id encoded as base64.)  We will use this new format
_only_ when we need to encode identities in a way where it would be
otherwise unclear what kind of key we are dealing with.
2022-08-10 10:39:36 -04:00
Nick Mathewson 9d4729a072 Add a set of Identity-related types and accessors.
I wonder if these types are correct.  I think it makes sense to have
a Ref type like this, rather than just using `&RelayId`, but it
doesn't seems that I can make `RelayId` and `RelayIdRef` implement
Borrow and ToOwned for one another, so maybe I've messed up.
2022-08-10 10:39:36 -04:00
Ian Jackson 33e0d67018 Update shellexpand, and switch to non-fork
Now we have bus>1 ownership of the crate name `shellexpand`.  I have
made a release, and retired `shellexpand-fork`.

The new shellexpand release switches to a (quite similarly) unforked
version of `dirs`.
2022-08-05 15:36:47 +01:00
Nick Mathewson be7cf7a24b Implement serde traits on RelayIds.
This will allow RelayIds to replace IdPair in tor-guardmgr.  (The
fields are named accordingly with `serde(rename)`.)
2022-08-02 12:40:55 -04:00
Nick Mathewson f1c6447403 New SecretBuf type in tor-bytes
This Writer is a simple wrapper around `Vec<u8>` that makes sure
that its contents are cleared whenever they are dropped _or
reallocated_.

The reallocation is the important part here: without that, we risk
not zeroizing the first allocation of the buffer.
2022-08-01 15:41:22 -04:00
Nick Mathewson 514c3a8e62 Use the `zeroize` feature in several crates
Using `zeroize` here tells these crates that they should make
various structures zeroize-on-drop.

(This is not yet implemented in `aes` 0.8.1, but support has been
merged in the repository for `aes`, so it should go out in the next
release.)

No corresponding feature flag is needed to enable zeroize-on-drop
for `rsa` and `*25519-dalek` private keys.
2022-08-01 12:13:05 -04:00
Nick Mathewson 6d5af26f95 Update Cargo.lock based on version bumps. 2022-08-01 10:17:04 -04:00
Nick Mathewson a0b2795e5e Run "cargo update" in preparation for next week's release. 2022-07-27 09:27:30 -04:00
Nick Mathewson 1f79e1c49b Update arti-client to new NetDirProvider API.
This allows us to give better errors in the case where bootstrapping
succeeds at first, but fails thereafter for long enough to make our
directory expire.
2022-07-26 10:41:38 +01:00
Nick Mathewson cf02d9990c Also downgrade serde_with: Version 2.0 requires Rust 1.60 2022-07-20 11:45:19 -04:00
Nick Mathewson 3ad312320e Downgrade phf back to 0.10
It turns out that phf 0.11 depends on Rust 1.60, which is above our
MSRV.
2022-07-20 10:48:28 -04:00
Nick Mathewson 393147e55e Run "cargo update" in preparation for next week's releases. 2022-07-20 08:37:13 -04:00
Nick Mathewson 131d880c7f Upgrade to latest phf, serde_with, serial_test. 2022-07-19 16:49:44 -04:00
Nick Mathewson 052f3089ca Bump to rusqlite 0.28. 2022-07-19 16:49:44 -04:00
Ian Jackson 7acdd21750 Provide maybe_send on postage::Sender, via extension trait
We need to replace the AtomicBool for dormant mode with something that
can wake up tasks.  postage::watch is the right shape.

But we want to be able to update it but suppress no-op updates.
(There is going to be a call site where no-op updates can occur.)

In the absence of a suitable upstream method as requested here
  https://github.com/austinjones/postage-rs/issues/56
we introduce this facility via an extension trait.
2022-07-18 18:13:13 +01:00
Nick Mathewson 9d3beb34a3 Bump tor-dirmgr to version 0.5.1.
This does not require a change in any other crate, since
the change here does not affect tor-dirmgr's APIs.
2022-07-14 12:00:42 -04:00
Nick Mathewson 033a05a9af Merge branch 'generate_cert' into 'main'
Implement functionality to construct signed Ed25519 certs.

Closes #511

See merge request tpo/core/arti!611
2022-07-08 13:25:29 +00:00
eta 0537e88d80 Merge branch 'persist-error-cleanup' into 'main'
tor-persist: Big refactoring on Error type.

See merge request tpo/core/arti!614
2022-07-06 17:20:43 +00:00
Nick Mathewson 853aed6859 tor-persist: Big refactoring on Error type.
Every error now has an action (what we were trying to do), a
resource (what we were trying to do it to), and a source (what
problem we encountered).

Initially I tried to add "action" and "resource" fields to error
variants individually, but that led to a combinatorial explosion.

Part of #323.
2022-07-06 11:47:17 -04:00
Nick Mathewson 48e44b0140 Implement functionality to construct signed Ed25519 certs.
This is behind a feature flag, since it isn't needed for pure
clients: only onion services and relays need this.

I've named the object that constructs these certs
`Ed25519CertConstructor` because it doesn't follow the builder
pattern exactly: mainly because you can't get an Ed25519Cert out of
it.  _That_ part is necessary because we require that an Ed25519Cert
should only exist if the certificate was found to be well-signed
with the right public key.

Closes #511.
2022-07-06 11:11:04 -04:00
Ian Jackson 6878e3a2d4 Merge branch 'update-rsa-v2' into 'main'
Update `rsa` dependency (and use `x25519-dalek` prerelease)

Closes #448

See merge request tpo/core/arti!612
2022-07-06 14:42:26 +00:00
eta c2e2da5dc3 Update `rsa` dependency (and use `x25519-dalek` prerelease)
- arti#448 and arti!607 highlight an issue with upgrading `rsa`: namely,
  the `x25519-dalek` version previously used has a hard dependency on
  `zeroize` 1.3, which creates a dependency conflict.
- However, `x25519-dalek` version `2.0.0-pre.1` relaxes this dependency.
  Reviewing the changelogs, it doesn't look like that version is
  substantially different from the current one at all, so it should be
  safe to use despite the "prerelease" tag.
- The new `x25519-dalek` version also bumps `rand_core`, which means we
  don't have to use the RNG compat wrapper in `tor-llcrypto` as much.

closes arti#448
2022-07-06 14:57:45 +01:00
Ian Jackson 8f63c07b5f tor-netdoc: b64 tests: add exhaustive roundtrip test 2022-07-06 12:04:23 +01:00
Ian Jackson a032137cad cargo update
This fixes a complaint from cargo audit about
  https://rustsec.org/advisories/RUSTSEC-2022-0032
in openssl.
2022-07-05 17:52:28 +01:00
Arturo Marquez af4970ec1f
Bump `base64ct` crate `1.5.0` -> `1.5.1`
This new release checks for invalid symbols in non-padded inputs
for decoding. Therefore, we can get rid of the logic implemented
in `https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/600`
2022-06-27 23:10:58 -05:00
Nick Mathewson 20435aea75 Bump crate and dependency versions.
These were done with the following commands:

```
cargo set-version -p tor-basic-utils   --bump patch
cargo set-version -p fs-mistrust       --bump minor
cargo set-version -p tor-error         --bump patch
cargo set-version -p tor-config        --bump patch
cargo set-version -p tor-units         --bump patch
cargo set-version -p tor-rtcompat      --bump minor
cargo set-version -p tor-llcrypto      --bump patch
cargo set-version -p tor-bytes         --bump minor
cargo set-version -p tor-socksproto    --bump minor
cargo set-version -p tor-cert          --bump minor
cargo set-version -p tor-cell          --bump minor
cargo set-version -p tor-proto         --bump minor
cargo set-version -p tor-netdoc        --bump patch
cargo set-version -p tor-netdir        --bump minor
cargo set-version -p tor-persist       --bump patch
cargo set-version -p tor-chanmgr       --bump minor
cargo set-version -p tor-guardmgr      --bump minor
cargo set-version -p tor-circmgr       --bump patch
cargo set-version -p tor-dirclient     --bump patch
cargo set-version -p tor-dirmgr        --bump minor
cargo set-version -p arti-client       --bump patch
cargo set-version -p arti              --bump minor
cargo set-version -p arti-bench        --bump minor
cargo set-version -p arti-testing      --bump minor
```
2022-06-24 12:00:22 -04:00
Nick Mathewson d5170d5318 Increment versions of crates with trivial changes only.
"Trivial" here includes stuff like cargo reformatting, comment
edits, error message string changes, and clippy warning changes.
Crates that depend on these do not need to increment.
2022-06-24 11:43:02 -04:00
eta ec3e1f2ada Merge branch 'error_cleanup_2' into 'main'
Error refactoring: bytes, cert, proto.

See merge request tpo/core/arti!604
2022-06-24 13:01:42 +00:00
Nick Mathewson da0e199bd3 Run cargo upgrade in preparation for release. 2022-06-24 07:55:26 -04:00
Nick Mathewson 38004a4f4d tor-proto: split and elaborate tor_bytes::Error instances
Some of these were for decoding particular objects (we now say
what kind of objects), and some were unrelated tor_cert errors that
for some reason we had shoved into a tor_bytes::Error.

There is now a separate tor_cert::CertError type, independent from
tor_cert's use of `tor_bytes::Error` for parsing errors.
2022-06-23 15:42:45 -04:00
Ian Jackson b1aab512ff Merge branch 'tor-netdoc/use-base64ct' into 'main'
Replace `base64` crate with `base64ct` crate in `tor-netdoc`

See merge request tpo/core/arti!600
2022-06-23 18:52:14 +00:00
Nick Mathewson 210f3f1587 Merge branch 'error_cleanup' into 'main'
Error cleanup, part 1

See merge request tpo/core/arti!601
2022-06-22 19:43:50 +00:00
Nick Mathewson e3e922d03f Improve error messages in tor-checkable. 2022-06-22 09:48:42 -04:00
Nick Mathewson 326ab1a7ae Editorial improvements on fs-mistrust errors
These changes make sure that the errors conform to our preferred
style, and include a description of what exactly we were doing when
something went wrong.
2022-06-22 08:03:15 -04:00
Arturo Marquez 2d92e9e218
Remove unused `base64` crate 2022-06-21 20:28:58 -05:00
Arturo Marquez 6536ca0f61
Replace `base64` crate with `base64ct` crate
Note: the `base64ct` crate rejects invalid characters when the
decoding is done on padded strings. However, the `FromStr` impl
for `B64` can have both padded **and** unpadded inputs, so all
inputs are now padded first, before decoding.
2022-06-21 20:02:33 -05:00
Ian Jackson da2e53bf76 tor-chanmgr: Change to use unwrap_void
As per discussion in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813573
2022-06-21 19:19:28 +01:00
Ian Jackson 9779e5a2e2 channel padding: Use IntegerMilliseconds in padding::Parameters 2022-06-21 19:19:28 +01:00
Ian Jackson 7f3f426738 channel padding: Plumb settings from chanmgr 2022-06-21 19:19:22 +01:00
Ian Jackson 7135b7c4c7 channel padding: Make Parameters a pub struct with builder
chanmgr is going to want to make one of these from a NetDir.
2022-06-21 19:19:22 +01:00
Nick Mathewson d95f597323 Run cargo update in preparation for release on Friday 2022-06-21 08:54:12 -04:00
Nick Mathewson 9ae57e8bc4 Merge branch 'reachable_addrs_v2' into 'main'
Implement support for reachable_addrs

Closes #491 and #93

See merge request tpo/core/arti!583
2022-06-17 13:16:16 +00:00
Nick Mathewson fb672dc688 NetDoc: Make AddrPortPattern implement serde traits
I'm using serde_with here to just re-use the Display and FromStr
implementations, since those are what has proven easier to type in
the past.
2022-06-17 08:47:57 -04:00
Nick Mathewson 5509bd0269 Merge branch 'config-fix2' into 'main'
Use impl_standard_builder more and remove manual Default/builder impls

See merge request tpo/core/arti!594
2022-06-16 20:30:34 +00:00
Ian Jackson 61bd8b810a Merge branch 'upgrade_float_eq' into 'main'
Upgrade to float_eq 1.0.0

See merge request tpo/core/arti!591
2022-06-16 17:26:04 +00:00
Ian Jackson c5bbaf470a arti: logging config: Replace a manual Debug impl 2022-06-16 15:27:00 +01:00
Nick Mathewson c4a9c8a1c4 Merge branch 'main' into 'accel-features'
# Conflicts:
#   crates/arti-client/Cargo.toml
2022-06-16 13:24:46 +00:00
Nick Mathewson 519f7dfa88 Upgrade to float_eq 1.0.0 2022-06-16 08:39:03 -04:00
Nick Mathewson 0223c91b26 Merge branch 'high-level-features' into 'main'
Add "full" and "experimental" features to arti, arti-client, and below.

Closes #499

See merge request tpo/core/arti!584
2022-06-16 12:24:47 +00:00
Nick Mathewson 10b38a7d7c Add "accel-*" features to arti-client and arti.
These need to be optional: they improve performance by shifting to
asm implementations, which may not be everybody's idea of good practice.

These are not 'pure' features, since they select one implementation
but disable another.  Therefore they don't go in `full`.

Closes #441.
2022-06-13 10:22:24 -04:00
Nick Mathewson 3673409735 Add a feature to tor-llcrypto to enable sha-1/asm.
SHA1 is a reasonably large part of our CPU usage (sigh), and this
implementation is 20-50% faster, depending on arch.
2022-06-13 10:13:13 -04:00
Nick Mathewson d44dd6f44f Merge branch 'dormant_directory' into 'main'
Use TaskSchedule to sleep in directory bootstrapping

Closes #497

See merge request tpo/core/arti!571
2022-06-13 13:59:26 +00:00
Nick Mathewson 2129aee6cd DirMgr: Use scopeguard crate in place of ad hoc RAII substitutes 2022-06-13 08:28:41 -04:00
Nick Mathewson 8a586a40fa Add "full" and "experimental" features to arti-client and below.
The "full" feature is a catch-all for all features, _except_:

   * Those that select a particular implementation (like
     tor-llcrypto/with-openssl) or build flag (like "static")
   * Those that are experimental or unstable (like "experimental-api")
   * Those that are testing-only.
2022-06-10 15:32:21 -04:00
Nick Mathewson 4f6c4f91c9 Merge branch 'channel' into 'main'
Have channel reactor able to send channel padding

See merge request tpo/core/arti!574
2022-06-10 13:28:51 +00:00
Ian Jackson a38c86a020 Merge branch 'format-ids' into 'main'
Replace four very similar "ids in request"

See merge request tpo/core/arti!577
2022-06-10 11:21:15 +00:00
Ian Jackson 6f92bf9e86 tor-bytes: Provide nested writers 2022-06-09 17:08:56 +01:00
Ian Jackson eb7bcc963b dirclient: Replace four very similar "ids in request"
In reviewing !553 I noticed that the empty digest list error had to be
handled in two places.  I filed #492 about the duplication.

In fact it turns out to have been quadruplication.

The new code also avoids cloning the underlying objects, instead
sorting a Vec of references.
2022-06-09 15:05:32 +01:00
Ian Jackson 3f2e164bc5 tor-proto: padding: Test padding timer distribution 2022-06-08 16:04:58 +01:00
Ian Jackson 0027b2371f tor-proto: channel: Provide padding::Timer 2022-06-08 16:04:58 +01:00
Nick Mathewson 5854e4bbd9 Merge branch 'use-testing-rng' 2022-06-07 19:02:12 -04:00
Nick Mathewson cfad648e16 Merge branch 'llcrypto-openssl' into 'main'
add support for openssl backend in llcrypto

Closes #442

See merge request tpo/core/arti!550
2022-06-07 15:50:48 +00:00
Nick Mathewson aa3a81c3ba Upgrade serial_test dev-dependency to 0.7.0 2022-06-07 09:22:24 -04:00
Nick Mathewson 7f785b66c2 Upgrade float_eq dev-dependency to 1.0.0 2022-06-07 08:03:55 -04:00
Nick Mathewson df06e7b9bc Upgrade tls-api to latest versions in arti-hyper. 2022-06-07 08:01:39 -04:00
Nick Mathewson 1076f25031 Rewrite tests in tor-netdir to use testing_rng()
The randomized tests in this crate take a lot of iterations to
converge, so they default to using a deterministic PRNG seed with
few iterations and higher tolerance, and they only randomize the
tests (with more iterations and tighter tolerances) when you
explicitly opt in to randomization.

(If you specify a seed explicitly, you're doing that to reproduce a
randomized case, so we use the same behavior.)
2022-06-02 15:48:41 -04:00
Nick Mathewson 967ea67b7d Use testing_rng() in tests throughout our crates.
This only affects uses of thread_rng(), and affects them all more or
less indiscriminately.  One test does not work with
ARTI_TEST_PRNG=deterministic; the next commit will fix it.
2022-06-02 14:56:42 -04:00
Nick Mathewson 69d352a7c7 New facility for deterministic and reproducible test PRNGs.
The new `testing_rng()` function is meant as a replacement for
thread_rng() for use in unit tests.  By default, it uses a randomly
seeded RNG, but prints the seed before the test so that you can
reproduce any failures that occur.  You can override this via the
environment to use a previous seed, or by using a deterministic
seed for all your tests.

Backend for #486.
2022-06-02 14:51:51 -04:00
trinity-1686a 0f290da005 add support for openssl backend in llcrypto 2022-05-30 17:22:31 +02:00
Ian Jackson fe9fb6b6ee arti config: Check that example config is exhaustive
This is the final piece of #457.
2022-05-30 16:03:01 +01:00
Nick Mathewson b232365a75 Semantic version changes for Arti 0.4.0 release
I followed the following procedure to make these changes:

* I used maint/changed_crates to find out which crates had changed
  since 0.3.0.
* I used grep and maint/list_crates to sort those crates in
  topological (dependency) order.
* I looked through semver_status to find which crates were listed as
  having semver-relevant changes (new APIs and breaking changes).
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no changes.  For those crates, I incremented their patch-level
  version _without_ changing the version that other crates depend on.
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no obvious breaking changes.
* I treated all crates that depend on `arti` and/or `arti-client` as
  having breaking changes.
* I identified crates that depend on crates that have changed, even
  if they have not changed themselves, and identified them as having
  a non-breaking change.
* For all of the crates, I used `cargo set-version -p $CRATE --bump
  $STATUS` (where `STATUS` is `patch` or `minor`) to update the
  versions, and the depended-upon versions.
2022-05-27 09:01:20 -04:00