Commit Graph

6944 Commits

Author SHA1 Message Date
Nick Mathewson 0a4dac0fa0 hscrypto: remove compatibility note about time periods.
We updated and clarified the spec in arti!107, and noted the
remaining infelicities in proposal 342.
2023-06-13 12:20:12 -04:00
Nick Mathewson 44ced7dbd3 hscrypto: write a README 2023-06-13 12:15:04 -04:00
Nick Mathewson 848793da5a hscrypto: note that hs_mac is not a good choice for new protocols 2023-06-13 12:11:38 -04:00
Nick Mathewson 7a82285984 hscrypto: comment out an unused key type.
(I'm not removing it entirely since maybe we _should_ use it, and
maybe we _will_ as we do services.  I've added a TODO HS for
removing it or using it, and removed the TODO HS at the head of
pk.rs about making sure that all the key types in the module really
belong there.)
2023-06-13 12:01:12 -04:00
Ian Jackson 69a0efee03 CI: integration-chutney: Turn into a warning
This test is known to fail "when the load is high".  Recently I had to
press the "merge unverified changes" button to merge !1238, after four
consecutivew spurious failures.

IMO this is intolerable.
2023-06-13 16:56:10 +01:00
Nick Mathewson 9888c4422d hscrypto: Remove a TODO about extending an internal macro. 2023-06-13 11:53:29 -04:00
Ian Jackson cc7fd57511 Merge branch 'hs3' into 'main'
tor-hsclient: Plumb some needed values through etc.

See merge request tpo/core/arti!1238
2023-06-13 15:53:01 +00:00
Nick Mathewson 670c73a159 hscrypto: Remove a TODO about implementing ErrorKind.
I think it isn't actually a great idea for HsIdParseError to
implement ErrorKind, since the actual ErrorKind would depend
entirely on where the problematic ID came from.
2023-06-13 11:50:53 -04:00
Nick Mathewson 9311a8da5b hscrypto: clarify and downgrade TODOs about blinding secrets 2023-06-13 11:48:54 -04:00
Ian Jackson bfaf0bba6f tor-hsclient: Add some more debugging 2023-06-13 16:14:57 +01:00
Ian Jackson e123ade035 tor-hsclient: Return the circuit 2023-06-13 16:14:57 +01:00
Ian Jackson 57ba35dfe0 tor-hsclient: Conduct the INTRODUCE1 exchange 2023-06-13 16:14:57 +01:00
Ian Jackson ab11a2042f tor-hsclient: Remove an already-done TODO
Since !1238 we do pass the handshake_state along.
2023-06-13 16:14:57 +01:00
Ian Jackson f76b6eb614 tor-cell: IntroduceAck: Add .success() function to give a Result
The type is a bit odd but this is a result of the underlying protocol.
I don't feel like inventing `IntroduceAckSuccess` that contains only
the extensions.
2023-06-13 16:14:57 +01:00
Ian Jackson 0c10a9554b tor-hsclient: Rename some errors for greater consistency 2023-06-13 16:14:57 +01:00
Ian Jackson d98405d1e0 tor-hsclient: Reorder timeout errors to be "less interesting"
If something *other* than a timeout went wrong, then that is less
expected so more interesting.
2023-06-13 16:14:57 +01:00
Nick Mathewson c79ed2b31b tor-hsclient: Improve proto_oneshot docs 2023-06-13 16:14:06 +01:00
Ian Jackson b1ac10203a tor-hsclient: Pass handshake_state to complete_handcshake (fmt) 2023-06-13 16:14:03 +01:00
Ian Jackson 6810881f38 tor-hsclient: Pass handshake_state to complete_handcshake
Pass Introduced to complete_handshake.  The lack of this was a slip.
Add handshake_state to Introduced, and use it.
2023-06-13 16:13:57 +01:00
Nick Mathewson 40840b1f3a proto: Make sure that auth tags are truncated to 20 bytes
Onion service hops (pointlessly) use SHA3-256 for their
authentication, but they truncate it to 20 bytes (assuming I'm
reading the C right.)

See torspec#204 for clarification here.
2023-06-13 11:04:23 -04:00
Nick Mathewson 864ec4d3ff Merge branch 'fix' into 'main'
RPC: Suppress a warning to do with RPC and SOCKS

See merge request tpo/core/arti!1237
2023-06-13 13:20:19 +00:00
Ian Jackson 85273a7646 tor-hsclient: Add a missing doc
Requested in !1228 but overlooked
2023-06-13 13:22:27 +01:00
Ian Jackson 01259a560b tor-hsclient: Introduce proto_oneshot, to help with message handling (fmt) 2023-06-13 13:22:27 +01:00
Ian Jackson 0dcf872e3a tor-hsclient: Introduce proto_oneshot, to help with message handling
This gets rid of a lot of repeated `oneshot::<...<Result, ...>>` and
a bit of repeated functional code, etc.
2023-06-13 13:22:27 +01:00
Ian Jackson 1587c06790 tor-hsclient: (try to) receive the RENDEZVOUS2 message 2023-06-13 13:00:19 +01:00
Ian Jackson 5d49660e0a RPC: Suppress a warning to do with RPC and SOCKS
Fixes `cargo check`
2023-06-13 12:11:23 +01:00
Ian Jackson 880095356e tor-hsclient: Fix a botched doc comment 2023-06-13 12:00:56 +01:00
Ian Jackson 78de0d279c Merge branch 'msg_in_handler' into 'main'
proto: Convert MsgHandler API to expect a message, not a cell.

Closes #887

