Commit Graph

5963 Commits

Author SHA1 Message Date
Ian Jackson 08ede75905 hsclient: Clarify period task handle TODO 2023-03-01 16:39:03 +00:00
Ian Jackson e6aa199da6 hsclient: Document sharing rules
Text largely from
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2881638
2023-03-01 16:39:03 +00:00
Ian Jackson cfa33e53d5 hsclient state: rustfmt
Autogenerated with rustfmt; no code changes.

This tidies up the bizarre formatting.
2023-03-01 16:39:03 +00:00
Ian Jackson 597601e4a3 hsclient state: Lots more doc comments about barriers, structure, etc. 2023-03-01 16:39:03 +00:00
Ian Jackson 0b39a180b0 hsclient state: Break `obtain` out into a fn
This is getting rather confusing; simply reformtting it won't do, I
think.  Also there would be much rightward drift.

So move the meat out into the new function.
(And introduce a convenience alias for its captures.)

Docs and reformatting will follow in a moment.
2023-03-01 16:39:03 +00:00
Ian Jackson a93a7b4bab hsclient state: Demonstrate that our future is now Send 2023-03-01 16:39:03 +00:00
Ian Jackson 1f03e118ef hsclient state: Restructure using a scope to drop the mutex guard
Explicit drops don't work.  Instead, introduce a scope.

We need two scopes, actually: one where we do the initial table
wrangling, and one for the retries after relock.

So we must put the meat in a closure so we can reuse it.
And we must return the flow control as an enum.  Bah, etc.

Avoid reformatting this for the moment.  This makes the delta legible...
2023-03-01 16:39:03 +00:00
Nick Mathewson 93a0b72105 tor-cell: Use a match when checking auth_key_type 2023-03-01 11:34:49 -05:00
Nick Mathewson dbecdb53aa tor_cell: Use nested readers and writers for EstablishIntro 2023-03-01 11:32:56 -05:00
Nick Mathewson c8cc4a80c3 tor-cell: tweak comments on EstablishIntro members. 2023-03-01 11:27:45 -05:00
Ian Jackson d1863c3178 hsclient state: Break out ServiceState::blank
We're going to have another function which will want this.
Leave a convenience closure to capture the runtime.
2023-03-01 16:27:19 +00:00
Ian Jackson 4f5f378516 hsclient state: Move error inspection before guard re-lock.
This is still correct from a lock hierarchy pov.  It moves the guard
relock to the end, which is going to be necessary since it is going to
have to move right outside the loop.
2023-03-01 16:27:19 +00:00
Ian Jackson 1e905763e3 hsclient keys: Add a todo to remove spurious Option 2023-03-01 16:27:19 +00:00
Ian Jackson 7134ddd454 hsclient keys: Compare all empty sets of keys as equal
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2881575
2023-03-01 16:27:19 +00:00
Ian Jackson 5da60ff72d hsclient keys: Fix non-equal keys test to provide a (dummy) key (fmt) 2023-03-01 16:27:19 +00:00
Ian Jackson ff55d7b133 hsclient keys: Fix non-equal keys test to provide a (dummy) key
We're about to fix the comparison to treat all empty key sets as
equal.
2023-03-01 16:27:19 +00:00
Ian Jackson e3e66793c4 hsclient keys: Provide :none() and Default and .is_empty() 2023-03-01 16:27:19 +00:00
Ian Jackson 896ea10b7f hsclient keys: Fix a missing full stop 2023-03-01 16:27:19 +00:00
Ian Jackson ab163cf81a hsclient state: Test most important code paths 2023-03-01 16:27:19 +00:00
Ian Jackson 8e088d72d5 hsclient: Provide some missing debug impls and trace messages 2023-03-01 16:27:19 +00:00
Ian Jackson 83b8eb7349 tor-hscrypto: Provide manual Debug impl for HsId
This is still not great, but it at least makes the output plausible to
read by eye.
2023-03-01 16:27:19 +00:00
Ian Jackson 288b7b6ad1 Apply rustfmt 2023-03-01 16:27:19 +00:00
Ian Jackson d384c3b475 hsclient state: Provide one test 2023-03-01 16:27:17 +00:00
Nick Mathewson 5131703c22 Introduce a constant for the length of the output of hs_mac() 2023-03-01 11:26:35 -05:00
Nick Mathewson b36082255b tor-bytes: Clarify that Cursor is not a good thing, and could be neater. 2023-03-01 11:21:52 -05:00
Ian Jackson d7602c5be4 hsclient: Use a generic to provide a mock for connect()
This will allow us to test state.rs.
2023-03-01 16:20:16 +00:00
Ian Jackson feab6faa9e tor-circmgr: Provide testing feature and TestConfig
Like the similar thing in tor-guardmgr.
2023-03-01 16:20:16 +00:00
Ian Jackson 9ebe22756e hsclient: Apply standard lint block 2023-03-01 16:20:16 +00:00
Ian Jackson ff1be04012 hsclient: Move dead code allows to specific locations 2023-03-01 16:20:16 +00:00
Ian Jackson b430c65ddb hsclient: Add vacuous comments as demanded by clippy 2023-03-01 16:20:16 +00:00
Ian Jackson bac3c4a9a4 hsclient state: Bind a variable to stop rustfmt doing a terrible thing 2023-03-01 16:20:16 +00:00
Ian Jackson 76a160d5a7 hsclient: Provide a constructor for HsClientConnector 2023-03-01 16:20:16 +00:00
Ian Jackson e8b5195281 hsclient: Implement connection attempt tracking state machine
This compiles, but it cannot work yet.  Nor can it conveniently be tested.
2023-03-01 16:20:16 +00:00
Ian Jackson 4ec9ec92bc HS secret keys: Move aggregate/config to tor-hsclient
Provide a more cookied "secret keys for use to connecting to a
particular HS" type, with a builder.

