aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/relay
Commit message (Collapse)AuthorAgeFilesLines
...
* proto: Reject EXTEND2 targeting the previous hop in the circuitGabriela Moldovan2026-04-231-1/+13
| | | | | | | The relay reactor will now reject any EXTEND2 that tries to extend the circuit to a hop that shares any identities with our previous hop. Closes #2415
* proto: Give the ExtendRequestHandler a copy of the inbound peer infoGabriela Moldovan2026-04-233-1/+8
| | | | | This will soon be used for preventing the circuit from being extended to the previous hop (#2415).
* proto: Fix broken doc link in extend handlerGabriela Moldovan2026-04-231-1/+3
|
* proto: Extract EXTEND2 handling into a new moduleGabriela Moldovan2026-04-232-200/+254
| | | | | | | | | The EXTEND2 handling logic is fairly self-contained, so I'm moving it outside of the `Forward` handler. This refactoring enables us to add more context to the handler (i.e. the inbound channel identities needed for #2415) without cluttering the `Forward` implementation. I recommend reviewing this commit with `git diff --color-moved`.
* proto: Make the CreateRequestHandler::new() take the ntor keysDavid Goulet2026-04-211-14/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Use the new RelayNtorKeys for the create handlerDavid Goulet2026-04-211-9/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* Merge branch 'rm-var-suffix' into 'main'David Goulet2026-04-201-4/+4
|\ | | | | | | | | proto: Remove dummy suffixes from variable name See merge request tpo/core/arti!3903
| * proto: Remove dummy suffixes from variable nameGabriela Moldovan2026-04-201-4/+4
| | | | | | | | | | | | | | | | I used these `_foo` suffixes to make sense of things during development: at the time, I had multiple "forward" and "backward" types, and I needed to distinguish them without spending too much time thinking of a provisory name. I meant to remove them before upstreaming my branch, but I forgot...
* | proto: Remove unnecessary clippy allowGabriela Moldovan2026-04-201-2/+0
| | | | | | | | | | I'm removing this so that we don't accidentally suppress new instances of this warning.
* | tor-proto: give our rsa ident to the channel reactorSteven Engler2026-04-164-3/+21
|/ | | | This will be needed for ntor handshakes.
* proto: Add a test helper function for building a CircNetParametersDavid Goulet2026-04-141-0/+14
| | | | | | | | | We can't access `NetParameters` in this crate to build from consensus default value so instead add a `defaults_for_tests()` gated function for each parameters object which puts in the defaults from the spec. We'll need CircNetParameters in order to build create request handler for unit tests hence why it is in src/circuit.rs.
* proto: Move DummyChan/DummyChanProvider to relay channel.rsDavid Goulet2026-04-142-64/+77
| | | | | | | | | From the reactor.rs to channel.rs, makes more sense and we'll need it in the handshake tests. No behavior change, just code movement and a function rename. Signed-off-by: David Goulet <[email protected]>
* proto: Remove re-export of MsgBuf in unit testsDavid Goulet2026-04-141-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add channel relay handshake unit testsDavid Goulet2026-04-142-0/+162
| | | | | | | | | | | | | 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-094-1/+31
| | | | This will be needed for ntor handshakes.
* proto: Apply deferred rustfmtGabriela Moldovan2026-04-091-1/+1
|
* proto: Add method for installing ntor keys in the create handlerGabriela Moldovan2026-04-091-2/+27
| | | | | This also updates the key rotation task to call the setter whenever the ntor keys get updated.
* arti-relays: Pass a CreateRequestHandler to the crypto taskGabriela Moldovan2026-04-091-0/+1
| | | | This will need to be updated each time the ntor keys change.
* relay: Pass advertise SocketAddr to channel builder instead of IpAddrDavid Goulet2026-04-092-8/+8
| | | | | | | | | | This trickles down to the tor-proto channel handshake code. But, the real need is in the channel builder in order to validate the outbound channel target. Fixes #2440 Signed-off-by: David Goulet <[email protected]>
* Merge branch 'create-fast' into 'main'gabi-2502026-04-091-55/+70
|\ | | | | | | | | tor-proto: Move CREATE_FAST handling to a helper See merge request tpo/core/arti!3869
| * tor-proto: take `CreateRequest` message by referenceSteven Engler2026-04-081-5/+4
| | | | | | | | | | Clippy has started warning about this since we moved the CREATE_FAST handling to a helper, so this resolves that.
| * tor-proto: move a TODOSteven Engler2026-04-081-2/+1
| |
| * tor-proto: remove old TODOSteven Engler2026-04-081-4/+1
| |
| * tor-proto: rustfmtSteven Engler2026-04-081-6/+3
| | | | | | | | Fix formatting from previous code movement.
| * tor-proto: move CREATE_FAST handlingSteven Engler2026-04-081-45/+43
| | | | | | | | | | This moves the code, changes the indentation, and wraps the result in an `Ok()`.
| * tor-proto: prepare to move CREATE_FAST handling to a helperSteven Engler2026-04-081-8/+34
| |
| * tor-proto: remove old TODOSteven Engler2026-04-081-1/+0
| | | | | | | | This had already been resolved.
* | proto: Bring back AuthLogDigest and explicitly convert to SLOG/CLOGDavid Goulet2026-04-082-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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-084-21/+28
|/ | | | | | | | | 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-082-5/+7
|
* tor-{proto,chanmgr}: change how channels accept a CREATE* handlerSteven Engler2026-04-084-5/+54
| | | | | | | | | | | 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: simplify error handling in `CreateRequestHandler::handle_create()`Steven Engler2026-04-081-71/+85
|
* tor-proto: add `CreateRequestHandler`Steven Engler2026-04-082-0/+341
| | | | for handling CREATE* messages on channels.
* tor-proto: change channel to use `Runtime`Steven Engler2026-04-082-5/+14
| | | | | When used for relay channels, the channel reactor will soon need to spawn relay circuit reactors.
* proto: Add debug_assert_eq() when building AuthenticateDavid Goulet2026-03-301-0/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* cell: Add Authenticate::BODY_LEN as a public constDavid Goulet2026-03-301-2/+1
| | | | | | | We use this constant value when building the AUTHENTICATE cell to optimize the memory allocation as this won't ever change. Signed-off-by: David Goulet <[email protected]>
* proto: Import read_msg() instead of refering to itDavid Goulet2026-03-301-19/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Rename RelayIdentities to RelayChannelAuthMaterialDavid Goulet2026-03-304-47/+63
| | | | | | | | | | | | 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-304-40/+45
| | | | | | | | | | 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-302-20/+17
| | | | | | | | | | | | | 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: Remove duplicate use of read_msg() helperDavid Goulet2026-03-301-45/+21
| | | | | | | | | | Make read_msg() into a helper and use it accross the handshake code. No behavior change. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374466 Signed-off-by: David Goulet <[email protected]>
* proto: Set a hardcoded number into a constDavid Goulet2026-03-301-2/+3
| | | | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374462 Signed-off-by: David Goulet <[email protected]>
* proto: Fix a set of commentsDavid Goulet2026-03-303-7/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add AuthLogAction enum helperDavid Goulet2026-03-301-5/+4
| | | | | | | | | We can remove the "/* take_slog */ true" pattern and instead have an explicit type at the callsite for semantic. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374457 Signed-off-by: David Goulet <[email protected]>
* proto: Add a type alias for SLOG/CLOG digestDavid Goulet2026-03-304-19/+16
| | | | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374457 Signed-off-by: David Goulet <[email protected]>
* Merge branch 'webtime-v3' into 'main'Nick Mathewson2026-03-262-4/+5
|\ | | | | | | | | | | | | Port to use web-time for compatibility with wasm32 Closes #2356 See merge request tpo/core/arti!3820
| * tor-proto: Port to web-time-compatNick Mathewson2026-03-262-4/+5
| |
* | proto: Use the inbound CircuitAccount when extending circuit (fmt)Gabriela Moldovan2026-03-262-2/+9
| |