aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-cell/src
Commit message (Collapse)AuthorAgeFilesLines
* tor-cell: derive `Default` for `SubprotocolRequest`Steven Engler2026-08-121-1/+1
|
* tor-cell: update docs and variable names for `Xon`Steven Engler2026-07-301-10/+13
|
* tor-cell: update docs and variable names for `XonKBpsEwma`Steven Engler2026-07-301-9/+9
|
* tor-cell: rename `XonKbpsEwma` to `XonKBpsEwma`Steven Engler2026-07-301-7/+7
|
* add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
|
* Removed unnecessary lintpryty262026-07-151-1/+1
| | | | Removed unnecessary lint
* hsclient: Support protocol negotiation for CGO and flowctrl-ccNick Mathewson2026-07-021-0/+5
|
* cell: Accessors for more intro extensions.Nick Mathewson2026-07-021-7/+16
|
* cell: Make "extlist" generate methods to access variants.Nick Mathewson2026-07-021-0/+18
| | | | | This will simplify the case where we need to look up a particular extension in an ExtList.
* tor-cell: remove `derive_more::Into` for `RelayEarly`Steven Engler2026-06-241-1/+1
| | | | | We don't use this anymore, and it can lead to subtle bugs since we lose the original channel message command.
* Merge branch 'flowctrl-tests' into 'main'opara2026-06-161-1/+1
|\ | | | | | | | | tor-proto: Add unit test for `XonXoffReader` See merge request tpo/core/arti!4093
| * tor-cell: impl `PartialEq + Eq` on `XonKbpsEwma`Steven Engler2026-06-101-1/+1
| |
* | tor-cell: document that destroy reason should be NONESteven Engler2026-06-121-0/+7
|/ | | | | | | The spec was recently updated in [1], so we should make this clearer in our code comments. [1]: https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/490
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-095-0/+5
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-121-2/+2
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* cell: Add Authenticate::BODY_LEN as a public constDavid Goulet2026-03-301-0/+2
| | | | | | | 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]>
* cell: Derive PartialEq for Begin and BeginFlagsGabriela Moldovan2026-03-251-2/+2
|
* Merge branch 'build_certs_refactor' into 'main'Nick Mathewson2026-03-231-0/+10
|\ | | | | | | | | cell, proto, cert: Simplify CERTS cell building. See merge request tpo/core/arti!3795
| * cell: Feature-gate API using the possibly absent EncodedCert type.Nick Mathewson2026-03-231-0/+1
| |
| * cell, proto, cert: Simplify CERTS cell building.Nick Mathewson2026-03-191-0/+9
| | | | | | | | | | | | | | | | 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: Check the AUTHENTICATE auth type that we support itDavid Goulet2026-03-191-0/+5
| | | | | | | | | | | | | | | | 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]>
* | cell: Use Error::MissingData if Authenticate fields length is wrongDavid Goulet2026-03-191-26/+16
| | | | | | | | | | | | Proper error to use and better code to use checked_sub(). Signed-off-by: David Goulet <[email protected]>
* | cell: Simplify the Authenticate APIDavid Goulet2026-03-191-16/+26
| | | | | | | | | | | | | | | | | | | | 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-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+34
|/ | | | | | | | 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]>
* tor-cell: rename `RestrictedMsg::restricted_cmds()` to `cmds_for_logging()`Steven Engler2026-03-041-2/+2
|
* tor-cell: add `RestrictedMsg` traitSteven Engler2026-03-031-0/+35
|
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* proto: Implement a Canonicity structDavid Goulet2026-02-121-0/+12
| | | | | | | | | | | | | | | | | This struct will be put in a Channel and derived from the received NETINFO cell. This follows the C-tor implementation for which we have two indicator of canonicity: 1. Peer is canonical: the address they advertise in the NETINFO cell matches the one we see on the TCP connection. 2. Canonical to peer: the peer sees us as canonical. Those flag will get used to select "the best" channel. Signed-off-by: David Goulet <[email protected]>
* cell: Add an accessor for the linkspecs of an EXTEND2Gabriela Moldovan2026-02-051-0/+5
|
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* proto: Authenticate a relay channelDavid Goulet2026-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a bit loaded but it is coherent. First, we set Eq and PartialEq to the channel message Authenticate so we can compare it with the one we expected. Second, the AuthenticationCell enum is introduced to store either an AUTH_CHALLENGE or an AUTHENTICATE since one side of the handshake can only have one. This allows us to store one or the other in UnverifiedRelayChannel. Depending on what we have, the authentication process is different as it dictates which side we are on (initiator vs responder). Keep in mind that the handshake code enforces receiving a AUTH_CHALLENGE along side CERTS. And same goes for AUTHENTICATE which means that if we have an AUTH_CHALLENGE in the UnverifiedRelayChannel, it is certain that the other side wants to authenticate and we are the initiator. Finally, the sending of CERTS and AUTHENTICATE by the initiator is now in UnverifiedRelayChannel::check() done right after verifying the channel CERTS and holding a "VerifiedChannel" object. This means that the last piece, sending the `NETINFO` by the initiator will be done in the check() but in a future commit. This leaves the VerifiableChannel::finish() to send nothing and only finalize the channel with the NETINFO (canonicity). Signed-off-by: David Goulet <[email protected]>
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-3/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* cell: Add missing docs to internal macroGabriela Moldovan2025-12-011-0/+2
|
* Merge branch 'bug2172' into 'main'Nick Mathewson2025-11-241-1/+1
|\ | | | | | | | | | | | | tor-llcrypto: Stop deriving Deref in CtByteArray Closes #2172 See merge request tpo/core/arti!3432
| * tor-llcrypto: Stop deriving Deref in CtByteArrayNeel Chauhan2025-11-241-1/+1
| |
* | Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-065-5/+5
| | | | | | | | Run maint/add_warning
* | Decorate a use with an allowIan Jackson2025-11-061-0/+1
|/ | | | | | | This seems to depend on cfgs. As I say in #1060, I don't think precise cfg decoration of imports is sensible. Also, it shouldn't be my job to fix whatever this is...
* proto: Add the channel authentication dataDavid Goulet2025-10-231-0/+5
| | | | | | | | | | | This commit only adds a struct holding all the authentication data that needs to be built during the verification process after all handshake cells needed for authentication have been sent. It lives in the VerifiedChannel struct so it can be used to build the AUTHENTICATE cell and be sent before the NETINFO. Signed-off-by: David Goulet <[email protected]>
* Remove a couple of unused imports.Nick Mathewson2025-10-161-1/+0
|
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* tor-cell: add `Display` impl for `XonKbpsEwma`Steven Engler2025-09-221-0/+9
|
* tor-cell: add pub `PAYLOAD_MAX_SIZE_{ALL,ANY}`Steven Engler2025-09-151-0/+50
|
* padding: Report when we have received padding or data.Nick Mathewson2025-09-021-0/+11
| | | | (This was so much easier than reporting on the send side.)
* proto: Remove the AUTHORIZE as a parsable cellDavid Goulet2025-08-212-36/+1
| | | | | | | | | | | | | The AUTHORIZE cell command is simply reserved but not defined. The tor specification, at this point in time, is allowing such cell before the handshake starts but it is very unclear on what ordering is allowed nor how many can are allowed. C-tor silents drop them like VPADDING and so clearly unused. Instead of dealing with it, simply remove its support but keeping its reserved number. Signed-off-by: David Goulet <[email protected]>
* proto: Make the OutboundClientHandshake use new cell handlerDavid Goulet2025-08-201-1/+1
| | | | | | | | | | | | | | | | | Use the ChannelFrame<> for the entirety of the outbound client handshake that is the ClientInitiator channel type. With this change, the codec.rs code is not needed anymore along its CodecError as well which has been normalized onto the crate::Error instead in order to simplify error handling and avoid duplication of error types. Unit tests have been modified to reflect this change of what can be done with a channel frame. Also renamed to focus on client behavior. Part of #1597 Signed-off-by: David Goulet <[email protected]>
* cell: Add helper functionsDavid Goulet2025-08-201-0/+5
| | | | | | | | | | | | Add is_known_cmd() to the restricted_msg!() macro which can be used to learn if a specific ChanCmd is part of the restricted set or not. Then add a simple function to get the link protocol version from a channel codec. Part of #1597 Signed-off-by: David Goulet <[email protected]>
* tor-hsservice: Change capping of PoW effort.Wesley Aptekar-Cassels2025-08-131-10/+0
| | | | | | | | This caps the PoW effort during sorting, rather than at intake. This allows us to record efforts that are capped in our metrics histogram while only recording metrics after the PoW solve has actually been verified.
* tor-cell: fix comment in `ChannelCodec::encode`Steven Engler2025-08-121-1/+3
| | | | | | This comment isn't correct if the encode() was given a non-empty buffer (for example if two cells were written to the same buffer, the second encode() would be given a non-empty buffer, so `pos != 5`).
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-0710-25/+21
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.