aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/relay/channel/responder.rs
Commit message (Collapse)AuthorAgeFilesLines
* proto: Fix inverted cert sig and AUTHENTICATE compareDavid Goulet2026-06-021-4/+1
| | | | | | | | | | | | Missed at review and no unit tests at the time catched those. The next commit has a unit tests to make sure these checks are now valid. Fixes #2501 Fixes #2502 Special thanks to Moumen Alaoui for reporting this early! Signed-off-by: David Goulet <[email protected]>
* tor-proto: give our rsa ident to the channel reactorSteven Engler2026-04-161-2/+14
| | | | This will be needed for ntor handshakes.
* tor-proto: give our ed ident to the channel reactorSteven Engler2026-04-091-0/+12
| | | | This will be needed for ntor handshakes.
* proto: Add ClogDigest and SlogDigest typesDavid Goulet2026-04-081-3/+3
| | | | | | | | | Introduce those types in order to avoid mixing them up as the previous AuthLogDigest was just a type alias over [u8; 32] Fixes #2441 Signed-off-by: David Goulet <[email protected]>
* tor-proto: replace use of `ChannelDirection` with `CircIdRange`Steven Engler2026-04-081-3/+4
|
* tor-{proto,chanmgr}: change how channels accept a CREATE* handlerSteven Engler2026-04-081-3/+23
| | | | | | | | | | | Instead of giving the `CreateRequestHandler` to the channel after it's constructed, we integrate it into the handshake so that we can give it to the channel constructor. The `ChannelType` is no longer part of the `Channel`. Some of the tests could be cleaned up slightly now that the channel doesn't need the `ChannelType`, but I don't want to conflict with !3853.
* tor-proto: change channel to use `Runtime`Steven Engler2026-04-081-3/+9
| | | | | When used for relay channels, the channel reactor will soon need to spawn relay circuit reactors.
* proto: Rename RelayIdentities to RelayChannelAuthMaterialDavid Goulet2026-03-301-4/+4
| | | | | | | | | | | | This object contains a melting pot of public keys, private keys and certificates. Rename it to reflect that it is channel authentication material and not "identities. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374454 Signed-off-by: David Goulet <[email protected]>
* proto: Rename many variables with more fine grained namingDavid Goulet2026-03-301-26/+31
| | | | | | | | | | Mostly, identity a `ChanTarget` as a "target" since we juggle with PeerInfo and OwnedChanTarget nowadays. All certificate and keys have very specific names which attempts to match the spec as much as possible. Signed-off-by: David Goulet <[email protected]>
* proto: Transform inner into verified after verificationDavid Goulet2026-03-301-7/+11
| | | | | | | | | | | | | Only get the inner generic unverified channel into a verified channel after the actual verification in the relay responder handshake. Some variables needed a rename as this was dangerously named. No behavior change. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374481 Signed-off-by: David Goulet <[email protected]>
* proto: Add documentation for the channel verify()David Goulet2026-03-301-1/+16
| | | | | | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374476 and https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374478 Signed-off-by: David Goulet <[email protected]>
* proto: Fix a set of commentsDavid Goulet2026-03-301-4/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add a type alias for SLOG/CLOG digestDavid Goulet2026-03-301-3/+3
| | | | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374457 Signed-off-by: David Goulet <[email protected]>
* tor-proto: Port to web-time-compatNick Mathewson2026-03-261-2/+3
|
* Fix typosTobias Stoeckmann2026-03-241-1/+1
| | | | Typos found with codespell
* 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-191-0/+1
| | | | | | | | 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-191-8/+6
|
* tor-proto: get SLOG/CLOG outside of `ChannelAuthenticationData`Steven Engler2026-03-191-0/+8
|
* 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: Responder channel properly validates the AUTHENTICATE cellDavid Goulet2026-03-191-11/+20
| | | | | | | | 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-191-6/+3
| | | | | | | | | | | 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-191-1/+1
| | | | | | | | 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-191-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | 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: Use RelayIds in a VerifiedChannelDavid Goulet2026-03-191-2/+4
| | | | | | | | | | | | | | | | 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]>
* safelog: Rename MaybeSensitive::hidden/visible()David Goulet2026-03-031-2/+2
| | | | | | Rename them to respectively sensitive() and not_sensitive(). Signed-off-by: David Goulet <[email protected]>
* proto: Setup the channel PeerInfo in the specialized finish()David Goulet2026-03-031-5/+13
| | | | | | | | | | | 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-031-4/+5
| | | | | | | 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]>
* proto: Pass PeerAddr at the channel handshake finish for initiatorsDavid Goulet2026-02-191-4/+10
| | | | | | | | | | Responder relay handshake requires the peer address at the very start as it sends its NETINFO right away. For initiators, we only need it during the finalization process which is when the NETINFO is sent and the Channel is created. Signed-off-by: David Goulet <[email protected]>
* proto: Use the PeerAddr accross channel handshakeDavid Goulet2026-02-191-16/+3
| | | | | | | This is a large change but it is basically using PeerAddr in the channel builder through the channel handshake code and into the Channel itself. Signed-off-by: David Goulet <[email protected]>
* relay: Pass our TLS cert to the responder verify processDavid Goulet2026-02-121-2/+13
| | | | | | | | | | For the responder to build the authentication data, it needs its own certificate of the TLS handshake that it is responding to (as a TLS server). This resolves an important TODO(relay) in the code. Signed-off-by: David Goulet <[email protected]>
* proto: Enforce that channel method as unique SocketAddrDavid Goulet2026-02-121-13/+7
| | | | | | | | | | | | | During the channel handshake, we require the peer IP address for the canonicity check which requires the exact peer IP we are connected to. This commit adds a function that enforces this requirement on a ChannelMethod so anything else results in an error. It is to basically have stronger guarantee on the channel method we use in the handshake. Signed-off-by: David Goulet <[email protected]>
* proto: Channel finish() now handles canonicityDavid Goulet2026-02-121-11/+39
| | | | | | | | | | | | | | All handshake pass the NETINFO cell, the advertised addresses (if any) and the peer address in order to build the Canonicity and build the channel with it. In order to pull this off, the "my_addrs" were added to several object along the NETINFO cell. We also pass the channel method when connecting (initiator) to a relay as we need this for this canonicity build. Signed-off-by: David Goulet <[email protected]>
* proto: Relay responder channel allow to be non_exhaustiveDavid Goulet2026-02-091-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Publicly re-export MaybeVerifiableRelayResponderChannelDavid Goulet2026-02-091-0/+1
| | | | | This type is needed in the tor-chanmgr crate in order to decide to verify or not the underlying relay channel.
* proto: Add missing clock_skew() to unverified channelsDavid Goulet2026-02-041-1/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Introduce new relay responder channel typesDavid Goulet2026-02-041-0/+176
Add the unverified, verified, non verifiable flavor types of a responder channel. This follow on the previous commit to use the type system for stronger guarantees. Signed-off-by: David Goulet <[email protected]>