Commit Graph

4048 Commits

Author SHA1 Message Date
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 b38567e34a Mark an initial set of non-additive features. 2023-05-15 08:27:48 -04:00
Nick Mathewson bfda3082d4 Use non-deprecated *Secret::random_from_rng.
The `new` function is deprecated in x25519-dalek 2.0.0-rc.2
2023-05-13 16:52:23 -04:00
Nick Mathewson bedc47afe7 llcrypto: upgrade x25519-dalek.
This upgrades us to 2.0.0-rc.2, which is the latest in the
not-quite-done-yet 2.0 series.

The only code change that's absolutely needed is opting into the
static_secrets feature.
2023-05-13 16:46:47 -04:00
Gabriela Moldovan c4def3cfca
tor-basic-utils: Add unbounded range (..) test.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:49:10 +01:00
Gabriela Moldovan ef53c4235d
tor-basic-utils: Update combinatorial test to randomly choose an open or closed bound.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:49:06 +01:00
Gabriela Moldovan 27ae57e543
tor-basic-utils: Add rangebounds test with time ranges.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:49:03 +01:00
Gabriela Moldovan 9d4db38d4d
tor-basic-utils: Assert witness is not part of the intersection.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:59 +01:00
Gabriela Moldovan 18c78c3ad3
tor-basic-utils: Log the ranges/intersection on assertion failure.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:56 +01:00
Gabriela Moldovan f9c6cc11bb
netdoc: Use the RangeBoundsExt impl of TimerangeBound.
We can now get rid of the standalone `intersect_bounds` function.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:52 +01:00
Gabriela Moldovan 094287e677
tor-checkable: Implement RangeBounds for TimerangeBound.
By implementing `RangeBounds` for `TimerangeBound`, we get
`RangeBoundsExt` for free. This will enable `parse_decrypt_validate` to
easily compute the intersection of the `TimerangeBound`s its layers.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:49 +01:00
Gabriela Moldovan 11c39b5657
tor-basic-utils: Add a helper function to deduplicate test code.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:44 +01:00
Gabriela Moldovan 872f5da4b2
tor-basic-utils: Add RangeBoundsExt trait.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:41 +01:00
Gabriela Moldovan 6992427596
hsclient: descriptor_ensure no longer wraps the descriptor in TimerangeBound.
`descriptor_fetch_attempt` now returns a `TimerangeBound<HsDesc>` (and
so does `parse_descript_validate`).

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:37 +01:00
Gabriela Moldovan 9dbf162c90
netdoc: Do not consume EncryptedHsDesc when decrypting.
`parse_decrypt_validate` will need to "peek" inside an encrypted
descriptor (before validating it) to extract the `TimerangeBound` of the
inner layer. This is needed to compute the intersection of the
`TimerangeBound`s of both layers.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:23 +01:00
Gabriela Moldovan 92e0b6a029
hsclient: Compute HsDesc validity time from the TimerangeBounds of its layers.
This makes `descriptor_ensure` refetch the descriptor if either of its
layers (inner or outer) expires.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:20 +01:00
Gabriela Moldovan 919790c632
tor-checkable: Add a way to compute the intersection of 2 RangeBounds.
This will be used for computing the final `TimerangeBound` of a `HsDesc`
from the `TimerangeBound`s of its inner and outer layers.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:16 +01:00
Gabriela Moldovan 88ea5032f4
hsclient: Build cached descriptor TimerangeBounds from descriptor lifetime.
This makes `descriptor_ensure` refetch the descriptor if it has been
cached for longer than `descriptor-lifetime` minutes.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:13 +01:00
Gabriela Moldovan 7dfa25db35
hsclient: Rename import alias to reflect new name.
A `NetdocErrorKind` is a `NEK` rather than a `PEK`.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-11 18:46:04 +01:00
Gabriela Moldovan 0422893373
netdoc: Rename parse_error_kind() to netdoc_error_kind().
`ParseErrorKind` was renamed to `NetdocErrorKind`, so we need to
rename this acccessor too.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-11 18:39:40 +01:00
gabi-250 35f9196a6d Merge branch 'nightly-warnings-20230511' into 'main'
Fix a few warnings from rust nightly

See merge request tpo/core/arti!1178
2023-05-11 13:17:56 +00:00
Nick Mathewson ca96b77b15 Merge branch 'hs-linkspec-work-v2' into 'main'
Second take on linkspec manipulation code needed by onion services

Closes #794

See merge request tpo/core/arti!1177
2023-05-11 13:16:13 +00:00
Nick Mathewson 0f9b45fe82 arti-testing: remove some needless ::default()s
This fixes a warning from nightly clippy.  I don't care for this
warning, but fixing it is easier than adding a version-conditional
warning exception.
2023-05-11 08:39:12 -04:00
Nick Mathewson c1fea9a67f dirmgr: remove a needless .borrow()
This fixes a warning from nightly clippy.
2023-05-11 08:38:42 -04:00
Nick Mathewson 78fb64387d chanmgr: remove a needless mut.
This fixes a warning from nightly clippy.
2023-05-11 08:38:06 -04:00
Nick Mathewson 164717e196 linkspec::verbatim: wrapper to give a CircTarget a new set of LinkSpecs 2023-05-11 08:31:53 -04:00
Nick Mathewson 88e9976556 Add linkspec::decode to convert linkspecs to an OwnedChanTarget
Relays and onion service services/clients will both need this.

