Commit Graph

4108 Commits

Author SHA1 Message Date
Ian Jackson 1fc86e3ea9 Fix two rustdoc links
This type must have been renamed, I guess.
2022-07-12 15:14:47 +01:00
Nick Mathewson 51f4779f75 tor-circmgr: Clarify and improve Protocol error. 2022-07-12 10:01:56 -04:00
Nick Mathewson 4db7f4b9db tor-circmgr: minor error message edits. 2022-07-12 09:39:20 -04:00
Nick Mathewson 4dce7557b6 Remove the last vestiges of write_infallible.
Now that everything has been converted to fallible writers, we get
to finally remove write_infallible() from tor_bytes.
2022-07-11 11:18:51 -04:00
Nick Mathewson fbb6484025 tor-proto: Stop using write_infallible in handshake code.
This change was a bit annoying, since most of this code _can't_ fail,
and so the only reasonable response is to wrap the input in an
internal error... except for one case where we're actually encoding
a caller-provided message, so we _do_ want to wrap the EncodeError
from tor_bytes.
2022-07-11 11:18:51 -04:00
Nick Mathewson 44314f5076 tor-cell: Stop using write_infallible
Also, stop using "expect" and "assert!" to check for errors.
2022-07-11 11:18:51 -04:00
Nick Mathewson a0a88643f8 tor-cell: Make encoding method signatures fallible. 2022-07-11 11:18:51 -04:00
Nick Mathewson 8ef003c623 tor-linkspec: Stop using infallible writers. 2022-07-11 11:18:51 -04:00
Nick Mathewson 11451235d5 tor-cert: Remove all usage of infallible writers. 2022-07-11 11:18:51 -04:00
Nick Mathewson 2367f92c2c tor-cert: Encoding now uses Writeable trait.
This lets us remove a few TODOs.
2022-07-11 11:18:51 -04:00
Nick Mathewson 9b02cf004c tor-bytes::impls: Remove usage of infallible writers. 2022-07-11 11:18:51 -04:00
Nick Mathewson 9ca301faee socksproto: Use fallible writers.
Also, make private a function that had formerly been `pub`.
2022-07-11 11:18:51 -04:00
Nick Mathewson 5a61a6d73a Remove "write_and_consume_infallible".
There were only a few of these.  Removing it required porting
everything to use `write_and_consume` instead, and handling its
(potential) errors.
2022-07-11 11:18:51 -04:00
Nick Mathewson 8810af7f65 Convert each write_onto_infallible implementation into write_onto. 2022-07-11 11:18:51 -04:00
Nick Mathewson e1337bee8f Convert each write_into_infallible implementation into write_into.
(There was only one.)
2022-07-11 11:18:51 -04:00
Nick Mathewson 26c81edeea Define new write_into and write_onto methods with correct APIs. 2022-07-11 11:18:51 -04:00
Nick Mathewson 7938f65c66 Rename "write" methods on tor-bytes to "write_infallible".
This comprises four renames:

```
write_onto -> write_onto_infallible
write_into -> write_into_infallible
write -> write_infallible
writer_and_consume -> write_and_consume_infallible.
```

The rest of this branch will be concerned with replacing these
`_infallible` methods with ones that return a `Result`.  This is
part of #513.
2022-07-11 11:18:51 -04:00
Nick Mathewson fa72365f0e Add a Bug variant to tor-bytes::EncodeError.
This will help down the line as we make more writers fallible.
2022-07-11 11:18:51 -04:00
eta ea76389c30 Merge branch 'ntor3-high-level' into 'main'
Implement a higher-level API for the ntor v3 handshake

See merge request tpo/core/arti!618
2022-07-08 18:07:53 +00:00
eta af64a0a984 Implement a higher-level API for the ntor v3 handshake
This implements a higher-level API for the ntor v3 handshake, in line
with that exposed by the ntor handshake. It does not, however, use the
existing `ClientHandshake` trait, due to fundamental differences in the
handshakes (namely, that the v3 handshake can include some additional
extra extension data).

Currently, the higher-level API assumes circuit extension, and copies
the (undocumented!) magic verification string from c-tor that indicates
this usage.

A rudimentary set of functions for serializing and deserializing
extensions to be sent with the handshake is also included, implementing
the protocol in proposal 332 § A.2. Currently, it only implements the
congestion control extensions specified in proposal 324 § 10.3.

part of arti#88
2022-07-08 18:26:18 +01:00
Nick Mathewson 23d36abadc Merge branch 'guardmgr-error-cleanup' into 'main'
GuardMgr: Improve and revamp error types and messages.

