summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'stream_ctrl' into 'main'Nick Mathewson2023-05-243-1/+234
|\ | | | | | | | | | | | | Experimental new stream-ctrl feature Closes #847 See merge request tpo/core/arti!1198
| * Add "TODO RPC" notes around DataStreamCtrl per review.Nick Mathewson2023-05-242-0/+16
| |
| * proto: Add stream-status functionality to DataStreamCtrl.Nick Mathewson2023-05-241-2/+106
| | | | | | | | There are some weaknesses and problems here; see TODO notes.
| * proto: Create a `DataStreamCtrl` type.Nick Mathewson2023-05-223-1/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea here is that we want to make DataStream visible to the RPC system without requiring that the RPC session hold the DataStream itself (or the Reader, or the Writer). We could solve this problem by making _all_ the state in the DataStream shared, but that would introduce unnecessary extra locking in our critical path. Instead we're creating the notion of a "control handle" that lets you manage and observe a stream without actually owning the stream. Right now the only supported functionality is asking for the stream's circuit. Part of #847
* | proto: Make PathEntry::Virtual feature-conditional.Nick Mathewson2023-05-232-0/+3
|/ | | | | This fixes a warning when building tor-proto without the `rpc-common` feature.
* Merge branch 'virtual_hop' into 'main'Nick Mathewson2023-05-185-38/+245
|\ | | | | | | | | | | | | tor-proto: Add support for extending circuits through virtual hops. Closes #726 See merge request tpo/core/arti!1191
| * proto: Explain "virtual" hops better.Nick Mathewson2023-05-181-0/+4
| | | | | | | | Based on text from @diziet
| * proto: Try to improve the documentation in crypto/cell.rsNick Mathewson2023-05-181-24/+86
| |
| * proto: Allow circuit Paths to represent virtual hops.Nick Mathewson2023-05-183-14/+57
| | | | | | | | | | Sadly, this adds a few more `TODO HS` entries, but I think we can clean them up later after a bit of discussion.
| * proto: Implement Circuit::extend_virtual.Nick Mathewson2023-05-182-2/+59
| | | | | | | | | | | | | | There are a few new TODO hs comments, though, and an XXXX I'll need to fix up in the next commit. Implements #726.
| * tor-proto: Code to construct crypto layers for virtual hops.Nick Mathewson2023-05-183-1/+42
| | | | | | | | | | This is fairly straightforward, thanks to our existing design work on this code.
* | tor-guardmgr, tor-proto: minor logging tweakseta2023-05-181-2/+2
| | | | | | | | | | | | | | | | - We make the tor-guardmgr "We have found that {} is usable" line include the word "guard", otherwise it doesn't appear very useful to a user in safe logging mode, since the guard gets replaced with [scrubbed]. - The "Actually got an end cell..." message is downgraded to DEBUG.
* | hs_ntor: several documentation cleanups.Nick Mathewson2023-05-171-6/+14
| |
* | hs_ntor: make encrypt_and_mac take a typed public keyNick Mathewson2023-05-171-10/+6
| | | | | | | | This is still not the most beautiful interface, but it'll do for now.
* | hs_ntor: remove the last lingering AsRef<[u8]>Nick Mathewson2023-05-171-7/+7
| |
* | hs_ntor: Add a test vector case extracted from C tor.Nick Mathewson2023-05-171-0/+104
| |
* | hs_ntor: Calculate MAC on introduce1 message correctly.Nick Mathewson2023-05-171-3/+12
| | | | | | | | | | | | There were two bugs here that made the behavior unlike that of C tor: we had swapped the MAC inputs, and we had forgotten to include the public key X in the input.
* | hs_ntor: Make internal no-rng variants of the handshake functions.Nick Mathewson2023-05-171-2/+25
| | | | | | | | We'll want these so we can implement some test vectors.
* | hs_ntor: Move extra data outside of the "input" fields.Nick Mathewson2023-05-171-59/+33
| | | | | | | | | | | | | | I think that these Input structs had been defined so that we could use hs_ntor interchangeably with other handshakes. The trouble is, though, that it doesn't really work like any other handshakes we have.
* | hs_ntor: Use MAC implementation from tor-hscryptoNick Mathewson2023-05-171-35/+16
| | | | | | | | | | | | Note that some of the invocations for this function seem to put the key and the message in a questionable order. But that's a thing to figure out later, while debugging.
* | hs_ntor: Use correct PK types from tor_hscrypto.Nick Mathewson2023-05-171-20/+24
| |
* | hs_ntor: Use Subcredential type from tor-hscryptoNick Mathewson2023-05-171-4/+3
|/
* Merge branch 'arc_circ' into 'main'gabi-2502023-05-172-18/+22
|\ | | | | | | | | | | | | Refactor ClientCirc APIs to use Arc<ClientCirc>. Closes #846 See merge request tpo/core/arti!1187
| * Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-162-18/+22
| | | | | | | | | | | | | | | | | | | | | | | | Now ClientCirc is no longer `Clone`, and the things that need it to be `Clone` instead return and use an Arc<ClientCirc> We're doing this so that ClientCirc can participate in the RPC system, and so that its semantics are more obvious. Closes #846. Thanks to the type system, this was a much simpler refactoring than I had feared it would be.
* | Replace usage of KeyUnknownCert::check_key.Nick Mathewson2023-05-161-2/+2
|/
* Use non-deprecated *Secret::random_from_rng.Nick Mathewson2023-05-133-13/+13
| | | | The `new` function is deprecated in x25519-dalek 2.0.0-rc.2
* Change CircTarget::linkspecs() to return an encoded list.Nick Mathewson2023-05-102-7/+9
| | | | | | | | 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.
* async-utils: rename SinkExt to SinkPrepareExtNick Mathewson2023-04-191-1/+1
|
* tor-proto: Be explicit about an into().Nick Mathewson2023-04-121-1/+1
| | | | | | | This is a workaround for an issue that I'm about to encounter somewhere in our pile of dependencies as I add arti-rpcserver, and somehow make serde_json visible in this test code thereby, making the PartialEq method resolution ambiguous.
* Move functionality from tor_basic_utils to tor_async_utilsNick Mathewson2023-03-291-1/+1
| | | | | This commit is mostly code movement; I'd recommend reviewing it with git's `--color-moved` option.
* Add some missing importsIan Jackson2023-03-281-1/+4
| | | | | | | | Now nailing-cargo +stable clippy -p tor-hsclient --all-features --all-targets actually works. squash! Add some missing imports
* Add an experimental circuit accessor to DataStream.Nick Mathewson2023-03-232-2/+34
| | | | Closes #784.
* tor-proto: Feature-conditionalise some enum variantsIan Jackson2023-03-231-0/+6
| | | | This avoids some dead code warnings when building without send-control-msg.
* tor-proto: Split off send-control-msg featureIan Jackson2023-03-232-5/+5
|
* tor-proto: document deep-copy in ClientCirc::path()Nick Mathewson2023-03-221-0/+4
|
* proto: Stabilize ClientCirc::n_hops.Nick Mathewson2023-03-221-1/+6
|
* Fix a bunch of needless-conversion warnings.Nick Mathewson2023-03-101-1/+0
| | | | | Apparently 1.68 now warns when you call into_iter() on something that's already an iterator. Fair enough. Let's stop doing that.
* tor-proto: Document limitation on send_control_messageNick Mathewson2023-03-081-0/+7
|
* tor-proto: Say "control message" a little more consistentlyNick Mathewson2023-03-081-1/+2
| | | | | | | (I found "user request" in one place, and fixed that. I am not currently going to try to unify "control message" and "meta message" since both terms are misleading and we already have TODOs to try to merge them into a third better term.)
* tor-proto: Make send_control_message wait for the reactor.Nick Mathewson2023-03-082-5/+22
| | | | | This way we don't need to worry about race conditions that happen if the caller thinks that the handler is installed before it really is.
* tor-proto: Have send_control_message install a handler, not return a streamNick Mathewson2023-03-083-98/+73
|
* tor-proto: Implement functionality to send a message and accept repliesNick Mathewson2023-03-083-52/+159
| | | | | | | | | | | This new function combines "sending a message" and "accepting replies in a stream" into a single call, so that there is no gap between when the message is sent and the replies are available. There are a number of compromises here, in order to avoid API proliferation. I've tried to contain them as best I can. See comments for additional design discussion.
* tor-proto: Change semantics of MetaCellHandlerNick Mathewson2023-03-081-72/+126
| | | | | | | | | | | | | | | | | Now, the MetaCellHandler is responsible for consuming the messages it gets, and reporting status to whatever task is waiting for a status message. Additionally, the MetaCellHandler can decide to remain installed or shut down the circuit after a successful message. (Previously, it could only uninstall itself on success and kill the circuit on failure.) These changes will enable MetaCellHandlers to be used as the basis for handling more kinds of message. (There is some moved and reformatted code here; you may want to review it with `git {diff or show} --color-moved -b`.)
* tor-proto: Give Path a method to access final hop num.Nick Mathewson2023-03-082-10/+16
|
* tor-proto: Give circ Reactor a constructor, and make its fields private.Nick Mathewson2023-03-082-30/+48
|
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-284-8/+8
| | | | Fixes #756
* proto: Tweak documentation and names around CmdChecker.Nick Mathewson2023-02-275-9/+33
|
* tor-proto: Rename end_received.Nick Mathewson2023-02-172-8/+9
| | | | It can now indicate _any_ cell that means we can forget about a stream.
* Use CmdChecker in our stream handling code.Nick Mathewson2023-02-174-96/+92
| | | | | | | | | | This change makes sure that open streams and half-closed streams have the same stream-type-dependent state machines with respect to which cells are acceptable. Fixes #774. Fixes #769.
* tor-proto: Introduce CmdChecker, and define it for our streams.Nick Mathewson2023-02-174-0/+150
| | | | | | | | The role of CmdChecker is to verify that messages are arriving at the appropriate sequence on a stream, with respect to the other messages that have been received. Once the stream becomes half-closed, the CmdChecker is also in charge of consuming incoming messages on the stream and making sure that they are well-formed.