Commit Graph

7200 Commits

Author SHA1 Message Date
Gabriela Moldovan 1fe15c5012 llcrypto: Document ed25519->curve25519->ed25519 conversion behaviour. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan 47606ad881 llcrypto: Implement ed25519_to_curve25519_private conversion.
In `ArtiNativeKeyStore`, private keys are stored in OpenSSH format.
However, `ssh-key` (the crate we use for parsing OpenSSH keys) doesn't
support x25519 keys. As a workaround, this type of key will stored
as ed25519 and converted to x25519 upon retrieval.

This commit implements the `convert_ed25519_to_curve25519_private`
conversion function (needed by `ArtiNativeKeyStore` to support x25519
keys).

Part of #900
2023-06-27 19:23:42 +01:00
Gabriela Moldovan 58a4cc3000 llcrypto: Add missing docs for hsv3-service feature flag. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan 6dfcf40d20 keymgr: Add regression test for tor_keymgr::Error recursion bug. 2023-06-27 19:22:30 +01:00
Gabriela Moldovan a41c3a5c7c keymgr: Fix infinite recursion in Error impl.
The `source` impl `tor_keymgr::Error` was just calling itself
recursively.
2023-06-27 19:22:30 +01:00
Nick Mathewson dd7b965199 Merge branch 'revert_to_x25519_pre1' into 'main'
Back down x25519-dalek to 2.0.0-pre.1 from 2.0.0-rc.2

Closes #926

See merge request tpo/core/arti!1317
2023-06-27 18:16:38 +00:00
pinkforest 4be2e3ce0f Back down x25519-dalek to 2.0.0-pre.1 from 2.0.0-rc.2
=========================
Notes from nickm:

(This differs from pinkforest's original MR: It removes the
Cargo.lock changes and the version bump on tor-llcrypto.)

Minimal Cargo.lock changes from downgrade.

(These are exactly those changes generated by running "build" and
"test".)

