Commit Graph

6749 Commits

Author SHA1 Message Date
Nick Mathewson d008c385d5 hs_ntor: several documentation cleanups. 2023-05-17 16:18:55 -04:00
Nick Mathewson 954b41dcf1 hs_ntor: make encrypt_and_mac take a typed public key
This is still not the most beautiful interface, but it'll do for now.
2023-05-17 16:18:55 -04:00
Nick Mathewson 50ce084d64 hs_ntor: remove the last lingering AsRef<[u8]> 2023-05-17 16:18:55 -04:00
Nick Mathewson a6fd8fb347 hs_ntor: Add a test vector case extracted from C tor. 2023-05-17 16:18:55 -04:00
Nick Mathewson 20d6c4b247 hs_ntor: Calculate MAC on introduce1 message correctly.
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.
2023-05-17 16:18:55 -04:00
Nick Mathewson 1f665d1144 hs_ntor: Make internal no-rng variants of the handshake functions.
We'll want these so we can implement some test vectors.
2023-05-17 16:18:55 -04:00
Nick Mathewson ceaeb61168 hs_ntor: Move extra data outside of the "input" fields.
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.
2023-05-17 16:18:55 -04:00
Nick Mathewson 54665c2b65 hs_ntor: Use MAC implementation from tor-hscrypto
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.
2023-05-17 16:18:55 -04:00
Nick Mathewson c8ad9450c2 hs_ntor: Use correct PK types from tor_hscrypto. 2023-05-17 16:18:55 -04:00
Nick Mathewson 9d5dd813c0 hs_ntor: Use Subcredential type from tor-hscrypto 2023-05-17 16:18:55 -04:00
Nick Mathewson a6ad49b22b cell: extract introduce headers into a new type.
We'll want this because our hs_ntor handshake requires access to an
encoded version of the header independent from the actual encrypted
message.

part of #866.
2023-05-17 11:06:28 -04:00
gabi-250 ac0eb05a07 Merge branch 'info-to-warn' into 'main'
Change log levels of messages from INFO to others

Closes #854

See merge request tpo/core/arti!1172
2023-05-17 12:41:26 +00:00
Saksham Mittal e9dff1c0d7
Change log level to debug and warn for certain appropriate situations
This commit changes certain log messages to debug for recoverable errors
and a warn if all such attempts fail, in order to not clutter up the
info messages that end users get to see.
2023-05-17 17:28:22 +05:30
gabi-250 fb8bc19b9b Merge branch 'arc_circ' into 'main'
Refactor ClientCirc APIs to use Arc<ClientCirc>.

Closes #846

See merge request tpo/core/arti!1187
2023-05-17 09:47:19 +00:00
Nick Mathewson b84f122aab Merge branch 'ticket_759' into 'main'
tor-cert: Replace the KeyUnknownCert::check_key API

Closes #759

See merge request tpo/core/arti!1184
2023-05-16 22:23:17 +00:00
Nick Mathewson dfa19998e2 Merge branch 'resolve_relay' into 'main'
netdir: New function to check consistency of a HasRelayIds

Closes #855

See merge request tpo/core/arti!1186
2023-05-16 22:12:29 +00:00
Nick Mathewson 9d54c7973b Deprecate check_key, and refactor its logic into the new functions.
Closes #759
2023-05-16 17:53:15 -04:00
Nick Mathewson 56c6e4345b Replace usage of KeyUnknownCert::check_key. 2023-05-16 17:53:15 -04:00
Nick Mathewson eb356323bd tor-cert: Add new functions to replace KeyUnknownCert::check_key.
These should have a cleaner API than check_key, and be easier to
understand.

Part of #759
2023-05-16 17:53:15 -04:00
Nick Mathewson 4a779807e8 netdir: New function to check consistency of a HasRelayIds
This function will be used to look up a relay by a set of LinkSpecs
given from an incoming HsDesc or INTRODUCE2 message.  It differs
from other "lookup relay by IDs" functions in that it needs to be
able to return "here's a relay", "couldn't found a relay", or
"learned that this relay is impossible."

Closes #855: This is the only new API needed for ChanTarget
validation, I think.
2023-05-16 17:45:21 -04:00
gabi-250 3c34c84f3f Merge branch 'key-mgmt-api-updates-v2' into 'main'
dev docs: key-management.md updates and clarifications

See merge request tpo/core/arti!1185
2023-05-16 15:53:57 +00:00
Gabriela Moldovan 80ec4d01ae
dev docs: The key store version file should specify a minimum supported version.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 15:46:59 +01:00
Nick Mathewson ef3c049064 Merge branch 'rpc-objectmap' into 'main'
RPC: revise semantics for weak references and object IDs

Closes #848

See merge request tpo/core/arti!1183
2023-05-16 13:30:42 +00:00
Nick Mathewson 9c7680d1f8 rpc: Clarify how authentication works. 2023-05-16 09:08:25 -04:00
Nick Mathewson c89fac9c3c rpc: Clarify some object ID docs and remove impl details. 2023-05-16 09:08:25 -04:00
Nick Mathewson 585554d954 rpc: Revise example in documentation 2023-05-16 09:08:25 -04:00
Nick Mathewson 1ed2da523a rpc: Split the generational index into two.
This lets us simplify our logic a bit for strong references.
2023-05-16 09:08:25 -04:00
Nick Mathewson ee390c423e Refactor ClientCirc APIs to use Arc<ClientCirc>.
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.
2023-05-16 09:02:09 -04:00
gabi-250 8674ec857e Merge branch 'run-fixup-features' into 'main'
Run fixup-features on our Cargo.tomls, and handle its warnings

