Commit Graph

6503 Commits

Author SHA1 Message Date
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
Nick Mathewson bcac88990f fixup-features: Do not add edges from non-features. 2023-05-15 08:27:48 -04:00
Nick Mathewson 3e61de4f48 fixup-features: distinguish internal and external edges
An external edge does not cause its target to be created as a feature.
2023-05-15 08:11:30 -04:00
Nick Mathewson 85ce5162f5 fixup-features: Add an option to not annotate. 2023-05-15 08:11:30 -04:00
Nick Mathewson ae6254ac35 fixup-features: ability to add annotations for everything. 2023-05-15 08:11:30 -04:00
Nick Mathewson d5c21884fd fixup-features: fix off-by-one in argument reading. 2023-05-15 08:11:30 -04:00
Nick Mathewson 690c0134fe fixup-features: Implement remaining rules. 2023-05-15 08:11:30 -04:00
Nick Mathewson 5046e2003f fixup-features: Enforce __is_experimental tagging rule. 2023-05-15 08:11:30 -04:00
Nick Mathewson d5a38fc5ed fixup-features: Revise our rule 2 enforcement to use newer APIs. 2023-05-15 08:11:30 -04:00
Nick Mathewson 6a468ee4ae fixup-features: Refactor "apply a list of changes" code into a new module. 2023-05-15 08:11:30 -04:00
Nick Mathewson 54e50205dd fixup-features: Make a feature graph type in a submodule
I tried to use petgraph, but it was optimized for performance over
usability, and the usability was beyond me.
2023-05-15 08:11:30 -04:00
Nick Mathewson 059af736e1 fixup-features: minor spelling and comment fixes. 2023-05-15 08:11:30 -04:00
Nick Mathewson 7c556eea67 fixup-features: Describe the semantics we actually want
The problem with our old rules is that "reachable from __nonadditive"
and "reachable from experimental" were not themselves sensible
definitions of nonadditive and experimental.

See
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1068#note_2887939
2023-05-15 08:11:30 -04:00
gabi-250 84402fc660 Merge branch 'x25519-dalek-upgrade' into 'main'
llcrypto: upgrade x25519-dalek.

See merge request tpo/core/arti!1181
2023-05-15 09:46:51 +00: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
gabi-250 3490ece8cf Merge branch 'connect-hsdesc-bounds' into 'main'
hsclient: Build cached descriptor TimerangeBounds from descriptor lifetime.

See merge request tpo/core/arti!1154
2023-05-13 12:14:10 +00: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
Nick Mathewson 4d224f742d Merge branch 'rename-netdoc-err-method' into 'main'
netdoc: Rename parse_error_kind() to netdoc_error_kind().

See merge request tpo/core/arti!1179
2023-05-11 18:27:18 +00: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 81684e5d6a Merge branch 'netdoc-error-rename' into 'main'
netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.

See merge request tpo/core/arti!1176
2023-05-10 15:22:50 +00: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