aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | NtorV3Client: implement ClientHandshakeJim Newsome2023-11-151-7/+13
| |
* | ClientHandshake: extend to support ntorv3 extensionsJim Newsome2023-11-154-22/+66
| |
* | NtorV3Client: take a slice instead of a vec of extensionsJim Newsome2023-11-151-5/+3
| |
* | ntor_v3: replace `impl digest::XofReader` with `NtorV3XofReader`Jim Newsome2023-11-151-15/+20
| |
* | CircuitHandshake::Ntor::ed_identity clarify doc-commentJim Newsome2023-11-151-2/+2
| | | | | | | | | | Use consistent phrasing when describing the two key fields to make it clear they're referring to the same relay.
* | hs_ntor: fix comment typo INTROUDCE1Jim Newsome2023-11-151-1/+1
| |
* | circuit: On SendMsgAndInstallHandler, tolerate None handlerNick Mathewson2023-11-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Previously it was possible for `handler` to be None only when `msg` was also None, which would make SendMsgAndInstallHandler into a no-op. Now, if `msg` is present but `handler` is absent, we use the previously installed handler, which I think was our intention. Without this patch, `Conversation::send_message` simply won't work. Fixes #1085.
* | circuit::reactor: Remember that meta_handler is Send.Nick Mathewson2023-11-021-2/+2
| | | | | | | | | | | | (We already require that it is Send when the client gives it to us in circuit.rs, but we had previously forgotten that when we stored it in the Reactor.)
* | Precisely cfg-decorate a constantIan Jackson2023-10-311-0/+1
| | | | | | | | | | | | | | | | | | | | Peraonally I would prefer | #![cfg_attr(not(all(feature = "full", feature = "experimental")), | allow(dead_code))] but I think that is almost certainly controversial. See tpo/core/arti#704.
* | Add cfg_attr allow(unused_imports) to two cratesIan Jackson2023-10-311-0/+6
| | | | | | | | | | As per this comment, and preceding discussion https://gitlab.torproject.org/tpo/core/arti/-/issues/1060#note_2959187
* | Add a caret_int HandshakeType for HTYPE constantsJim Newsome2023-10-263-4/+9
| |
* | Change `CircId` to never be zeroJim Newsome2023-10-256-59/+94
| | | | | | | | | | | | | | | | | | | | This changes the internal representation to be `NonZeroU32` instead of just `u32`. Various places where a circuit ID is optional now use `Option<CircId>`. Fixes a bug in `CircIdRange::sample` that would previously return a circuit ID of 0, when the rng returned 0x8000_0000 for a low range.
* | Convert StreamId to NonZeroU16Jim Newsome2023-10-257-73/+82
|/
* Fix rustdoc link warnings/errors.Nick Mathewson2023-10-201-1/+1
|
* Merge branch 'tricky_terminate' into 'main'Nick Mathewson2023-10-194-181/+149
|\ | | | | | | | | | | | | Refactor the stream-closing logic in tor-proto Closes #1065 See merge request tpo/core/arti!1681
| * proto: Revise the behavior of IncomingStream::discard().Nick Mathewson2023-10-193-21/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | Because dropping a `StreamTarget` causes the circuit reactor to send an End, the previous do-nothing implementation of `discard()` wasn't sufficient to cause the request to be ignored without sending an End. This commit modifies our "close pending stream" behavior to only optionally send an End message. To avoid confusion, I'm using a new `CloseStreamBehavior` enum rather than an `Option<End>`, since we had previously used `None` in some cases to indicate a default (misc) end message.
| * IncomingStream:: flatten IncomingStreamInner.Nick Mathewson2023-10-191-13/+11
| |
| * IncomingStream: Remove state.Nick Mathewson2023-10-191-67/+4
| | | | | | | | | | | | Now that every state-change function consumes the IncomingStream, there is no longer any reason to keep track of an internal state enum.
| * Note a bug in IncomingStream::discard.Nick Mathewson2023-10-191-0/+2
| |
| * Remove IncomingStreamInner from its Option.Nick Mathewson2023-10-191-34/+7
| | | | | | | | | | Now that IncomingStream doesn't implement Drop, we can just destructure it.
| * Remove impl Drop from IncomingStreamNick Mathewson2023-10-191-11/+4
| | | | | | | | | | Since dropping a StreamTarget will send an End, we don't need to call reject_internal in this case.
| * proto: Remove TODOs about panics on double-close.Nick Mathewson2023-10-192-31/+2
| | | | | | | | | | | | | | Now that `StreamMap::terminate` no longer panics, and now that it permits the kind of double-call that we allow, we can close #1065. Closes #1065.
| * proto: Have EndSent remember if we have dropped the stream target.Nick Mathewson2023-10-192-14/+46
| | | | | | | | | | The rule is that we allow up to one explicit `close_pending`, followed by exactly one final `mpsc::Sender` drop.
| * proto: Give StreamMap::terminate a "why" argumentNick Mathewson2023-10-192-7/+45
| | | | | | | | | | We will use this to enforce correct ordering on "close" vs "drop" APIs.
* | Merge branch 'upgrade_20231017' into 'main'Ian Jackson2023-10-191-2/+2
|\ \ | |/ |/| | | | | Upgrade several dependencies. See merge request tpo/core/arti!1680
| * Upgrade to latest asynchronous_codec (0.7.0)Nick Mathewson2023-10-171-2/+2
| |
* | Add comments about another problem with close_pending().Nick Mathewson2023-10-172-0/+21
| | | | | | | | See #1065 for more information here.
* | proto: Make StreamTarget::close() misuse less likely.Nick Mathewson2023-10-172-5/+9
|/ | | | | | | | | It turns out that we can make `IncomingStream::reject()` consume self, thus making it impossible to hit the double-close error from outside the `tor-proto` crate. Also, we rename `StreamTarget::close()` to `close_pending()` to better reflect its limited applicability.
* Merge branch 'todos_proto' into 'main'Nick Mathewson2023-10-123-91/+120
|\ | | | | | | | | tor-proto: Resolve a few TODO HSS entries. See merge request tpo/core/arti!1658
| * proto::stream::incoming: Use bit-array representation for command listNick Mathewson2023-10-121-7/+84
| | | | | | | | | | This should be smaller and faster than vec, and save some allocations. It could also avoid a tiny sidechannel.
| * tor-proto: remove a now-unneeded allow in stream::incomingNick Mathewson2023-10-121-2/+0
| |
| * Remove the (fairly bogus) HsNtorServiceInput type.Nick Mathewson2023-10-121-80/+37
| | | | | | | | This will let avoid some copying inside our HSS code.
| * proto: Remove a TODO about merging two functions.Nick Mathewson2023-10-121-2/+0
| | | | | | | | | | There is some similarity, but there's not really a logical way to combine the two that actually results in less, clearer code.
| * Lower and downgrade a TODO about StreamID and NonZeroU16.Nick Mathewson2023-10-121-1/+0
| |
* | tor-proto: Add a FIXME about an allowIan Jackson2023-10-121-0/+2
|/
* oneshot: Apply deferred rustfmt churnIan Jackson2023-10-113-3/+3
| | | | cargo fmt, precisely.
* oneshot: Use veneer in tor-protoIan Jackson2023-10-116-9/+15
|
* Merge branch 'refactor-kdf' into 'main'Nick Mathewson2023-10-032-15/+42
|\ | | | | | | | | tor-proto: Refactor the key derivation See merge request tpo/core/arti!1629
| * tor-proto: Refactor the key derivationEmil Engler2023-09-292-15/+42
| | | | | | | | | | | | | | | | | | | | | | | | This commit refactors the key derivation, by applying the following: - The spaghetti slice creation with the hard-to-read boundaries got replaced by a closure, which accepts a length, advances the seed slice by n bytes as a side-effect, and returns the just advanced bytes - The use of `.except` got replaced by an `.or`, with the use of the already existing `InvalidKDFOutputLength` error, thereby removing a potential panic (probably not reachable in runtime though) - The conversion from a slice to a `CircuitBinding` got moved into a `TryFrom` trait of the appropriate data structure
* | tor-proto: Fix clippy warning.Gabriela Moldovan2023-10-031-1/+1
|/
* Merge branch 'misc-upgrades' into 'main'Nick Mathewson2023-09-283-6/+4
|\ | | | | | | | | Upgrade several dependencies See merge request tpo/core/arti!1626
| * Remove direct dependency on generic-arrayNick Mathewson2023-09-283-6/+4
| | | | | | | | | | | | | | | | | | | | Instead of tying ourselves to a particular version of the generic-array crate, we now always use the version re-exported by our RustCrypto crates. This lets us avoid the possibility of version mismatch. (Originally I had planned to upgrade to generic-array 1.0, but then I found that we were not actually using it.)
* | tor-proto: Replace repeating pattern with fillEmil Engler2023-09-281-6/+2
|/ | | | | | | | | This commit replaces a repeating code pattern in the `set_digest` function for setting the 'Recognized' and Digest field to zero with a slice fillment. Besides this, it also adds comments explaining which fields are currently getting zeroized.
* tor-proto: Make allow_stream_requests() not return a ResultNick Mathewson2023-09-271-4/+4
| | | | | | | The function never yields anything but an `Ok`, so we can simplify its type. (Not a stable feature, so no semver entry needed)
* Merge branch 'pad_intro2' into 'main'Nick Mathewson2023-09-251-7/+41
|\ | | | | | | | | | | | | Accept and transmit padding in introduce2 plaintexts Closes #1031 See merge request tpo/core/arti!1602
| * Generate padding in Introduce1 messages.Nick Mathewson2023-09-181-7/+41
| | | | | | | | | | | | Closes #1031. This padding ensures that the introduction point doesn't learn the length of the plaintext being sent to the onion service.
* | hs_ntor: replace "32" with a const.Nick Mathewson2023-09-211-1/+1
| |
* | hs_ntor: rename get_{introduce,rendezvous}1_key_material.Nick Mathewson2023-09-211-6/+6
| |
* | hs_ntor: improve several comments.Nick Mathewson2023-09-211-3/+10
| |
* | hs_ntor: rename enc_key to dec_key in service code.Nick Mathewson2023-09-211-5/+5
| |