See merge request tpo/core/arti!1236
2023-06-13 10:57:01 +00:00
Nick Mathewson beecf3c92c proto: Convert MsgHandler API to expect a message, not a cell.
Closes #887.
2023-06-12 14:55:26 -04:00
Nick Mathewson 47b1083d3a Merge branch 'rpc_pseudomethods_v6' into 'main'
RPC: Functionality to downcast dyn Object to a dyn Trait.

See merge request tpo/core/arti!1225
2023-06-12 18:10:46 +00:00
gabi-250 5480035f51 Merge branch 'desc-validation-err-doc' into 'main'
tor-error: Document another potential cause for OnionServiceDescriptorValidationFailed.

See merge request tpo/core/arti!1215
2023-06-12 18:03:06 +00:00
Nick Mathewson 65f43f3337 Merge branch 'intro_sketch' into 'main'
hsclient: fill in a bunch of introduce/rendezvous logic

See merge request tpo/core/arti!1235
2023-06-12 17:46:50 +00:00
Nick Mathewson 8166a29746 RPC: Functionality to downcast dyn Object to a dyn Trait.
This is a rather tricky piece of functionality.  It works as
follows.

We introduce a `CastTable` type.  Each `CastTable` tells us how to
downcast `dyn Object` for objects of a single concrete type.
The `Object` type now has a `get_casttable` method that returns
an empty `CastTable` by default.

`CastTable` is, internally, a map from the `TypeId` of the target
dyn Trait reference type to a function
`fn(&dyn Object) -> &dyn Trait`.  These functions are stored as
`Box<dyn Any + ...>`.  (They are Boxed because they may refer to
generic functions, which you can't get a static reference to,
and they're Any because the functions have different types.)

The `decl_object!` macro now implements `get_casttable` as
appropriate.  (The syntax is a bit janky, but that's what we get
for not using derive_adhoc.)  For non-generic types, `get_casttable`
uses a Lazy<CastTable>`. to initialize a CastTable exactly once.
For generic types, it use a `Lazy<RwLock<HashMap<..>>` to
build one CastTable per instantiation of the generic type.

This could probably be optimized a bit more, the yaks could be
shaved in a more scintillating hairstyle, and the syntax for
generic `decl_object` could definitely be improved.
2023-06-12 13:35:28 -04:00
Gabriela Moldovan 44fca4c2ca
tor-error: Clarify what we mean by "hostile".
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-06-12 18:25:50 +01:00
Gabriela Moldovan de8ca98900
tor-error: Document another potential cause for OnionServiceDescriptorValidationFailed.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-06-12 18:25:46 +01:00
Nick Mathewson 255d74ac3c hsclient: fill in a lot more introduce/rendezvous logic.
This code tries to fill in some TODO HS code, replacing it with a
lot more code with a bunch more TODO HS comments.  Hopefully the
expansions of the new TODO HS comments should be simpler.
2023-06-12 13:15:59 -04:00
Nick Mathewson 2c8e3b22b5 cell: Add an accessor for the body of a Rendezvous2. 2023-06-12 13:15:59 -04:00
Nick Mathewson f78c5a5a42 proto: Add a commment about a problem in my hs_ntor plans.
I am pretty sure that C tor works around this somehow; we should
figure out how!
2023-06-12 13:15:59 -04:00
Nick Mathewson c38ba16a81 proto: code movement and reindentation in hs_ntor 2023-06-12 13:15:59 -04:00
Nick Mathewson 7255b122d7 proto: Remove now-unused hs_ntor APIs 2023-06-12 13:15:59 -04:00
Nick Mathewson bb6115103a proto: refactor hs_ntor to reuse state.
We want the ability to send the same handshake request in parallel
on multiple introduce circuits.  This implies encoding the client
handshake more than once.

(Sadly we can't _actually_ do this in the protocol as it stands,
since the onion service can use a separate KP_hss_ntor for each
introduction point; I'll add a comment to that effect later.)
2023-06-12 13:15:59 -04:00
Nick Mathewson edfb3642e0 hsclient: receive rendezvous2 messages too. 2023-06-12 13:15:59 -04:00
Nick Mathewson 32d54c857e hsclient: Move the body of the msg handler into a new function 2023-06-12 13:15:59 -04:00
Nick Mathewson e948116bc7 hsclient: Add a second oneshot to Rendezvous msghandler
On a client's circuit to the rendezvous point, we need to first wait
for an `RENDEZVOUS_ESTABLISHED` message, and then for a
`RENDEZVOUS2` message.
2023-06-12 13:15:59 -04:00
Nick Mathewson 796dc4457b hsclient: use hs-client feature in tor-proto. 2023-06-12 13:15:59 -04:00
Nick Mathewson ac90cb7500 Upgrade async-trait requirement to 1.54
We need the fix from [82d69902], which first appeared in async-trait
version 1.54.  (Technically we only need this fix in tor-hsclient,
but we may as well update our minimal async-trait version everywhere.)

[82d69902]: 82d6990253
2023-06-12 13:15:59 -04:00
Nick Mathewson 3b93cdb2dd Merge branch 'redactable_relayids' into 'main'
Implement Redactable for RelayIds, and other improvements

Closes #882

See merge request tpo/core/arti!1233
2023-06-12 16:06:11 +00:00
Nick Mathewson ddea524849 linkspec: cleanup usage; change std::fmt to fmt. 2023-06-12 11:39:45 -04:00
Nick Mathewson 345808322d Merge branch 'circuit_send_message_fixes' into 'main'
Correct documentation and API on ClientCirc::send_control_message

Closes #885 and #881

See merge request tpo/core/arti!1232
2023-06-12 14:14:32 +00:00
Ian Jackson da78c53e20 Merge branch 'arc_hsdirs_in_netdir' into 'main'
netdir: Wrap HsDir an Arc<>

Closes #883

See merge request tpo/core/arti!1234
2023-06-12 13:56:44 +00:00