aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/relay
Commit message (Collapse)AuthorAgeFilesLines
...
* | proto: Use the inbound CircuitAccount when extending circuitGabriela Moldovan2026-03-262-3/+10
|/ | | | | This was previously creating a new CircuitAccount in `new_outbound_circ()`, and then immediately dropping it.
* proto: Move handle_unrecognized_cell() out of ForwardHandlerGabriela Moldovan2026-03-251-38/+39
| | | | | | | | | | The `ForwardHandler` trait is meant for implementation-dependent functions that are called from the implementation-agnostic `ForwardReactor`. Previously `handle_unrecognized_cell()` was called directly by the generic `ForwardReactor`, but that's no longer the case, so it doesn't belong in the trait anymore. This commit is just code motion. Best reviewed with `--color-moved`
* proto: Forward unrecognized RELAY_EARLY as RELAY_EARLYGabriela Moldovan2026-03-252-4/+7
| | | | Closes #2417
* proto: Add tests for the relay circuit reactorGabriela Moldovan2026-03-251-0/+536
| | | | | | | | | This adds an initial set of tests for the circuit reactor. We will, of course, add more tests as we continue working on the implementation. Closes #2353
* proto: Replace fully-qualified path with import aliasGabriela Moldovan2026-03-251-1/+1
|
* tor-proto: change `dyn ChannelProvider` to also be `Sync`Steven Engler2026-03-242-3/+3
| | | | | An `Arc<T>` is only `Send` if `T` is `Send + Sync`, which is needed by the runtime.
* tor-proto: change relay circ reactor `new()` to `pub(crate)`Steven Engler2026-03-241-1/+1
| | | | | I plan to call this from `crates/tor-proto/src/channel/reactor.rs`.
* Fix typosTobias Stoeckmann2026-03-243-3/+3
| | | | Typos found with codespell
* Merge branch 'half-stream-expiry3' into 'main'gabi-2502026-03-231-4/+30
|\ | | | | | | | | | | | | proto: Replace TimeoutEstimator with opaque handler Closes #2410 See merge request tpo/core/arti!3794
| * proto: Remove now-unused TimeoutEstimator argumentGabriela Moldovan2026-03-191-2/+0
| |
| * proto: Replace TimeoutEstimator with opaque handlerGabriela Moldovan2026-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the client-specific half-stream expiry calculation from the stream reactor (which is meant to be implementation agnostic) with a call to the new `StreamHandler::halfstream_expiry()`, which abstracts away the implementation-specific half-stream expiry calculation (for example, on the client-side, the calculation takes into account the CBT, which we don't have on the relay side). Note that there is currently no `StreamHandler` implementation on the client-side (because we haven't ported the client circuit reactor to the new reactor yet). Closes #2410
| * proto: Implement StreamHandler for relaysGabriela Moldovan2026-03-191-1/+29
| |
* | Merge branch 'build_certs_refactor' into 'main'Nick Mathewson2026-03-231-19/+10
|\ \ | | | | | | | | | | | | cell, proto, cert: Simplify CERTS cell building. See merge request tpo/core/arti!3795
| * | cell, proto, cert: Simplify CERTS cell building.Nick Mathewson2026-03-191-19/+10
| |/ | | | | | | | | | | | | | | Formerly we required the caller for push_cert_body to specify the type of the cert that they were pushing. But in nearly every case, the certificate object that the caller is holding knows what its own type is! This makes the tor_proto build_certs_cell function a bit less error-prone, since we don't have to worry about mismatch.
* | proto: Compare AUTHENTICATE expected body in constant-timeDavid Goulet2026-03-191-1/+3
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | proto: The relay signing key signs the auth certDavid Goulet2026-03-191-6/+3
| | | | | | | | | | | | In other words kp_relaysign_ed. Signed-off-by: David Goulet <[email protected]>
* | proto: Check the AUTHENTICATE auth type that we support itDavid Goulet2026-03-192-1/+10
| | | | | | | | | | | | | | | | As a responder, we should check the AUTHENTICATE auth type and make sure we support it. We were not doing that, we were simply putting in our max version. Signed-off-by: David Goulet <[email protected]>
* | chanmgr: Clarify the use of no identity ChanTargetDavid Goulet2026-03-191-3/+4
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | tor-proto: fix the relay responder's CLOG/SLOG digestsSteven Engler2026-03-192-20/+37
| |
* | tor-proto: fix the relay initiator's SLOG digestSteven Engler2026-03-192-6/+19
| |
* | tor-proto: get SLOG/CLOG outside of `ChannelAuthenticationData`Steven Engler2026-03-193-10/+24
| |
* | tor-proto: build AUTHENTICATE after sending CERTSSteven Engler2026-03-191-15/+22
| | | | | | | | | | | | The AUTHENTICATE cell contents depends on all bytes sent on the channel before the AUTHENTICATE cell itself is sent (the CLOG). So we can only build a correct AUTHENTICATE cell after the CERTS cell has been sent.
* | cell: Simplify the Authenticate APIDavid Goulet2026-03-191-5/+8
| | | | | | | | | | | | | | | | | | | | Remove the is_equal_no_sig() and instead add a getter that returns a reference to the body without the random part so it can be used to verify the signature. The caller now checks the equality with what it is expected. Signed-off-by: David Goulet <[email protected]>
* | proto: Fix AUTHENTICATE equality check and signature checkDavid Goulet2026-03-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two things. 1. The "is_equal_no_sig()", if true, was going into the error path. 2. The signature verification is done against the body of the AUTHENTICATE cell that is all fields except the signature. Next commit will change the is_equal_no_sig() to make more sense with the "body" semantic. Signed-off-by: David Goulet <[email protected]>
* | proto: Set the link protocol outside the recv VERSIONS helperDavid Goulet2026-03-191-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It used to work for an initiator to set the link protocol once a VERSIONS is received because initiator send their VERSIONS before. This failed with responders because a responder channel sends their VERSIONS after receiving one from the initiator. This reverse logic means that the channel cell handler was transitionned to the Handshake state before a responder was able to send a VERSIONS cell leading to a failure because VERSIONS cell aren't allowed at the Handshake state. To fix this, the send/recv or recv/send is now explicit per channel type and once this is done and successful, the link protocol is set. A `set_link_protocol()` is added to the ChannelBaseHandshake trait so it can be used to set the cell handler. Signed-off-by: David Goulet <[email protected]>
* | proto: Responder channel properly validates the AUTHENTICATE cellDavid Goulet2026-03-192-17/+39
| | | | | | | | | | | | | | | | It is now validated against the received KP_link_ed of the initiator peer and we compare only the section of the AUTHENTICATE cell that we can compare (minus random bytes and sig). Signed-off-by: David Goulet <[email protected]>
* | proto: Add specialized build functions for ChannelAuthenticationDataDavid Goulet2026-03-193-59/+68
| | | | | | | | | | | | | | | | | | | | | | The initiator and responder are quite different. Building an AUTHENTICATE cell is delicate and so this change differenticates clearly between the two. This allows us to remove the peer_cert_digest from an UnverifiedChannel which is only something that makes sense for an initiator. Signed-off-by: David Goulet <[email protected]>
* | proto: New UnverifiedInitiatorChannelDavid Goulet2026-03-193-56/+19
| | | | | | | | | | | | | | | | Both client and relay specialized channel now use it as their inner base channel so they can use the same common verify() function since it is the same validation for both. Signed-off-by: David Goulet <[email protected]>
* | proto: Move cert validation per specialized channelDavid Goulet2026-03-193-11/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the last part from check_internal() that is specific to an initiator channel. At this commit, all three specialized channel do the verify process within their own verify() function. The client and relay initiator both look at the TLS cert (code duplication unfortunately). And the relay responder looks at the LINK_AUTH cert extracting the peer KP_link_ed key for validation. The CERTS cell is removed from UnverifiedChannel as it is now only useful within the verification process which is now specialized. A series of TODO(relay) is added to point out the current problem and how to fix them. The next step is to create an UnverifiedInitiatorChannel that will hold the verity_tls_cert() function and peer cert information which is only relevant to an initiator. This will remove code duplication. Signed-off-by: David Goulet <[email protected]>
* | proto: Add the verify_link_auth_cert() helperDavid Goulet2026-03-191-1/+1
| | | | | | | | | | | | The responder channel will soon use it. Signed-off-by: David Goulet <[email protected]>
* | proto: Use RelayIds in a VerifiedChannelDavid Goulet2026-03-193-4/+12
|/ | | | | | | | | | | | | | | | In order to pull this off, make UnverifiedChannel::check_relay_identities() to return a RelayIds that it builds after checking if they match the peer we were expecting. This part is moved in this commit so once check_relay_identities() returns, we are certain of the relay identity validity on both "it identified properly" and "it is the right expected relay". This makes it that the check_relay_identities() returns the RelayIds, the signing key and the RSA id digest (which is needed for authentication later). Signed-off-by: David Goulet <[email protected]>
* proto: Add more logging to the new circuit reactorsGabriela Moldovan2026-03-121-1/+28
|
* tor-cell: rename `RestrictedMsg::restricted_cmds()` to `cmds_for_logging()`Steven Engler2026-03-041-1/+1
|
* tor-proto: small code cleanupSteven Engler2026-03-031-9/+3
|
* tor-proto: improve error messages using `RestrictedMsg`Steven Engler2026-03-031-19/+7
|
* tor-proto: improve error messages during handshakeSteven Engler2026-03-031-1/+2
|
* tor-proto: during handshake ensure circ id is 0Steven Engler2026-03-031-2/+9
|
* tor-proto: require cells from initiator to be orderedSteven Engler2026-03-031-61/+112
|
* tor-proto: make receiving AUTH_CHALLENGE non-optionalSteven Engler2026-03-031-4/+0
|
* tor-proto: remove `is_expecting_auth_challenge()`Steven Engler2026-03-031-4/+0
| | | | The responder always sends an AUTH_CHALLENGE cell.
* safelog: Rename MaybeSensitive::hidden/visible()David Goulet2026-03-032-3/+4
| | | | | | Rename them to respectively sensitive() and not_sensitive(). Signed-off-by: David Goulet <[email protected]>
* proto: Channel handshake minor cleanupDavid Goulet2026-03-031-3/+5
| | | | | | | | | | To make the code a bit better here. Also, at this commit, the UnverifiedChannel::finish() and VerifiedChannel::finish() are basically the exact same. A refactoring to use a finish() helper would work nicely. Signed-off-by: David Goulet <[email protected]>
* proto: Setup the channel PeerInfo in the specialized finish()David Goulet2026-03-032-7/+19
| | | | | | | | | | | Every specific types know if the peer is sensitive or not so now the finish() of each of these channel types builds the right PeerInfo with MaybeSensitive. This is passed on the Channel so from that point on, the Channel will never leak peer data in the logs. Signed-off-by: David Goulet <[email protected]>
* proto: Make channel PeerAddr sensitiveDavid Goulet2026-03-033-20/+17
| | | | | | | Only the R2R channel that the PeerAddr becomes unsensitive. The rest, we keep it sensitive as it can be a client or a client's guard/bridge. Signed-off-by: David Goulet <[email protected]>
* tor-proto: rename 'SLOG'/'CLOG' and related codeSteven Engler2026-03-021-6/+8
|
* Merge branch 'relay-channel-fixes' into 'main'David Goulet2026-02-262-5/+0
|\ | | | | | | | | relay: Couple fixes related to channel creation See merge request tpo/core/arti!3726
| * proto: Remove/fix some very minor TODO(relay)David Goulet2026-02-262-5/+0
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | proto: The AUTHENTICATE cell requires the SHA256 RSA identity digestDavid Goulet2026-02-261-19/+22
|/ | | | | | | Before this commit, we would use the RsaIdentity which is a SHA1 digest. We do the same for the peer RSA key. Signed-off-by: David Goulet <[email protected]>
* proto: Implement the build_certs_cell() helperDavid Goulet2026-02-253-27/+13
| | | | | | | It was all commented out until now that we have a final RelayIdentities. Signed-off-by: David Goulet <[email protected]>
* tor-proto: split field into two fieldsSteven Engler2026-02-241-1/+1
| | | | | These were previously in a single `Option`, but now that the `Option` was removed, I think it's nicer to make these separate fields.