Closes #856 and #795

See merge request tpo/core/arti!1182
2023-05-16 11:09:17 +00:00
Gabriela Moldovan 601f307fdd
dev docs: Remove unused arguments.
There are several places where he `KeyType` isn't needed anymore.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 11:38:00 +01:00
Gabriela Moldovan 47f15c8df5
dev docs: Clarify how C Tor key store loads keys from multiple different key dirs.
This also moves the `extension` function out of `KeyType` because for
the C Tor key store, a key's file extension depends on the role/user of
the key, which isn't known by `KeyType` (`KeyType` is a tor-agnostic key
type such as `Ed25519Private`).

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 11:37:55 +01:00
Gabriela Moldovan 4315d2e106
dev docs: Distinguish between arti_extension and ctor_extension.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 11:32:45 +01:00
Gabriela Moldovan 20e1e3004b
dev docs: Clarify that ArtiPath/CTorPath are relative to the key store root.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 11:32:42 +01:00
Gabriela Moldovan d518a1c1d8
dev docs: Add note about key store versioning.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 11:32:38 +01:00
Gabriela Moldovan 6b417fbbf9
dev docs: Add note about C Tor store configuration.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 11:32:31 +01:00
Gabriela Moldovan 6a1427db6f
dev docs: Move the key passphrases subsection to the Arti store section.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 10:59:36 +01:00
Gabriela Moldovan 4b95a8ac4e
dev docs: Create a separate section for the C tor key store discussion.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 10:59:33 +01:00
Gabriela Moldovan 702dfbddb0
dev docs: Rename {Key, HsClient}Identity.
This renames `KeyIdentity` to `KeySpecifier` so it doesn't get confused
with the concept of an "identity key". `HsClientIdentity` is also
renamed for consistency.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-16 10:59:23 +01:00
Nick Mathewson 2e1115acc3 rpc: Change the formatting of object IDs
We want each ID to have a unique form every time it is given out,
so that you can't use ID==ID to check whether Object==Object.  (See
discussions leading to #848.)

We'd also like the form of object IDs to be a little annoying to
analyze, to discourage people from writing programs that depends on
their particular format.  (We are reserving the right to change the
format whenever we want.)

We _don't_ want to use any cryptography here (yet), lest somebody
think that this is an actual security mechanism.  (This isn't for
security; it's for encouraging developers to treat IDs as opaque.)

With that in mind, we now lightly obfuscate our generational indices
before returning them.
2023-05-15 15:59:58 -04:00
Nick Mathewson 8531ed2dad rpc: rename GenIdx::into/try_from implementations
These are about to become nondeterministic-ish and probably shouldn't
use the Into/TryFrom traits.
2023-05-15 15:26:58 -04:00
Nick Mathewson 0d207028ce rpc: do not deduplicate strong object ids
Per discussion referenced at #848, we want each operation that
returns a strong object ID to return a new, distinct strong ID.

Note that we no longer need to put strong and weak references in the
same arena; we can clean this code up a lot down the road.
2023-05-15 15:26:53 -04:00
Nick Mathewson c9819455e1 rpc: Repair an error in our ObjectId encoding.
Now we generate object IDs that we can parse.  This is about to be
obsolete once we change how we generate objects and their IDs for #848,
but we may as well start from a working state.
2023-05-15 13:48:47 -04:00
Nick Mathewson 6fa821238d Revise all XXXXs from fixup-features 2023-05-15 11:00:28 -04:00
Nick Mathewson 4b08ef76a0 Run fixup-features _with_ annotations.
This litters our Cargo.toml files with "XXX" entries that we should
fix.
2023-05-15 10:41:32 -04:00
Nick Mathewson e2e125fef7 Reformat Cargo.toml files. 2023-05-15 09:09:43 -04:00
Nick Mathewson 7a5373c110 Run fixup-features --no-annotate for initial Cargo.toml fixes.
This does the following:
  - Gives every crate a `full`.
  - Cause every `full` to depend on `full` from the lower-level
    crates.
  - Makes every feature listed _directly_ in `experimental` depend
    on `__is_experimental`.
2023-05-15 09:07:21 -04:00
Nick Mathewson 0109dd09d4 Merge branch 'better-fixup-features' into 'main'
Revise fixup-features to be closer to something we can use

See merge request tpo/core/arti!1180
2023-05-15 13:04:34 +00:00
Nick Mathewson 75776bb8a3 fixup-features: minor doc fix. 2023-05-15 08:27:48 -04:00
Nick Mathewson b38567e34a Mark an initial set of non-additive features. 2023-05-15 08:27:48 -04:00
Nick Mathewson aa452d6627 fixup-features: Do not annotate non-features. 2023-05-15 08:27:48 -04:00