aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-cell/tests/testvec_relaymsg.rs
Commit message (Collapse)AuthorAgeFilesLines
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-121-1/+1
| | | | | | | | | | | 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.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | 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.
* cell, proto: Use correct Data sizes for v1 relay cellsNick Mathewson2025-04-161-1/+2
| | | | | | | | | | | | 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.
* tor-cell: Support encoding proofs-of-work in intro_payloadWesley Aptekar-Cassels2024-10-091-1/+1
| | | | | | | | | Like parameters, PoW solutions are versioned to account for multiple algorithms over time. A single solution of a specific version may accompany an INTRO1/2 as part of the encrypted extensions section. Its encoding may depend on the version. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* tor_bytes: Rename new_truncated_for_test to new_incomplete_for_testIan Jackson2024-09-121-2/+2
| | | | No semver implications since this wasn't in the last release.
* tor-bytes: Only report Truncated for errors at the outer levelIan Jackson2024-09-111-2/+2
| | | | | | | | | | | This is item 1 from https://gitlab.torproject.org/tpo/core/arti/-/issues/1614#note_3074562 and the alternative to item 2 presented in the 2nd half of https://gitlab.torproject.org/tpo/core/arti/-/issues/1614#note_3074648 (Item 3 was done earlier, but now we change the behaviour.) Fixes #1614.
* tor-bytes: Add a Reader constructor for use in testsIan Jackson2024-09-111-4/+4
| | | | | | | | | | | | We could call from_possibly_incomplete_slice in these, but that's confusing and distracting. Here we add this constructor, and document it (in terms of the constructor to come), and change the call sites. No functional change. Doing this now will prevent unwanted changes to test behaviours when we change the behaviour of Readers made by Reader::from_slice.
* Introduce and use tor_bytes::Error::new_truncated_for_test (fmt)Ian Jackson2024-09-101-1/+5
|
* Introduce and use tor_bytes::Error::new_truncated_for_testIan Jackson2024-09-101-4/+4
| | | | | | | | This is going to want to do something more complicated (as described in the docs). In this commit we change all the tests that are expecting Truncated errors. That reduces noise in the next commit.
* tor_cell: never construct empty DATA messages.Nick Mathewson2024-02-131-1/+1
| | | | | | | We never actually constructed these before, but now we enforce it at the API level. Part of #1269.
* clippy: consequential rustfmtIan Jackson2024-01-021-2/+1
|
* clippy: Use infallible callsIan Jackson2024-01-021-2/+1
| | | | Resolves clippy complaints about needless fallible conversions.
* Remove RngCompatExt.Nick Mathewson2023-11-291-2/+2
| | | | | | | | | | This code was needed with the old version of dalek-cryptography, which wasn't compatible with up-to-date versions of the `rand` crate(s). But now that we've upgraded, we can drop this. (We could have left it around and deprecated it, but we are already making a breaking change to tor-llcrypto by upgrading dalek-cryptography.)
* Convert to the latest versions of dalek-cryptographyNick Mathewson2023-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes that we have to adjust for are as follows: * In x25519-dalek: * `StaticSecret` is now behind a feature. * `StaticSecret::new` is deprecated in favor of `StaticSecret::random_from_rng`. * StaticSecret no longer does its own clamping. * In ed25519-dalek: * `SecretKey` has (in effect) been renamed to `SigningKey`. The name `SecretKey` is now an alias for `[u8; 32]`. * `SigningKey` is effectively a keypair, since it contains a public key as well. * `PublicKey` has been renamed to `VerifyingKey`. * The functions to extract a signing key and verifying key have been renamed as you might expect. * `ExpandedSecretKey` has been moved to `hasmat` and no longer implements `sign`. * `ExpanededSecretKey` now has as its elements a scalar and a hash prefix. * Various functions that took `&[u8]` now take `&[u8; N]`. * We no longer need a wrapper for older versions of rand. There is a single test in tor-keymgr that does not pass. I've marked it as ignore for now, in hopes that @gabi-250 can help me figure it out. This closes #808. There are several changes I want to make before we merge, however. They are marked with TODO DALEK.
* Use HandshakeType in Extend2 and CircuitExtender::beginJim Newsome2023-11-271-2/+3
|
* cell: Make EstablishRendezvous contain a RendCookie.Nick Mathewson2023-05-231-1/+1
|
* Change CircTarget::linkspecs() to return an encoded list.Nick Mathewson2023-05-101-1/+5
| | | | | | | | If we didn't do this, we would need to transfrom `EncodedLinkSpec`s into a `LinkSpec::Unrecognized`, which is not semantically right. What's more, every user of this API wants to consume encoded link specifiers, so encoding them early saves a little effort.
* linkspec: Make LinkSpecType public.Nick Mathewson2023-05-101-4/+7
| | | | | This lets us check the type of an `EncodedLinkSpec` as well, and lets us remove an interface that took a raw u8.
* Rename UnparsedLinkSpec => EncodedLinkSpecNick Mathewson2023-05-101-4/+4
|
* 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
* 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
|
* Change tor_bytes::Error::BadMessage to a Cow.Nick Mathewson2023-02-091-8/+8
| | | | | | | | | | 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.
* tor-cell: Rename RelayMsg and RelayCell-related types.Nick Mathewson2023-02-071-14/+14
| | | | Thanks to rust-analyzer for making this simple.
* tor-cell: Remove RelayMsg methods that are duplicated in RelayMsgClass.Nick Mathewson2023-02-071-1/+1
|
* 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-271-0/+2
| | | | | | | | 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.
* 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
|
* Implement establish rendezvous cellYuan Lyu2022-08-051-0/+38
|
* tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-111-2/+4
|
* 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-071-21/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-071-25/+23
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | cell: Move UDP to its own module and feature gate itDavid Goulet2022-06-071-7/+13
| | | | | | | | | | | | 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