summaryrefslogtreecommitdiff
path: root/crates/tor-cell/tests
Commit message (Collapse)AuthorAgeFilesLines
* tor-cell: Add code for the payload of an hs-ntor handshake.Nick Mathewson2023-03-061-0/+48
| | | | | | (This is the encrypted information inside the INTRODUCE2 cell; it's used by the client to tell the service where to find its rendezvous point.)
* tor-cell: Rename EstablishIntro{Body => Details}Nick Mathewson2023-03-011-4/+4
|
* tor-cell: Make EstablishIntro do signaturesNick Mathewson2023-03-011-22/+72
| | | | | | | | | | | | | | | | The old code parsed and encoded a signature and a mac... but there was no way to actually set them properly. Now EstablishIntro is built around an EstablishIntroBody, and has the ability to check signatures and macs. Because there is no way to handle one of these messages if we can't check the signature, we no longer accept unrecognized `auth_key` types in this message. I've added a test to make sure that we can validate a message from the C tor implementation, and a test to make sure we can validate our own cells. I also had to modify the previous tests so that their keys were well-formed.
* Change several cfgs to refer to new feature names.Nick Mathewson2023-02-281-4/+4
|
* Mark new tests as onion-service-onlyNick Mathewson2023-02-281-0/+3
|
* tor-cell: Support extensions in INTRODUCE{1,2}Nick Mathewson2023-02-281-12/+4
|
* tor-cell: Implement IntroduceAck and IntroEstablishedNick Mathewson2023-02-281-0/+19
| | | | | These are fairly simple, since the bulk of them is just an extension list with no supported extensions.
* tor-cell: Implement rendezvous1 and rendezvous2.Nick Mathewson2023-02-281-0/+22
|
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-281-4/+4
| | | | Fixes #756
* Merge branch 'hs-cells-1' into 'main'Nick Mathewson2023-02-161-26/+18
|\ | | | | | | | | Start refactoring hs cell implementations See merge request tpo/core/arti!1020
| * tor-cell: Use a more generic mechanism for managing extensionsNick Mathewson2023-02-151-23/+15
| | | | | | | | | | | | | | | | | | | | Several HS message types have an extension list type. They all use the same framing for extensions, but each of them has separate extension types and separate extension namespaces. This commit simplifies establish_intro a little, and adds support for maintaining unrecognized extension types--at the expense of some new internal code.
| * tor-cell: Extract establish-intro into its own module.Nick Mathewson2023-02-151-1/+1
| | | | | | | | | | | | | | Some of the HS message types have a lot of dependent types, like extensions and options for those extensions, and so on. Except when those extensions are portable across cell types, it makes sense to put them in their own modules.
| * tor-cell: rename onion_service module to hsNick Mathewson2023-02-151-4/+4
| |
* | tor-cell: Add a new UnparsedRelayCellNick Mathewson2023-02-151-2/+14
| | | | | | | | | | | | We'll use this to router relay messages on a circuit to the appropriate stream, and hand them to that stream, without parsing the message until the stream has been determined.
* | tor-cell: Refactor relay cells to copy much lessNick Mathewson2023-02-151-2/+2
|/ | | | | | | | | | | | | We now manipulate raw relay cell bodies as (an alias for) `Box<[u8;509]>` rather than as (an alias for) `[u8;509]`. This enables us to do much less copying. It will become more important soon, as we defer parsing relay cell bodies even longer. Related to #7. We also use SliceWriter to avoid allocating a Vec<> for every relay message we want to encode, and instead encode directly into the cell.
* Change tor_bytes::Error::BadMessage to a Cow.Nick Mathewson2023-02-093-12/+17
| | | | | | | | | | Actually, to avoid making a breaking change, I'm deprecating BadMessage and creating a new InvalidMessage variant that takes a Cow. This way I don't need to track every crate that re-exposes tor_bytes::Error and call this a breaking change in those. Making this change will allow tor_bytes errors to be much more helpful.
* cell: Parameterize ChannelCodec::decode and encode.Nick Mathewson2023-02-091-5/+6
| | | | | | | This change lets us use ChannelCodec to encode and decode any restricted channel message type we want. (Later on, we'll turn the related Codec class in tor-proto into a more type-restricted version of this.)
* tor-cell: Rename RelayMsg and RelayCell-related types.Nick Mathewson2023-02-072-20/+20
| | | | Thanks to rust-analyzer for making this simple.
* tor-cell: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-072-14/+14
|
* tor-cell: Remove RelayMsg methods that are duplicated in RelayMsgClass.Nick Mathewson2023-02-072-2/+2
|
* tor-cell: Remove ChanMsg methods that are duplicated in ChanMsgClass.Nick Mathewson2023-02-072-10/+6
|
* tor-cell: Use macro to generate ChanMsg too.Nick Mathewson2023-02-071-2/+2
|
* tor-cell: Change all variants of RelayMsg to have a body.Nick Mathewson2023-02-071-3/+3
| | | | | Previously, there were some unit variants, but that makes things quite awkward for #525.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-274-0/+6
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* msg::{CreateFast/CreatedFast}: Rename accessor to (into_)body()Neel Chauhan2022-12-181-2/+2
|
* tor-cell: Rename for_client and for_relayEmil Engler2022-10-211-5/+5
| | | | | | | This commit renames the for_client and for_relay functions to from_client and from_relay respectively, in order to indicate their origin, as the term "for" is more likely to indicate a destination, which is not true in that situation.
* Fix various typos (using typos tool and hand-inspection)Nick Mathewson2022-10-181-2/+2
|
* Implement Introduce2 tor cellYuan Lyu2022-09-211-1/+3
| | | | | Reuse the same Introduce inner body implementation of Introduce1.
* Implement onion service Introduce1Yuan Lyu2022-09-081-5/+56
|
* Clean up EstablishIntro cellYuan Lyu2022-08-251-0/+68
|
* tor-cell: PaddingNegotiate::start: take IntegerMillisecondsIan Jackson2022-08-171-1/+3
|
* chancell: PaddingNegotiate: Provide two constructors, not oneIan Jackson2022-08-161-1/+7
| | | | | | | | We don't really want the caller to pass ignored timeout parameters. And this makes more semantic sense. The stop constructor uses zero, which is what C Tor does. See https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/76
* Implement establish rendezvous cellYuan Lyu2022-08-051-0/+38
|
* tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-113-5/+11
|
* tor-cell: udp: Remove manual length calculationsIan Jackson2022-06-091-3/+3
| | | | | This does away entirely with `wire_addr_len`, which recapitulates the length calculation.
* Merge branch 'use-testing-rng'Nick Mathewson2022-06-071-1/+2
|\
| * Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
| | | | | | | | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* | udp: New AddressPort used in cellsDavid Goulet2022-06-071-14/+12
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | udp: Allow empty hostname and no nul byteIan Jackson2022-06-072-23/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After changes to the prop339, the domain name in an Address can only be 255 bytes max and can NOT contain nul byte(s). Unit tests had to be modified to accept this change: - Centralise msg_ip_address - Add currently-passing tests for address length - Test counted address length longer than type wants Related to #463 Signed-off-by: David Goulet <[email protected]>
* | cell: Don't use NUL terminated string in CONNECT_UDPDavid Goulet2022-06-072-27/+25
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | cell: Move UDP to its own module and feature gate itDavid Goulet2022-06-072-10/+20
| | | | | | | | | | | | Related to #463 Signed-off-by: David Goulet <[email protected]>
* | cell: Implement CONNECTED_UDP cell from prop339David Goulet2022-06-071-0/+51
| | | | | | | | | | | | Decoding and encoding implemented according to proposal 339. Related to #463
* | cell: Implement CONNECT_UDP cell from prop339David Goulet2022-06-072-1/+119
|/ | | | | | | | | Decoding and encoding is implemented according to proposal 339 specifications. Related to #463 Signed-off-by: David Goulet <[email protected]>
* Remove many needless borrows and slicesIan Jackson2022-02-021-1/+1
| | | | | | | Found via clippy::needless_borrow. In some cases I removed needless `[..]` too. See also: needless_borrow suggestion doesn't go far enough https://github.com/rust-lang/rust-clippy/issues/8389
* fix/silence clippy lints in test modulesDaniel Eades2021-09-082-2/+2
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-274-0/+1180
This will cause some pain for now, but now is really the best time to do this kind of thing.