There are several reasons to do this:

  * It's best to bump all of our dalek dependencies at once to rc.3
    or later, rather than the piecemeal approach we've been stuck
    with so far.

  * We don't want to do this bump right now, since there are some
    tricky questions about clamping we need to figure out (see
    #808), and we need to make sure we get them right, and we're in
    a distracted this week.

  * We _do_ need to move away from 2.0.0-rc.2 right now, since
    it was causing a failure in `cargo install arti`, and then it
    got yanked.

Thanks to pinkforest for helping us out here and explaining all of
this!

Fixes #926.

Commit-edited-by: Nick Mathewson <nickm@torproject.org>
2023-06-27 13:55:24 -04:00
Nick Mathewson 7b0370c9e0 Merge branch 'chanmgr-doc' into 'main'
Add Channel expiry info in ChanMgr docs

See merge request tpo/core/arti!1316
2023-06-27 15:14:05 +00:00
Saksham Mittal d6626acd65
Add Channel expiry info in ChanMgr docs 2023-06-27 18:24:56 +05:30
gabi-250 c3a0096b61 Merge branch 'race' into 'main'
tor-hsclient: Fix test race

Closes #923

See merge request tpo/core/arti!1308
2023-06-26 17:37:58 +00:00
Ian Jackson 062b7e7ced tor-hsclient: Increase some timeouts
1. Fix a use of 10ms that should have been TIMEOUT_SLOP.
2. Increase BODGE_YIELD by a factor of 5.

Now this test should tolerate being hung up for 125ms.  I am hoping
that this will fix the CI failure
  https://gitlab.torproject.org/Diziet/arti/-/jobs/302457
which fails at the line comparing circuit1 with circuit2a.
(I can't repro that locally.)
2023-06-26 17:57:33 +01:00
Ian Jackson e5c4551993 tor-hsclient: test: Introduce some constants for timings 2023-06-26 17:57:33 +01:00
Ian Jackson c8d1cdded7 tor-hsclient: test: Add another sleep for expiry task *start*
Without this, the expiry task can end up choosing a 600s timeout
starting *after we advanced the clock*.

Fixes #923
2023-06-26 17:55:10 +01:00
Ian Jackson 355e65003c tor-hsclient: impl Debug by hand for MockCirc
The provided impl for Mutex is hopeless: it prints just some internal
flags and doesn't acquire the mutex for printing purposes.

At some point we might want to factor this out as a general function
on `Arc<Mutex<...>>` but not now.
2023-06-26 17:55:10 +01:00
gabi-250 639efe65f6 Merge branch 'send_sync_torclientbuilder' into 'main'
arti-client: Mark DirProviderBuilder Send+Sync;

Closes #924

See merge request tpo/core/arti!1307
2023-06-26 15:51:37 +00:00
Nick Mathewson 09e4676a99 Also require that TorClientBuilder be Sync. 2023-06-26 10:58:48 -04:00
Nick Mathewson 357f8ebf8d Merge branch 'netdoc-todos-again' into 'main'
netdoc: Resolve nearly all remaining TODO HS items.

See merge request tpo/core/arti!1304
2023-06-26 14:55:27 +00:00
gabi-250 dece1bec6c Merge branch 'upgrade-itertools' into 'main'
Upgrade to itertools 0.11.0

See merge request tpo/core/arti!1306
2023-06-26 14:42:02 +00:00
Nick Mathewson 5f0855f3df netdoc: remove final TODO HS
Although this Errorkind is not perfect, it is good enough.
2023-06-26 09:57:26 -04:00
Nick Mathewson 83fbae201d netdoc: Downgrade TODO on EncryptedHsDesc::decrypt 2023-06-26 09:57:26 -04:00
Nick Mathewson 0933937567 netdoc: Remove "decrypted_with_id" as meaningless
Actually, never mind about adding an accessor here: this value was
set incorrectly and didn't match its documentation.  As such it's
basically useless, and we might as well throw it out.
2023-06-26 09:57:26 -04:00
Nick Mathewson 6313f0513e netdoc: Remove dead_code exception; add accessors.
This commit removes some actual dead code and additionally adds some
minimal accessors to HsDesc to expose some of its properties.  (I'm
trying to keep these minimal since it's not yet clear whether we
want to expose more detail here.)

Here we also make StoredHsDescMeta a conditional type that's only
present when the new "hs-dir" feature is enabled.  Neither relays
nor clients need this: Only HsDirs will need it, when we finally
implement relays.
2023-06-26 09:57:26 -04:00
Nick Mathewson 30124acbc5 arti-client: Mark DirProviderBuilder Send+Sync;
Doing this causes TorClientBuilder to become Send.  I also add a
test to ensure that TorClientBuilder remains Send in the future.

This isn't a semver break, but only because DirProviderBuilder is
marked with `experimental-api`.

Closes #924
2023-06-26 09:49:56 -04:00
Ian Jackson b31a253931 Merge branch 'data' into 'main'
tor-hsclient: Expire old IPT and HS descriptor data eventually

See merge request tpo/core/arti!1290
2023-06-26 13:45:15 +00:00
Nick Mathewson 2f513fd82d netdoc: Note new feature in itertools 2023-06-26 09:41:34 -04:00
gabi-250 46b65a91d3 Merge branch 'keymgr-error-trait' into 'main'
keymgr: Create a KeystoreError trait for the `KeyMgr` and `KeyStore`s

See merge request tpo/core/arti!1284
2023-06-26 13:38:19 +00:00
Nick Mathewson 0bffdf23a4 Upgrade to itertools 0.11.0
The breaking changes here do not seem to affect us.
2023-06-26 09:30:54 -04:00
Ian Jackson 8a707bef85 tor-hsclient: Split out expire_old_data function
As per discussion in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915679
2023-06-26 13:45:57 +01:00
Nick Mathewson c653a8ce89 netdoc: change a TODO HS about a distinguisher to a NOTE.
(We explicitly do not care if Arti can be distinguished from C tor.)
2023-06-26 08:45:06 -04:00
Nick Mathewson 69dcacd69b netdoc: replace a test TODO with a reference to other tests
The tests called for here already existed.
2023-06-26 08:45:06 -04:00
Nick Mathewson f4a4c11627 proto: Remove support for receiving unauthenticated SENDMEs
We haven't generated these since Tor 0.3.5, which is no longer
supported on the network.

Closes #914.
2023-06-26 08:38:24 -04:00
Ian Jackson cccf6309d8 tor-hsclient: Add a comment about what run_housekeeping does
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915679
2023-06-26 13:23:41 +01:00
Ian Jackson e588f4be72 tor-hsclient: Add a debug message about task exit
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915678
2023-06-26 13:23:41 +01:00
Gabriela Moldovan b3b4abcf90 keymgr: Document why we need the StdError impl for tor_keymgr::Error. 2023-06-26 13:16:58 +01:00
Gabriela Moldovan a1dbec79bd keymgr: Remove AsRef<dyn StdError> trait bound and unneeded impls.
We don't really need the `AsRef<dyn StdError>` impls if we make
`StdError` a supertrait of `KeystoreError` (and remove the `AsRef<dyn
StdError>` trait bound).
2023-06-26 13:16:58 +01:00
Gabriela Moldovan de0f662fb6 keymgr: Add the file path to SshKeyError context. 2023-06-26 13:16:04 +01:00
Gabriela Moldovan 60036b3cc3 keymgr: Add the path to ArtiNativeKeystoreError Display impl. 2023-06-26 13:16:04 +01:00
Gabriela Moldovan 85305e156f keymgr: Replace Error with Box<dyn KeystoreError>.
Part of #901
2023-06-26 13:16:03 +01:00
Ian Jackson e5e4cf65f7 tor-hsclient: Comment explaining why no launch_background_tasks
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915676
2023-06-26 13:15:22 +01:00
Ian Jackson 09ae0aed4a tor-hsclient: Say we *mustn't* do housekeeping while dormant
This is a change to the API docs, but not to the actual code, since
our call site is in arti-client and tied to netdir fetch,
which *doesn't* happen when dormant.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915677
2023-06-26 13:14:17 +01:00
Gabriela Moldovan 4870c2e7d9 keymgr: Add helper for boxing SshKeyError. 2023-06-26 13:13:44 +01:00
Gabriela Moldovan 74f41fd7f3 keymgr: Implement KeystoreError for SshKeyError. 2023-06-26 13:13:43 +01:00
Gabriela Moldovan 165b1060ef keymgr: Add some initial variants to SshKeyError. 2023-06-26 13:13:16 +01:00
Gabriela Moldovan a5b8291ca9 keymgr: Define an error type for the ssh module. 2023-06-26 13:13:16 +01:00
Gabriela Moldovan 158255b827 keymgr: Define an error type for ArtiNativeKeyStore.
Part of #901
2023-06-26 13:13:16 +01:00
Gabriela Moldovan fe929d8efe keymgr: Implement KeystoreError for Bug.
This also implements `AsRef<StdError>` for `Bug` to satisfy the
`KeystoreError: AsRef<dyn StdError>` trait bound.

Part of #901
2023-06-26 13:13:16 +01:00
Gabriela Moldovan 7c023f2ec2 keymgr: Create a KeyStoreError trait for keystore errors.
The new `BoxedError` type will replace `tor_keymgr::Error`.

Part of #901
2023-06-26 13:13:15 +01:00
Nick Mathewson 08d1155cb9 Merge branch 'stabilize-ll-crates' into 'main'
Remove final "experimental" status from tor-hscrypto and tor-error.

See merge request tpo/core/arti!1291
2023-06-23 21:09:11 +00:00
Nick Mathewson 9e3e683e1b arti, hsclent: remove dependencies on tor-error/experimental-api
The relevant ErrorKinds and macros are now stable.
2023-06-23 12:49:46 -04:00
Nick Mathewson 7510f52eea hscrypto: remove "tor-error/experimental-api" dependency
The ErrorKinds that we use here are now non-experimental.
2023-06-23 12:49:46 -04:00