See merge request tpo/core/arti!619
2022-07-08 14:25:41 +00:00
Nick Mathewson 51a59e8c8b Add a semver note to FilterCount 2022-07-08 09:29:09 -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 7c2f2e9f8d Merge branch 'dirclient-error-cleanup' into 'main'
Small cleanups to errors in tor-dirclient

See merge request tpo/core/arti!620
2022-07-08 10:22:09 +00:00
Nick Mathewson 82766e74e4 Improve display for tor-dircache errors.
These errors no longer use Debug to dump the `Option<SourceInfo>`, but
instead produce reasonable text.  Also, I've fixed the SourceInfo
Display implementation so that it now says that it got the error
"from $source via $circuit" rather than the other way around.
2022-07-07 14:07:04 -04:00
Nick Mathewson d681967b61 dirclient: Generalize MdSha256Empty to EmptyRequest.
(It makes sense to use this for things that are not in fact lists of
SHA256 digests of Microdescriptors.)
2022-07-07 14:07:04 -04:00
Nick Mathewson 1735b70769 Note semver break in tor-guardmgr::Error. 2022-07-07 13:20:57 -04:00
Nick Mathewson 3a2631ff9e Remove now-unused NoGuardsUsable case. 2022-07-07 13:16:06 -04:00
Nick Mathewson 287fe915f9 Improve message for failure to select a guard.
This uses similar techniques to the commit I just did for Fallbacks.
2022-07-07 13:16:06 -04:00
Nick Mathewson d7a626aaa8 Add more information to failed-to-select fallback errors.
Also re-order the filters to be a little more logical.
2022-07-07 13:16:06 -04:00
Nick Mathewson fecc57fbef FilterCount: Add a simple Display helper.
This is a helper rather than a Display implementation because it
isn't the only logical way to display these values.  (In fact,
without context, it isn't even the _most_ logical way)
2022-07-06 15:39:30 -04:00
Nick Mathewson b6e0eea2b0 New "counting filter" iterator helper in tor-basic-utils.
This is going to make it simpler to write the code in guardmgr (and
later in circmgr) that keeps track of how many relays were rejected
for what reason.  The latter, in turn, should improve error messages
when we're unable to pick a guard or a path.
2022-07-06 15:39:14 -04:00
Nick Mathewson 373b9e2ccf GuardMgr: tweak an error message. 2022-07-06 15:39:14 -04:00
Ian Jackson 357606a479 Merge branch 'chanmgr-error-cleanup' into 'main'
ChanMgr: Add more contextual info to error types.

See merge request tpo/core/arti!616
2022-07-06 17:26:49 +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 7213c4a45f Add a semver note. 2022-07-06 11:51:28 -04:00
Nick Mathewson dd491931c8 ChanMgr: errors: attribute errors to correct address.
Even when keys are relevant, we still don't want to attribute errors
to a set of addresses when we have a single address that we're
connected with.
2022-07-06 11:51:28 -04:00
Nick Mathewson bc9db9b84c ChanMgr: Add more contextual info to error types.
Now each type has a peer.  In some cases this peer is just an
address, whereas in others (where key is relevant or address isn't
yet narrowed down) it's a full OwnedChanTarget.
2022-07-06 11:51:28 -04: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
Nick Mathewson 56fefd7adf tor-llcrypto: expose the Signer API from ed25519-dalek 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 993c0cbe98 Merge branch 'b64t' into 'main'
tor-netdoc: b64 tests: add exhaustive roundtrip test

See merge request tpo/core/arti!613
2022-07-06 12:08:00 +00:00
Ian Jackson 9318e8712a Fix clippy needless deref 2022-07-06 12:05:57 +01:00
Ian Jackson 8f63c07b5f tor-netdoc: b64 tests: add exhaustive roundtrip test 2022-07-06 12:04:23 +01:00
Nick Mathewson aeef36a538 tor-persist: Move Error to a module. 2022-07-06 11:38:10 +01:00
Ian Jackson 372ff61552 Merge branch 'add-arti-hyper-unit-tests' into 'main'
Add some unit tests for arti-hyper

See merge request tpo/core/arti!615
2022-07-06 10:15:38 +00:00
spongechameleon 1242925e68 Add unit tests for arti-hyper's uri -> host,port,tls conversion 2022-07-05 13:45:41 -06:00
Nick Mathewson ccbf28c248 Merge branch 'openssl' into 'main'
cargo update - fix openssl

See merge request tpo/core/arti!617
2022-07-05 17:49:10 +00:00