aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel/handshake.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* handshake.rs: Document the time for clock skew authentication.Nick Mathewson2022-04-111-3/+25
|
* chanmgr: bubble ClockSkew up through the Error object.Nick Mathewson2022-04-071-1/+1
| | | | | | | | Fortunately, we don't need a separate type here: authenticated clock skew can only come attached to a `tor_proto::Error`. We also remove skew from `tor_proto::Error::HandshakeCertsExpired`, since it would now be redundant.
* Channel: Expose our view of whether the clock is skewed, and the ageNick Mathewson2022-04-071-0/+9
| | | | | | | | of a channel. At first I wanted to have this information not be a part of channels at all, but it is a fairly tiny amount of data, and the alternatives are pretty crufty.
* Merge branch 'netinfo-clock-skew' into 'main'Nick Mathewson2022-03-231-20/+104
|\ | | | | | | | | tor-proto: add the ability to learn clock skew from NETINFO cells See merge request tpo/core/arti!410
| * tor-proto: better errors when handshake fails due to untimely certsNick Mathewson2022-03-231-10/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now check the handshake certificates unconditionally, and only report them as _expired_ as a last resort. (Rationale: if somebody is presenting the wrong identity from a year ago, it is more interesting that they are presenting the wrong ID than it is that they are doing so with an expired cert. We also now report a different error if the certificate is expired, but its expiration is within the range of reported clock skew. (Rationale: it's helpful to distinguish this case, so that we can blame the failure on possible clock skew rather than definitely attributing it to a misbehaving relay.) Part of #405.
| * tor-proto: add a backend to detect reported clock skew.Nick Mathewson2022-03-231-10/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NETINFO cells, which are sent in every handshake, may contain timestamps. This patch adds an accessor for the timestamp in the Netinfo messages, and teaches the tor-proto code how to compute the minimum clock skew in the code. The computation isn't terribly precise, but it doesn't need to be: Tor should work fine if your clock is accurate to within a few hours. This patch also notes a Y2038 problem in the protocol: see torspec#80. Part of #405.
* | tor-proto: Remember peer information in circuit and channelNick Mathewson2022-03-171-3/+8
|/ | | | | | | | | Each channel now remembers an OwnedChanTarget. Each circuit now remembers a vector of OwnedChanTarget to represent the path that it was constructed for. Part of #415.
* proto: Refactor conversion from CodecError to ErrorNick Mathewson2022-02-241-16/+22
| | | | | Remove default conversion; instead use a specific conversion in each of the two modules that need to do it.
* tor-proto: refactor handshake protocol errors to a different typeNick Mathewson2022-02-231-49/+68
| | | | | | | | This helps the user distinguish between protocol violations that happen when connecting to the tor network from those that happen while connected. Closes #358.
* tor-proto: Split IoErr based on when it occursNick Mathewson2022-02-231-5/+19
| | | | | | | We want to distinguish handshake failures from errors later on in the channel's lifetime. Closes #359.
* Update tor-proto errors to latest API.Nick Mathewson2022-02-151-1/+1
|
* tor-proto: use InternalError for internal errors.Nick Mathewson2022-02-151-3/+4
|
* handshake: Use read_exact, not read and checking lenIan Jackson2022-01-191-3/+7
| | | | | | | | | read_exact has a loop in it, which we need. This means we end up separating the two sites that generate the "not a relay" error, so we need to fish out the error construction. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/249#note_2771023
* clippy: Rename a `from_foo` method that doesn't do conversionIan Jackson2022-01-191-1/+3
|
* Fix two bugs related to incomplete read/writeIan Jackson2022-01-191-3/+3
| | | | Discovered by clippy
* fix nightly clippy errorsTrinity Pointard2021-12-091-2/+1
|
* Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-1/+1
| | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* add semicolons if nothing returnedDaniel Eades2021-11-251-6/+6
|
* tor-proto: Use tor-rtcompat macros for testing, not tokio.Nick Mathewson2021-11-151-120/+132
| | | | Closes #222.
* Get rid of tor-proto's ChannelImpl, and use the reactor more insteadeta2021-11-031-11/+6
| | | | | | | | | | | | | | | | | | | Instead of awkwardly sharing the internals of a `tor-proto` `Channel` between the reactor task and any other tasks, move most of the internals into the reactor and have other tasks communicate with the reactor via message-passing to allocate circuits and send cells. This makes a lot of things simple, and has convenient properties like not needing to wrap the `Channel` in an `Arc` (though some places in the code still do this for now). A lot of test code required tweaking in order to deal with the refactor; in fact, fixing the tests probably took longer than writing the mainline code (!). Importantly, we now use `tokio`'s `tokio::test` annotation instead of `async_test`, so that we can run things in the background (which is required to have reactors running for the circuit tests). This is an instance of #205, and also kind of #217.
* Use coarsetime to build an incoming traffic timestamp.Nick Mathewson2021-11-021-0/+8
| | | | | | | | | | | | | | | | We need this for the circuit timeout estimator (#57). It needs to know "how recently have we got some incoming traffic", so that it can tell whether a circuit has truly timed out, or whether the entire network is down. I'm implementing this with coarsetime, since we need to update these in response to every single incoming cell, and we need the timestamp operation to be _fast_. (This reinstates an earlier commit, f30b2280, which I reverted because we didn't need it at the time.) Closes #179.
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-1/+2
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+840
This will cause some pain for now, but now is really the best time to do this kind of thing.