This wants to use config stuff, so oughtn't to be in tor-*crypto.
The individual types remain there.
2023-03-01 16:19:31 +00:00
Nick Mathewson 03df452f7b tor-cell: Rename EstablishIntro{Body => Details} 2023-03-01 11:18:50 -05:00
Ian Jackson 891782122d hsclient API: Remove notion of ambient keys fromk this layer 2023-03-01 16:18:09 +00:00
Ian Jackson a45acb3905 HS API: Remove HS client keys from circmgr API
*If* we're going to retain any HS knowledge in circmgr, it definitely
doesn't need to know about per-operation client secrets.

(Maybe there might be ambient secrets, used for .onion diversion, but
they don't need to be in this API.)
2023-03-01 16:18:09 +00:00
Ian Jackson feeb38c750 HS planning: Discuss whether to remove all HS code from circmgr 2023-03-01 16:18:09 +00:00
Ian Jackson 06e6e11886 HS planning: Intend for HS connector to do all lifecycle mgmt
Otherwise there has to be a state entry in the circmgr *and* a state
entry in the hs connector, for every HS.  This division of
responsibilit will be confusing.

The HS code will then be more completely just a layer on top of circmgr.
2023-03-01 16:17:47 +00:00
Ian Jackson bab32c6038 clarify results of misusing cursors 2023-03-01 15:57:14 +00:00
Nick Mathewson 1251796039 Merge branch 'more_hs_msgs' into 'main'
Implement most remaining HS cell types

See merge request tpo/core/arti!1038
2023-03-01 14:50:35 +00:00
Nick Mathewson 87d9dd6423 tor-netdoc: Clarify that we must indeed check cert expiration. 2023-03-01 09:49:17 -05:00
Nick Mathewson a4a305c1cf tor-netdoc: Validate inner certs in HsDesc
This makes our implementation behave the same as the C tor
implementation, by validating all of the expiration and signatures
on the certificates in the inner document.

(It is still not semantically necessary to check these certs: the
document in which they appear is already signed by the key with
which they are allegedly signed.)

Closes #744
2023-03-01 09:48:51 -05:00
Ian Jackson 333ce4118b Merge branch 'check_env' into 'main'
maint: add a full dependency check

See merge request tpo/core/arti!1030
2023-03-01 12:48:20 +00:00
Nick Mathewson 53e44b58f5 tor-cell: Fix compilation for fuzzers
(I also ran them a couple billion iterations, and didn't hit
any bugs.)
2023-03-01 07:39:17 -05:00
Nick Mathewson 8c9a1a6fad tor-cell: Make EstablishIntro do signatures
The old code parsed and encoded a signature and a mac... but there
was no way to actually set them properly.  Now EstablishIntro is
built around an EstablishIntroBody, and has the ability to check
signatures and macs.

Because there is no way to handle one of these messages if we can't
check the signature, we no longer accept unrecognized `auth_key` types
in this message.

I've added a test to make sure that we can validate a message from the
C tor implementation, and a test to make sure we can validate our
own cells.  I also had to modify the previous tests so that their
keys were well-formed.
2023-03-01 07:38:56 -05:00
Ian Jackson 22bb5bacc0 Merge branch 'main' into 'main'
Use humantime in tor-checkable and tor-guardmgr

Closes #663

See merge request tpo/core/arti!1037
2023-02-28 19:22:53 +00:00
Ian Jackson 7a1c4f54c9 Merge branch 'changes' into 'main'
Remove unnecessary warning from arti-hyper/README

See merge request tpo/core/arti!1042
2023-02-28 19:17:02 +00:00
Nick Mathewson 0f88c5131f tor-bytes: impl Readable and Writeable for CtByteArray. 2023-02-28 11:23:44 -05:00
Nick Mathewson d658fcfc52 Expose a little new functionality from tor-llcrypto.
Expose ED25519 signature length; make ValidatableEd25519Signature
implement Debug and Clone.
2023-02-28 11:23:44 -05:00