I'm marking this experimental for now; we should stabilize it before
we release onion services.
2023-05-11 08:31:53 -04:00
Nick Mathewson 7ce808b75b Change CircTarget::linkspecs() to return an encoded list.
If we didn't do this, we would need to transfrom
`EncodedLinkSpec`s into a `LinkSpec::Unrecognized`, which is not
semantically right.  What's more, every user of this API wants to
consume encoded link specifiers, so encoding them early saves a
little effort.
2023-05-10 12:30:32 -04:00
Nick Mathewson a86aff8399 linkspec: Make LinkSpecType public.
This lets us check the type of an `EncodedLinkSpec` as well, and
lets us remove an interface that took a raw u8.
2023-05-10 12:19:37 -04:00
Nick Mathewson 4e5d7cecca linkspec: define conversion functions for EncodedLinkSpec
This commit adds functions to convert between LinkSpec and
EncodedLinkSpec, and refactors their read/write implementations a
bit to avoid code duplication.
2023-05-10 11:40:40 -04:00
Nick Mathewson 02785ca650 Rename UnparsedLinkSpec => EncodedLinkSpec 2023-05-10 11:23:39 -04:00
Nick Mathewson 1442763f3d hspool: Accept any T:CircTarget.
Previously, we only accepted an OwnedCircTarget, which would have
kept us from getting a circuit that was aimed at a specialized
CircTarget that gave us LinkSpecs in a raw order.
2023-05-10 11:00:57 -04:00
Nick Mathewson d26da331be test_linkspecs: tidy order of linkspecs
This is pure code movement.
2023-05-10 11:00:57 -04:00
Nick Mathewson e919ade062 Move responsibility for linkspec sorting to CircTarget.
This change is necessary so that we can build Extend2 messages
that have their LinkSpecs appear in a verbatim order as provided
in an INTRODUCE2 message or in a HS descriptor.
2023-05-10 11:00:57 -04:00
Gabriela Moldovan 410ca23d2d
netdoc: Remove experimental-api gate from parse_decrypt_validate.
`parse_decrypt_validate` was marked as experimental because it was
unclear if the newly added `BadTimeBound` error kind belongs in
`ParseErrorKind`. However, we have since renamed `ParseErrorKind` to
`NetdocErrorKind` and decided to keep the new variant, so this API
doesn't need to be experimental anymore.

Closes arti #852

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-10 15:53:54 +01:00
Gabriela Moldovan 099b2315b0
netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.
`ParseErrorSource` was originally meant to represent a parsing error,
this enum has since gained some variants that aren't really parsing
related (`Signature`, `CertSignature`, `UntimelyDescriptor`).

Since this error type is now used for general-purpose netdoc errors,
let's rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-10 15:52:28 +01:00
Alexander Færøy 24051b1d1a Merge branch 'ticket_839' into 'main'
Downgrade and clarify message about dir replacment time.

Closes #839

See merge request tpo/core/arti!1171
2023-05-09 13:14:11 +00:00
Alexander Færøy 867663f2e5 Merge branch 'print-stati-feature' into 'main'
print both static sqlite/tls when 'static' feature is used

See merge request tpo/core/arti!1169
2023-05-09 13:12:51 +00:00
Nick Mathewson e6aa947c45 Downgrade and clarify message about dir replacment time.
Closes #839
2023-05-08 14:01:19 -04:00
trinity-1686a fe68f0a119 fix a couple clippy lints 2023-05-08 18:01:28 +02:00
trinity-1686a a8fd2d390e update rustls to 0.21 2023-05-08 18:01:00 +02:00
trinity-1686a 7d50a34a3a update rsa to 0.9.x 2023-05-08 17:24:23 +02:00
trinity-1686a f390440bbf print both static sqlite/tls when 'static' feature is used 2023-05-08 16:59:35 +02:00
Gabriela Moldovan 6b9e37e07c
tor-netdir: Shuffle the list of HS dirs used for downloading descriptors.
We'll probably need the hsdir list to be shuffled deterministically for
testing purposes (this might be desirable, for example, when we write a
test for HS descriptor download retries).

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-04 17:53:58 +01:00
Nick Mathewson da185223c0 objmap: move types to top of file. 2023-05-04 10:37:27 -04:00
Nick Mathewson 7918904b99 Note/clean more TODOs in objmap. 2023-05-04 10:37:27 -04:00
Nick Mathewson 6fb5d08103 RPC: Make the "client" return optional. 2023-05-04 10:37:27 -04:00