summaryrefslogtreecommitdiff
path: root/crates/tor-cell/src
Commit message (Collapse)AuthorAgeFilesLines
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* tor-cell: fix incorrect XON/XOFF cell command integersSteven Engler2025-06-231-5/+5
|
* tor-cell: add `Xon`/`Xoff` cellsSteven Engler2025-06-093-1/+185
|
* arti, cell, dirclient: Use expect instead of unwrap.Nick Mathewson2025-05-291-2/+3
| | | | | | Clippy nightly detects this problem, though earlier clippy verisons haven't. The common element here is applying unwrap() to the result from a write!().
* cell: fix warning from nightly about unused function.Nick Mathewson2025-05-291-0/+1
|
* Add methods for getting proof-of-work extension from intro request.Wesley Aptekar-Cassels2025-05-272-1/+10
|
* cell: Teach extlist definition macro to make conditional extensionsNick Mathewson2025-05-072-1/+7
| | | | | We need the macro to propagate only certain #[meta] values to all places where a case is used.
* cell: Implement SubprotocolRequest extension from prop346.Nick Mathewson2025-05-071-1/+138
| | | | Part of #1945.
* cell: Unify HS-ntor and ntor-v3 extensions.Nick Mathewson2025-05-076-32/+22
| | | | | | Implements proposal 358. Closes #1946.
* cell,proto: Split request/response extensions into seprate typesNick Mathewson2025-05-071-21/+44
| | | | Implements part of proposal 358.
* cell: Use ExtList to implement CircRequestExt.Nick Mathewson2025-05-072-105/+100
| | | | This required some renaming, so that the types and their codes matched.
* Rename NtorV3Extension to CircRequestExtNick Mathewson2025-05-071-18/+19
| | | | | | | This type will, because of prop358, be shared by ntorv3, hs-ntor, and probably other future handshakes. There will also be a CircResponseExt type.
* cell: Make decl_extension_group macro more self-contained.Nick Mathewson2025-05-074-14/+21
| | | | Previously it required the caller to import a whole bunch of stuff.
* cell: Clarify documentation in extlist.rs.Nick Mathewson2025-05-071-11/+10
| | | | It is no longer hs only.
* cell: move ExtList module out of hs module.Nick Mathewson2025-05-076-7/+6
| | | | We're going to use it for ntorv3 extensions as well.
* proto, cell: Remove RelayCellFormatTrait.Nick Mathewson2025-05-061-51/+0
| | | | | | | | | | | | | | | | The purpose of the trait was to parameterize the tor1 cell crypto on the different possible relay cell layouts. It made sense to have this trait when we thought we would implement the new cell layout for prop340 (packed-and-fragmented) well before we implemented CGO. But it now appears all but certain that CGO will land long before we make any more headway on prop340. Therefore, it doesn't make sense to carry the ability to customize `tor1` for other relay cell layouts. Removing this trait saves a fair bit of complexity.
* proto: Use SendmeTag in place of CircTagNick Mathewson2025-05-061-4/+2
| | | | | This doesn't make much change yet, but does save us an allocation when handling SENDMEs.
* tor-cell: define a new SendmeTag typeNick Mathewson2025-05-061-9/+149
| | | | | | | | | | | | | | | | This is a more efficient representation for the tag on an authenticated SENDME message: it comes in at 21 bytes. Previously, we used Vec<u8>, which has 24 bytes of overhead (on a 64 bit system), plus malloc overhead, plus 20 bytes of allocated tag. We had a similar type to this as `tor_proto::congestion::sendme::CircTag`, but it could only accomodate 20-byte values. I don't expect that we will have enough of these simultaneously that the memory savings will matter, but the allocation savings could be significant.
* tor-cell: optimize slice indexingSteven Engler2025-04-301-2/+2
|
* tor-cell: rename `STREAM_ID_OFFSET` to `STREAM_ID_OFFSET_V0`Steven Engler2025-04-301-3/+3
|
* tor-cell: add `UnparsedRelayMsg::data_len`Steven Engler2025-04-301-1/+21
|
* cell: simpler (?) approach to StreamIdReqNick Mathewson2025-04-161-22/+43
| | | | | | Instead of having a StreamIdReq that indicates "None in V1, Any in V0", take an optional RelayCellFormat as an argument.
* cell: simpler approach to assert-checking offsetsNick Mathewson2025-04-162-11/+13
|
* cell, proto: Use correct Data sizes for v1 relay cellsNick Mathewson2025-04-162-7/+29
| | | | | | | | | | | | Since v1 cells have a longer tag, they can fit less data into a single cell. Ah well, that's the cost of improved security. The code in data.rs is a little wonky, in that it currently requires its buffer to be exactly the maximum size for a data cell. We have a TODO about fixing that in the future, but for now I've moved it to use a boxed slice rather than a boxed array. Part of #1944.
* cell: Remove the deprecated Data::split_from().Nick Mathewson2025-04-161-14/+0
|
* cell: Implement parsing and encoding for V1 relay cellsNick Mathewson2025-04-162-14/+144
| | | | This is the main part of #1944, and will be needed for CGO.
* cell: Add a debugging-only method to simplify debug_asserts.Nick Mathewson2025-04-162-12/+12
|
* cell: Refine StreamIdReq for V1 relay cells, with minimal changesNick Mathewson2025-04-161-8/+14
| | | | | | | | | | Fortunately, the type is crate-internal, so this is not a breaking change. The key insight with this change is that, from the _caller's_ POV, the set of cells that are allowed to have StreamIDs has not changed. The only difference is that the V1 relay cell code needs to distinguish unrecognized commands from the SENDME case.
* cell: Create an unimplemented RelayCellFormat::V1Nick Mathewson2025-04-161-10/+30
|
* Add a RelayCellFormat argument to encode().Nick Mathewson2025-04-161-6/+10
| | | | | | | | | This will let us actually _send_ messages in the right format. This approach is not ideal for packed/fragmented messages; they will need a separate RelayCellEncoder. part of #1944.
* Note some places where we need updates for #1944.Nick Mathewson2025-04-163-0/+24
| | | | (Also note a couple of other CGO-related issues)
* tor-cell: Make conflux::V1Nonce opaque, add constructor.Gabriela Moldovan2025-04-081-7/+30
| | | | We will soon need to construct `V1Nonce`s.
* tor-cell: Copy ConfluxSwitch::seqno in getter.Gabriela Moldovan2025-04-081-0/+1
| | | | `u32` is `Copy`, so the getter doesn't need to return a ref.
* Merge branch 'interface-abstraction-of-the-daleks' into 'main'Nick Mathewson2025-03-181-1/+0
|\ | | | | | | | | Wrap x25519-dalek and ed25519-dalek types. See merge request tpo/core/arti!2868
| * Wrap ed25519-dalek types.Nick Mathewson2025-03-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | With this change, we'll no longer need to expose the types from dalek-cryptography as part of our API, and we'll have more freedom to switch ed25519 implementations, or to upgrade to a newer `rand` ahead of their schedule. Unlike with x25519-dalek, I had to tweak the API a bit: There's no way to get a &PublicKey out of a Keypair now, and implementing the old ed25519-dalek traits seemed unnecessary.
* | tor-cell: Implement RelayMsg for all conflux message types.Gabriela Moldovan2025-03-171-1/+1
| |
* | tor-cell: Add setters for the V1LinkPayload seqnos.Gabriela Moldovan2025-03-131-0/+10
| |
* | tor-cell: Make V1_LINK_NONCE_LEN pub.Gabriela Moldovan2025-03-131-1/+1
| |
* | tor-cell: Add constructors for the conflux cell types.Gabriela Moldovan2025-03-131-0/+46
| | | | | | | | We will soon need these in the circuit reactor.
* | tor-cell: Add type alias for the V1LinkPayload nonce.Gabriela Moldovan2025-03-131-1/+4
|/
* tor-cell: Add encodable conflux relay message types.Gabriela Moldovan2025-02-183-0/+216
| | | | | | | This adds support for encoding and decoding `RELAY_CONFLUX_LINK`, `RELAY_CONFLUX_LINKED`, and `RELAY_CONFLUX_SWITCH` cells. Closes #1852
* tor-cell: Add conflux RelayCmds.Gabriela Moldovan2025-02-181-0/+13
| | | | Part of #1852
* Merge branch 'mod-module-files' into 'main'Nick Mathewson2025-01-071-0/+1
|\ | | | | | | | | clippy: deny `mod_module_files` See merge request tpo/core/arti!2689
| * clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | | | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* | fix: fix typosDimitris Apostolou2025-01-061-1/+1
|/
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* PoW: Consolidate feature flags into a single flag.Wesley Aptekar-Cassels2024-11-251-1/+1
| | | | | | | | | | | | | | | | | This replaces the hs-pow, hs-pow-full, hs-pow-v1, pow-v1, and pow-full features with a single hs-pow-full feature. It's possible that in the future we will want to split different schemes into different features, but we can do that when it comes up. For now, having this as a single flag makes it clearer what's going on, since the previous thing was not actually expressive enough to capture some things we care about (like "at least one pow scheme is enabled" that works in a future-compatible way). This change is not semver breaking since it's a experimental feature. Related: #1751
* tor-cell: add clippy allowsSteven Engler2024-11-201-0/+1
|
* hs-pow: Clarify a confusing comment in ProofOfWorkV1.Wesley Aptekar-Cassels2024-10-091-1/+1
| | | | Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Rename seed to seed_head.Wesley Aptekar-Cassels2024-10-091-3/+3
| | | | | | Feedback from the hs-pow code review, the internal seed heading member should be seed_head instead of seed, for consistency. Very low impact change since the field name is not public.