summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
| * | tor-proto: stop reactor (and kill circuit) if meta handler failsNick Mathewson2023-02-151-4/+7
| | | | | | | | | | | | | | | | | | | | | If the meta handler reports an error, then the circuit has violated its protocol, and needs to be shut down. Fixes #773.
| * | tor-proto: defer meta-cell parsing to the last moment.Nick Mathewson2023-02-152-36/+27
| | |
| * | tor-proto: Use UnparsedRelayCell to start deferring cell processing.Nick Mathewson2023-02-152-22/+43
| | | | | | | | | | | | | | | In general, we want to avoid parsing these cells until we are fairly sure that they are something we would accept.
| * | tor-cell: Add RelayCell::into_msg.Nick Mathewson2023-02-151-0/+4
| | |
| * | tor-cell: Implement {Relay,Chan}Msg for every body typeNick Mathewson2023-02-153-5/+97
| | | | | | | | | | | | | | | This will make it ergonomic to decode a single body type without having to declare a variant that accepts only a single message.
| * | tor-cell: Note an opportunity for future optimizationNick Mathewson2023-02-151-0/+5
| | |
| * | tor-cell: Add a new UnparsedRelayCellNick Mathewson2023-02-152-2/+60
| | | | | | | | | | | | | | | | | | 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-1510-68/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | tor-bytes: Add a new writer implementation for fixed-size objectsNick Mathewson2023-02-153-0/+125
| |/ | | | | | | | | | | | | | | Because the API assumes that many writes are infallible, this writer takes ownership of the backing object, and will only return it to you if you didn't run over the end. I'm going to use this to save some allocations in relay cell bodies
* | Merge branch 'fuzz-hsdesc' into 'main'Ian Jackson2023-02-157-2/+48
|\ \ | | | | | | | | | | | | Fuzzing for hsdesc parsers See merge request tpo/core/arti!1018
| * | netdoc: Add a basic fuzzer for the hsdesc layers.Nick Mathewson2023-02-142-1/+29
| | | | | | | | | | | | | | | | | | I've been running this for 5 minutes and haven't found any crashes. I'll run it for an hour or two, then add the results to the corpus repository.
| * | netdoc: Add a feature to expose hsdesc inner doc parsersNick Mathewson2023-02-145-1/+19
| |/ | | | | | | | | | | | | We want to fuzz these parsers, but there's no currently way to get at the parsers for inner documents without going through a lot of encryption. (Coverage-guided fuzzers are powerful, but they can't find SHA3 preimages.)
* / Upgrade to latest toml crate.Nick Mathewson2023-02-144-4/+4
|/ | | | (None of the breaking changes affect us this time.)
* Merge branch 'doc-iter' into 'main'Nick Mathewson2023-02-136-88/+488
|\ | | | | | | | | Introduce new batching iterator and use it in two places See merge request tpo/core/arti!1016
| * batching_split_before: Whitespace error fixIan Jackson2023-02-131-1/+1
| |
| * batching_split_before: Better xref for doc hiddenIan Jackson2023-02-131-0/+7
| | | | | | | | And another UNSTABLE warning.
| * batching_split_before: Clarify API sequential restrictionIan Jackson2023-02-131-4/+4
| |
| * batching_split_before: Fix and clarify Batches/LendingIterator docIan Jackson2023-02-131-2/+4
| |
| * batching_split_before: Introduce unit token typesIan Jackson2023-02-131-4/+18
| | | | | | | | And explain why we're not using booleans.
| * batching_split_before: Expand on the remaining use of "meta-iterator"Ian Jackson2023-02-131-1/+2
| |
| * batching_split_before: Fix link to BatchesWithHeader::subsequentIan Jackson2023-02-131-1/+1
| |
| * batching_split_before: Provide description for BatchesWithHeaderIan Jackson2023-02-131-0/+10
| |
| * batching_split_before: Document generics on our non-private typesIan Jackson2023-02-131-0/+9
| |
| * batching_split_before: Rename "prefix" to "header"Ian Jackson2023-02-132-24/+24
| | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1016#note_2877759 "_prefixed" becomes "_with_header". That mirrors the returned struct which is nice.
| * batching_split_before: Rename "start" to "batch-starting"Ian Jackson2023-02-131-27/+27
| | | | | | | | | | Roughly as per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1016#note_2877822
| * batching_split_before: Remove false assertions about batch contentsIan Jackson2023-02-131-4/+0
| |
| * batching_split_before: Clarify heading of BatchesWithPrefixIan Jackson2023-02-131-1/+1
| |
| * batching_split_before: docs improvements.Nick Mathewson2023-02-131-4/+8
| |
| * tor-netdoc: Use batching iterator in authcert.rsIan Jackson2023-02-102-62/+16
| | | | | | | | | | This gets rid of a lot of manual boolean state variable iterator stuff.
| * tor-netdoc: Use batching_split_before in HsDescInnerIan Jackson2023-02-101-25/+10
| |
| * tor-netdoc: Provide new batching_split_beforeIan Jackson2023-02-103-0/+402
| | | | | | | | | | | | | | | | | | | | | | | | There will be two call sites to demonstrate it. Eventually maybe this will want to be in tor-basic-utils, since it doesn't depend on any of the tor-netdoc types. But it would be sensible to wait until the situation with PeekableIterator and Itertools is improved. For now we make this #[doc(hidden)] to avoid it becoming part of our stable API.
| * tor-netdoc: Provide NetDocReader::into_iterIan Jackson2023-02-101-0/+7
| | | | | | | | | | This will avoids some hairy borrowck disasters when we try to use iterator adapters.
| * tor-netdoc: util: use super::* in testsIan Jackson2023-02-101-2/+1
| | | | | | | | Not xure how my MR to try to do this everyone missed this one.
| * tor-netdoc: util: Add standard lint block to testsIan Jackson2023-02-101-0/+10
| | | | | | | | Not xure how my MR to try to do this everyone missed this one.
* | netdoc: give hsdesc test info in its original form.Nick Mathewson2023-02-131-1/+5
| |
* | netdoc: Add a test for HSDesc decryption.Nick Mathewson2023-02-101-0/+63
| |
* | Add another test hsdesc to parse.Nick Mathewson2023-02-101-0/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This one was generated (by dgoulet) using `ClientDescEncKey` encryption. Its information is: ``` Address: paozpdhgz2okvc6kgbxvh2bnfsmt4xergrtcl4obkhopyvwxkpjzvoad.onion Time period: 19397 Client: paozpdhgz2okvc6kgbxvh2bnfsmt4xergrtcl4obkhopyvwxkpjzvoad:descriptor:x25519:SDZNMD4RP4SCH4EYTTUZPFRZINNFWAOPPKZ6BINZAC7LREV24RBQ Service: descriptor:x25519:SACGOAEODFGCYY22NYZV45ZESFPFLDGLMBWFACKEO34XGHASSAMQ ```
* | hscrypto: Use minutes, not seconds, in blinding parameter.Nick Mathewson2023-02-101-8/+4
|/ | | | | | | | | | | | Fixes an instance of #768. The problem with the test vectors is that I used a random time period number (1234) and the default-in-tor period length (1440) without checking whether 1440 _meant_ minutes or seconds. I'll add another test to Tor to make sure that the time period matches now. With this change, I can test Tor-generated hsdescs with encryption, so I'm fairly confident that the new behavior is correct.
* Merge branch 'ticket_525_part2' into 'main'Nick Mathewson2023-02-0929-343/+375
|\ | | | | | | | | Apply restricted_msg to ChanMsg parts of tor-proto See merge request tpo/core/arti!1013
| * Rename OpenClientChan{Msg,Cell} => OpenChan{Msg,Cell}S2CNick Mathewson2023-02-093-31/+31
| |
| * tor-proto: Do not parse forbidden commands on inbound cells.Nick Mathewson2023-02-093-88/+63
| | | | | | | | | | | | | | | | | | | | Unlike C tor, we treat unrecognized commands as reason to kill off the connection entirely. That's fine; if we need to add an unrecognized command in the future, we can use VERSIONS to negotiate it. Also, if someday we want this code to support relay channels as well, we can use some type trickery to have that work too.
| * tor-proto: only parse allowed ChanMsg types during handshake.Nick Mathewson2023-02-093-29/+100
| |
| * tor-cell: Return a useful error when restrist_msg rejects a command.Nick Mathewson2023-02-091-2/+3
| |
| * Change tor_bytes::Error::BadMessage to a Cow.Nick Mathewson2023-02-0918-52/+87
| | | | | | | | | | | | | | | | | | | | 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: Re-export paste so restrict_msg can work outside the crate.Nick Mathewson2023-02-091-3/+3
| |
| * tor-cell: Remove chancell::msg::Body::into_message.Nick Mathewson2023-02-091-52/+1
| | | | | | | | | | It's now redundant, since `restricted_msg!` defines From and Into for us.
| * tor-cell: Make RelayEarly a separate type.Nick Mathewson2023-02-096-12/+36
| | | | | | | | This allows us to remove a shenanigan from `restricted_msg!{}`.
| * tor-cell: Have restrict_msg add conversion functions.Nick Mathewson2023-02-096-104/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every FooMsg type now implements Into<AnyFooMsg>, and TryFrom<FooMsg>. Additionally, it now implements From<X> for every distinct type that it supports. This last part lets us discard a bunch of code. Unfortunately, I needed some downright hackish trickery in order to get these macros to avoid generating `From<AnyFooMsg> for AnyFooMsg` and conflicting with the blanket implementation. The trickery to deal with RelayEarly and Relay being the same type was not necessarily worth it; I will be separating them and removing said trickery in the next commit.
| * cell: Parameterize ChannelCodec::decode and encode.Nick Mathewson2023-02-093-12/+21
| | | | | | | | | | | | | | 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.)
* | Merge branch 'hsdir' into 'main'Ian Jackson2023-02-0913-126/+373
|\ \ | | | | | | | | | | | | Compute the HS directory hash ring See merge request tpo/core/arti!1012