summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
* | | tor-bytes: Error::Truncated: mark the deficit as SensitiveIan Jackson2024-09-102-1/+7
| | | | | | | | | | | | | | | Suggested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2390#note_3072975
* | | tor-bytes: Add a deficit field to Error::Truncated (fmt)Ian Jackson2024-09-102-2/+6
| | |
* | | tor-bytes: Add a deficit field to Error::TruncatedIan Jackson2024-09-109-14/+23
| | | | | | | | | | | | This will allow us to fix #1592, but it doesn't do so yet.
* | | 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-104-21/+36
| | | | | | | | | | | | | | | | | | | | | | | | 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-bytes: Document Readable::take_from correctness propertiesIan Jackson2024-09-101-0/+29
| | | | | | | | | | | | | | | | | | This refers to the `deficit` field in Error::Truncated, which is going to appear in a later commit. It seems kinder to my reviewer to add this doc now early in the branch.
* | | tor-linkspec: reading tests: Use assert_eqIan Jackson2024-09-101-6/+6
| | | | | | | | | | | | | | | | | | | | | Error::Truncated is going to become more complicated, and anyway it would be nice to print the values if the test fails. Error is PartialEq now. (Maybe it wasn't when this was written?)
* | | tor-bytes: advance: Call peek for the error checkIan Jackson2024-09-101-3/+1
| |/ |/| | | | | | | This removes one construction site of Error::Truncated. We are about to make constructing one of those more fiddly.
* | Merge branch 'relay-err' into 'main'David Goulet2024-09-095-5/+124
|\ \ | | | | | | | | | | | | arti-relay: add and use `Error`/`ErrorDetail` See merge request tpo/core/arti!2392
| * | arti-relay: add and use `Error`/`ErrorDetail`Steven Engler2024-09-054-4/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of this is copied from `arti_client::err`, but with a lot of stuff removed to simplify the error types (for example no `error_detail` feature handling). I tried to keep things generally consistent with arti-client so that error handling will be similar in both crates. `TorRelayBuilder::create()` will likely need to be fallible in the future (for example if spawning a task for the OR port listener fails), so it now returns a `Result<TorRelay, crate::err::Error>` instead of just a `TorRelay`.
| * | arti-client: minor documentation grammar fixSteven Engler2024-09-051-1/+1
| | |
* | | Merge branch 'pr/arti/keymgr/use-keypairs-if-available' into 'main'gabi-2502024-09-0914-24/+129
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | eliminate all but one use of `KeyMgr::get::<HsIdKeypair>()` Closes #1194 See merge request tpo/core/arti!2393
| * | rename get_keypair_specifier() to keypair_specifier()Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-094-8/+8
| | | | | | | | | | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2393#note_3073480
| * | tor_hsservice use get::<HsIdKey> rather than get::<HsIdKeypair>Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-094-22/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three places where we query the KeyMgr for an `HsIdKeypair` but all we really need is the public part. This commit changes those three callsites to instead use `get::<HsIdKey>`. This relies on the previous commit, which makes sure that a request for an `HsIdKey` will always succeed if the keystore has a `HsIdKeypair` with the same service nickname.
| * | tor_keymgr: teach the KeyStore how to satisfy public key requests using a ↵Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | keypair Now that: - KeySpecifier::get_keypair_specifier() can be used to convert the KeySpecifier for a public key into the KeySpecifier for its secret key - ToEncodableKey<Key=PublicKey> has a "type level pointer" to ToEncodableKey<Key=KeyPair> We can use these two features together to automatically satisfy any request to get a public key using the corresponding secret key (if available).
| * | tor_key_forge::traits::ToEncodableKey: add KeyPair associated typeAdam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-093-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This comment adds a second associated type `KeyPair` to ToEncodableKey. For a `ToEncodableKey` which represents a (secret) KeyPair, this type is Self. For a `ToEncodableKey` which represents a public key, this is the `ToEncodableKey` whose `Key` is the pair of which this is the public part. This is essentially a "type level pointer" from the ToEncodableKey for a public key to the ToEncodableKey for its secret key.
| * | tor_keymgr: add get_keypair_specifier() to KeySpecifier, and derive itAdam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-096-0/+35
| | | | | | | | | | | | | | | | | | | | | This commit adds a new method `get_keypair_specifier()` to `KeySpecifier`. This method is used to indicate when one KeySpecifier (e.g. `KP_hs_id`) is the public part of another keypair (e.g. `KS_hs_id`). It will return the containing keypair in this case, and `None` otherwise.
| * | tor_hsservice: add `impl From<&FooPublicKeySpecifier> for ↵Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-094-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FooKeypairSpecifier` instances This adds the following trivial `From` instances: - tor_hsservice: impl From<&HsIdPublicKeySpecifier> for HsIdKeypairSpecifier - tor_hsservice: impl From<&BlindIdPublicKeySpecifier> for BlindIdKeypairSpecifier - tor_hscrypto::pk: impl From<HsBlindIdKeypair> for HsBlindIdKey - tor_llcrypto::pk::ed25519: impl From<ExpandedKeypair> for PublicKey - tor_keymgr::mgr: impl From<TestKey> for TestPublicKey - tor::hscrypto::pk: impl From<HsIdKeypair> for HsIdKey
* | | Add a TODO RPC call about revising/moving documentationNick Mathewson2024-09-091-0/+6
| | |
* | | Re-run cbindben for new warnings and status codesNick Mathewson2024-09-092-43/+16
| | |
* | | Add TODO for renaming connect.rs to streams.rsNick Mathewson2024-09-091-0/+4
| | |
* | | socksproto: Add a const for suggested buffer length.Nick Mathewson2024-09-094-5/+12
| | | | | | | | | | | | | | | Ticket #1509 will probably get rid of this constant, but for now we may as well put it in one place.
* | | rpc: More specificity surrounding SOCKS-rpc integrationNick Mathewson2024-09-093-5/+57
| | |
* | | Suggestion about describing non-RPC behavior of SOCKS protocol from @diziet.Nick Mathewson2024-09-091-1/+3
| | |
* | | rpclib: testing for future-proof proxyinfo formatNick Mathewson2024-09-091-9/+65
| | | | | | | | | | | | | | | Here we make sure that we can actually skip over other proxy formats in the future.
* | | arti/rpclib: Tweak proxy_info format.Nick Mathewson2024-09-093-8/+11
| | | | | | | | | | | | | | | | | | | | | Renamed address to tcp_address, and made it optional, so that later we can have a unix_path, etc. On deser side, add support for unrecognized listener types.
* | | arti/rpclib: Lowercase our socks5 listener variant.Nick Mathewson2024-09-092-0/+2
| | |
* | | rpclib: New error type for unauthenticated connectionsNick Mathewson2024-09-092-2/+16
| | | | | | | | | | | | | | | | | | This is done so that we can make "not authenticated" a non-internal error, under the theory that someday unauthenticated connections might be exposed.
* | | arti: Add a comment explaining how RPC and SOCKS interactNick Mathewson2024-09-091-0/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | This belongs in a spec, but adding things to a spec is slow and fraught. Instead we'll put it here for now and move it later. There are some XXXXs about "finalizing" the design that we need to resolve before we can merge !2373 and implement stream creation in `arti-rpc-client-core`.
* | | arti: add and document get_rpc_proxy_info method.Nick Mathewson2024-09-091-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | Currently this behaves the same as get_proxy_info, but this may change in the future, if we introduce RPC-unsuitable proxy ports. (Also rename the get_proxy_info method to avoid x_ prefix.)
* | | rpclib: FFI for opening data streams.Nick Mathewson2024-09-0911-7/+408
| | | | | | | | | | | | | | | There's a blocking TODO here about exposing socks error codes that I still need to solve.
* | | rpclib: Support opening a data stream.Nick Mathewson2024-09-096-5/+341
|/ / | | | | | | | | | | Requires #1523. Implements #1524.
* / arti: Temporarily disable a flaky test.Ian Jackson2024-09-051-0/+1
|/ | | | | | | | This effectively reverts 71e3d52f5aeb34ca7bca80053079a8c7505b99ac, which was itself a revert of disabling this test the first time. Sadly it still doesn't seem to be reliable. We have agreed on IRC to disable it for now.
* Merge branch 'slow-test' into 'main'Ian Jackson2024-09-051-2/+15
|\ | | | | | | | | | | | | arti: Make the config watcher debounce interval configurable. Closes #1589 See merge request tpo/core/arti!2387
| * arti: Make the config watcher debounce interval configurable (fmt).Gabriela Moldovan2024-09-041-1/+9
| |
| * arti: Make the config watcher debounce interval configurable.Gabriela Moldovan2024-09-041-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the `reload_cfg::test::watch_multiple` test would take about 3s to run. This test modifies 3 files and waits for the corresponding `reconfigure()` events to fire. Because of the `sleep(DEBOUNCE_INTERVAL)` in `run_watcher`, it would wind up waiting for about 1s for each of them. This makes the event debouncing optional, and disables it in the tests. Closes #1589
* | Rename tor-keys crate to tor-key-forgeDavid Goulet2024-09-0420-21/+23
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | tor-keys: Use CryptoRng instead of the Core oneDavid Goulet2024-09-042-5/+5
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | doc: Fix unresovled links in the commentsDavid Goulet2024-09-042-7/+7
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | tor-keymgr: Use tor-keys crate and remove dead codeDavid Goulet2024-09-0416-845/+57
| | | | | | | | | | | | | | | | | | | | | | Everything copied in the previous commits to tor-keys is now removed and tor-keys crate is used accross the code. Minor changes to tor-keys to accomodate this change. Part of #1137 Signed-off-by: David Goulet <[email protected]>
* | tor-keys: Move HS crypto keys impl from tor-keymgrDavid Goulet2024-09-042-1/+109
| | | | | | | | | | | | | | | | | | | | As stated in the comment added in this commit, this is temporary as we want tor-hscrypto to start using tor-keys and define these implementation there. Part of #1137 Signed-off-by: David Goulet <[email protected]>
* | tor-keys: Copy several types/traits from tor-keymgrDavid Goulet2024-09-047-8/+761
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move EncodableKey, ToEncodableKey and Keygen to tor-keys crate from tor-keymgr. To pull this off, an err.rs was added taken from tor-keymgr but stripped down to what was needed only. No code was changed in any of the files copied from tor-keymgr. Our deftly macro now auto implement these traits for the key wrapper type created. This gives the ability of the wrapper to be used by a tor-keymgr::Keystore. In order to pull this off, most of the SSH code has been moved into this crate (ssh.rs) meaning that its ABI/API now resides in the tor-keys trait outside of tor-keymgr. Note that Sealed was not put back because the deftly macro is designed to be used outside of this crate and thus implementing EncodableKey. The alternative is that we would need to force all arti keys to be declared in this crate which is not great because it then exposes all these key types to the world outside their subsystem. Part of #1137 Signed-off-by: David Goulet <[email protected]>
* | tor-keys: Add NOTE for future featuresDavid Goulet2024-09-041-0/+4
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | tor-keys: Fix the doc testDavid Goulet2024-09-041-20/+19
| | | | | | | | | | | | | | Some object use path where put explicitly in order to avoid the macro user to need to import "ed25519" module. Signed-off-by: David Goulet <[email protected]>
* | tor-keys: Automatically implement keymgr traitDavid Goulet2024-09-043-78/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The derive ed25519 keypair macro now implements the keymgr trait so the key wrapper can now be used with a keystore without needing to specify it in the tor-keymgr crate. For this to work, a slight change to the KeygenRng trait was needed as in to expect the CryptoRngCore trait which is what ed25519-dalek requires. And also, the removal of the Sealed trait since now it is accepted to implement these traits outside tor-keymgr. Fixes #1137 Signed-off-by: David Goulet <[email protected]>
* | tor-keys: New crate for Tor key declarationDavid Goulet2024-09-044-0/+283
| | | | | | | | | | | | | | | | | | | | At this commit, we also add a derive-deftly macro for ed25519 keypair along a helper macro that can define a wrapper around a lower-level ed25519::Keypair. Part of #1137 Signed-off-by: David Goulet <[email protected]>
* | Merge branch 'semver' into 'main'Jim Newsome2024-09-042-3/+0
|\ \ | | | | | | | | | | | | Remove semver.md files. See merge request tpo/core/arti!2385
| * | Remove semver.md files.Gabriela Moldovan2024-09-042-3/+0
| | | | | | | | | | | | The 1.2.7 release is out so we won't be needing these anymore.
* | | Merge branch 'reload-cfg-test' into 'main'David Goulet2024-09-041-2/+4
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | arti: Write the test config atomically. Closes #1549 See merge request tpo/core/arti!2375
| * | Revert "arti: Temporarily disable a flaky test."Gabriela Moldovan2024-08-291-1/+0
| | | | | | | | | | | | This reverts commit ececf6be2eaffc201666cd3413dc19c025be66de.