aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/relay/channel/initiator.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: give our rsa ident to the channel reactorSteven Engler2026-04-161-0/+1
| | | | This will be needed for ntor handshakes.
* proto: Add channel relay handshake unit testsDavid Goulet2026-04-141-0/+6
| | | | | | | | | | | | | Instead of copying the client unit tests into the channel module, just make both current unit tests run on a client and relay handshake. This required a bit of trickery with type HandshakeConnectFn but works out in the end. It also adds the RelayMsgBuf that wraps a MsgBuf in order to implement CertifiedConn which is very relay only. Signed-off-by: David Goulet <[email protected]>
* tor-proto: give our ed ident to the channel reactorSteven Engler2026-04-091-0/+1
| | | | This will be needed for ntor handshakes.
* proto: Bring back AuthLogDigest and explicitly convert to SLOG/CLOGDavid Goulet2026-04-081-2/+3
| | | | | | | | | | | | From opara's comment: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3844#note_3388789 Keep the low level AuthLogDigest type alias and return it. The callsite is the one deciding if the returned digest is a Clog or a Slog. Related to #2441 Signed-off-by: David Goulet <[email protected]>
* 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-2/+3
|
* tor-{proto,chanmgr}: change how channels accept a CREATE* handlerSteven Engler2026-04-081-2/+13
| | | | | | | | | | | 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-2/+5
| | | | | When used for relay channels, the channel reactor will soon need to spawn relay circuit reactors.
* proto: Rename RelayIdentities to RelayChannelAuthMaterialDavid Goulet2026-03-301-10/+13
| | | | | | | | | | | | 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: Remove noop function for initiator channelDavid Goulet2026-03-301-12/+1
| | | | | | | | | | | | No need to call `set_authenticated()` for a relay initiator channel because relay initiator channel are always authenticated and thus the underlying channel cell codec will always use the R2R restricted message set. This is only useful to a relay responder channel. The naming of that function is not great actually and should probably change. Signed-off-by: David Goulet <[email protected]>
* proto: Rename many variables with more fine grained namingDavid Goulet2026-03-301-9/+9
| | | | | | | | | | 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: 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: fix the relay initiator's SLOG digestSteven Engler2026-03-191-4/+11
|
* tor-proto: get SLOG/CLOG outside of `ChannelAuthenticationData`Steven Engler2026-03-191-0/+8
|
* 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.
* proto: Add specialized build functions for ChannelAuthenticationDataDavid Goulet2026-03-191-3/+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-45/+5
| | | | | | | | 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-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | 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-1/+2
| | | | | | 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-031-2/+6
| | | | | | | | | | | 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: Implement the build_certs_cell() helperDavid Goulet2026-02-251-2/+2
| | | | | | | It was all commented out until now that we have a final RelayIdentities. Signed-off-by: David Goulet <[email protected]>
* proto: Pass PeerAddr at the channel handshake finish for initiatorsDavid Goulet2026-02-191-3/+4
| | | | | | | | | | 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-10/+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-0/+1
| | | | | | | | | | 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-9/+4
| | | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | 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: Add missing clock_skew() to unverified channelsDavid Goulet2026-02-041-1/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Introduce new relay initiator channel typesDavid Goulet2026-02-041-0/+178
This commit adds the Unverified and Verified flavor of a relay channel specific to an initiator. We decided to use the type system for safety and avoid patterns like: "if chan.is_initiator() {...} else {...}" This allows us also to not duplicate code between initiator and responder code. The downside is that we expose these types outside of tor-proto meaning the caller needs to feature gate the usage of these types with the "relay" flag. Small price to pay for strong guarantees with the type system. Signed-off-by: David Goulet <[email protected]>