summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
* Bump crate versions in preparation for v1.1.5 release.Nick Mathewson2023-06-011-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generated with the following commands: ``` cargo set-version --bump minor -p tor-cell cargo set-version --bump minor -p tor-linkspec cargo set-version --bump minor -p tor-proto cargo set-version --bump minor -p tor-netdoc cargo set-version --bump minor -p tor-circmgr cargo set-version --bump patch -p tor-cert cargo set-version --bump patch -p tor-basic-utils cargo set-version --bump patch -p tor-rpcbase cargo set-version --bump patch -p tor-llcrypto cargo set-version --bump patch -p tor-hscrypto cargo set-version --bump patch -p tor-checkable cargo set-version --bump patch -p tor-async-utils cargo set-version --bump patch -p caret cargo set-version --bump patch -p fs-mistrust cargo set-version --bump patch -p safelog cargo set-version --bump patch -p retry-error cargo set-version --bump patch -p tor-error cargo set-version --bump patch -p tor-config cargo set-version --bump patch -p tor-events cargo set-version --bump patch -p tor-units cargo set-version --bump patch -p tor-rtcompat cargo set-version --bump patch -p tor-rtmock cargo set-version --bump patch -p tor-protover cargo set-version --bump patch -p tor-bytes cargo set-version --bump patch -p tor-socksproto cargo set-version --bump patch -p tor-consdiff cargo set-version --bump patch -p tor-netdir cargo set-version --bump patch -p tor-congestion cargo set-version --bump patch -p tor-persist cargo set-version --bump patch -p tor-chanmgr cargo set-version --bump patch -p tor-ptmgr cargo set-version --bump patch -p tor-guardmgr cargo set-version --bump patch -p tor-dirclient cargo set-version --bump patch -p tor-dirmgr cargo set-version --bump patch -p tor-hsclient cargo set-version --bump patch -p tor-hsservice cargo set-version --bump patch -p arti-client cargo set-version --bump patch -p arti-rpcserver cargo set-version --bump patch -p arti-config cargo set-version --bump patch -p arti-hyper cargo set-version --bump patch -p arti cargo set-version --bump patch -p arti-bench cargo set-version --bump patch -p arti-testing ```
* Upgrade serde_with dependency to 3.0.0Nick Mathewson2023-05-221-1/+1
|
* netdoc, hsclient: Update remaining ed25519::SecretKey usersNick Mathewson2023-05-182-20/+17
| | | | | | Fortunately, these are all in experimental code. Closes #798
* Merge branch 'ticket_759' into 'main'Nick Mathewson2023-05-163-4/+4
|\ | | | | | | | | | | | | tor-cert: Replace the KeyUnknownCert::check_key API Closes #759 See merge request tpo/core/arti!1184
| * Replace usage of KeyUnknownCert::check_key.Nick Mathewson2023-05-163-4/+4
| |
* | Revise all XXXXs from fixup-featuresNick Mathewson2023-05-151-4/+9
| |
* | Run fixup-features _with_ annotations.Nick Mathewson2023-05-151-0/+2
| | | | | | | | | | This litters our Cargo.toml files with "XXX" entries that we should fix.
* | Reformat Cargo.toml files.Nick Mathewson2023-05-151-7/+14
| |
* | Run fixup-features --no-annotate for initial Cargo.toml fixes.Nick Mathewson2023-05-151-6/+7
|/ | | | | | | | | 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`.
* Use non-deprecated *Secret::random_from_rng.Nick Mathewson2023-05-132-6/+7
| | | | The `new` function is deprecated in x25519-dalek 2.0.0-rc.2
* netdoc: Use the RangeBoundsExt impl of TimerangeBound.Gabriela Moldovan2023-05-132-11/+25
| | | | | | We can now get rid of the standalone `intersect_bounds` function. Signed-off-by: Gabriela Moldovan <[email protected]>
* netdoc: Do not consume EncryptedHsDesc when decrypting.Gabriela Moldovan2023-05-131-1/+1
| | | | | | | | | `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 <[email protected]>
* hsclient: Compute HsDesc validity time from the TimerangeBounds of its layers.Gabriela Moldovan2023-05-131-13/+16
| | | | | | | This makes `descriptor_ensure` refetch the descriptor if either of its layers (inner or outer) expires. Signed-off-by: Gabriela Moldovan <[email protected]>
* hsclient: Build cached descriptor TimerangeBounds from descriptor lifetime.Gabriela Moldovan2023-05-131-0/+7
| | | | | | | This makes `descriptor_ensure` refetch the descriptor if it has been cached for longer than `descriptor-lifetime` minutes. Signed-off-by: Gabriela Moldovan <[email protected]>
* netdoc: Rename parse_error_kind() to netdoc_error_kind().Gabriela Moldovan2023-05-113-5/+5
| | | | | | | `ParseErrorKind` was renamed to `NetdocErrorKind`, so we need to rename this acccessor too. Signed-off-by: Gabriela Moldovan <[email protected]>
* Merge branch 'hs-linkspec-work-v2' into 'main'Nick Mathewson2023-05-111-2/+2
|\ | | | | | | | | | | | | Second take on linkspec manipulation code needed by onion services Closes #794 See merge request tpo/core/arti!1177
| * Rename UnparsedLinkSpec => EncodedLinkSpecNick Mathewson2023-05-101-2/+2
| |
* | netdoc: Remove experimental-api gate from parse_decrypt_validate.Gabriela Moldovan2023-05-102-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | `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 <[email protected]>
* | netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.Gabriela Moldovan2023-05-1017-43/+42
|/ | | | | | | | | | | `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 <[email protected]>
* Merge branch 'hsdesc-parse-decrypt-validate' into 'main'gabi-2502023-05-032-1/+75
|\ | | | | | | | | | | | | netdoc: Add a convenience method for HS descriptor parsing. Closes #809 See merge request tpo/core/arti!1152
| * netdoc: Mark parse_decrypt_validate as experimental.Gabriela Moldovan2023-05-022-0/+6
| | | | | | | | Signed-off-by: Gabriela Moldovan <[email protected]>
| * netdoc: Document how to extract an `HsDesc` out of an ↵Gabriela Moldovan2023-04-251-0/+32
| | | | | | | | | | | | | | | | | | `UncheckedEncryptedHsDesc`. This adds an example to the `HsDesc::parse` docs. The constants from the example are lifted from the `parse_desc_good` test. Signed-off-by: Gabriela Moldovan <[email protected]>
| * netdoc: Add a convenience method for HS descriptor parsing.Gabriela Moldovan2023-04-252-1/+37
| | | | | | | | | | | | | | | | | | This adds the `HsDesc::parse_decrypt_validate` method, which parses, decrypts, and validates HS descriptors. Closes #809 Signed-off-by: Gabriela Moldovan <[email protected]>
* | Increment crate versions.Nick Mathewson2023-05-031-11/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of the errorkind bumps, we're calling this a breaking change in everything lower-level than `arti`. Generated with: ``` cargo set-version -p tor-basic-utils --bump minor cargo set-version -p tor-async-utils --bump minor cargo set-version -p caret --bump minor cargo set-version -p fs-mistrust --bump minor cargo set-version -p safelog --bump minor cargo set-version -p retry-error --bump minor cargo set-version -p tor-error --bump minor cargo set-version -p tor-config --bump minor cargo set-version -p tor-events --bump minor cargo set-version -p tor-units --bump minor cargo set-version -p tor-rtcompat --bump minor cargo set-version -p tor-rtmock --bump minor cargo set-version -p tor-rpcbase --bump minor cargo set-version -p tor-llcrypto --bump minor cargo set-version -p tor-protover --bump minor cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-hscrypto --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-checkable --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-linkspec --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump minor cargo set-version -p tor-consdiff --bump minor cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-congestion --bump minor cargo set-version -p tor-persist --bump minor cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-ptmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump minor cargo set-version -p tor-dirclient --bump minor cargo set-version -p tor-dirmgr --bump minor cargo set-version -p tor-hsclient --bump minor cargo set-version -p tor-hsservice --bump minor cargo set-version -p arti-client --bump minor cargo set-version -p arti-rpcserver --bump minor cargo set-version -p arti-config --bump minor cargo set-version -p arti-hyper --bump minor cargo set-version -p arti --bump patch cargo set-version -p arti-bench --bump patch cargo set-version -p arti-testing --bump patch ```
* netdoc: Document that particular bit values for flags are not part of our API.Nick Mathewson2023-04-171-1/+3
|
* netstatus: re-number routerstatus flags to go in order.Nick Mathewson2023-04-171-7/+7
| | | | | | | | Otherwise there is too much risk of accidentally adding in another 1<<12 when we meant to add a 1<<13. (It would be neat to have an alternative to bitflags here that would auto-number our bitflags for us.)
* netdir: more documentation on MIDDLE_ONLY flag.Nick Mathewson2023-04-172-0/+8
| | | | Clarify that it isn't anything that most users will need to check.
* netdoc: Add MiddleOnly flag to RelayFlagsjuga2023-04-172-0/+8
| | | | Closes #833
* Upgrade our hex-literal dependencyNick Mathewson2023-04-131-2/+2
|
* Merge branch 'remove-hsdesc-todo' into 'main'Ian Jackson2023-04-121-3/+0
|\ | | | | | | | | Remove misleading TODO. See merge request tpo/core/arti!1130
| * Remove misleading TODO.Gabriela Moldovan2023-04-111-3/+0
| | | | | | | | | | | | | | | | | | | | The `superencrypted` blob is, in fact, followed by a newline. See [core/torspec!122]. [core/torspec!122]: https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/122 Signed-off-by: Gabriela Moldovan <[email protected]>
* | Increment MSRV to 1.65 in every crate.Nick Mathewson2023-04-111-1/+1
| |
* | tor-netdoc: Tidy up and fix some broken intra-doc linksIan Jackson2023-04-112-3/+5
|/ | | | | | | | | | | | 1. Abbreviate the link text, and don't have it contain `crate` which is not really great in docs. 2. Use `super::` for the link target, to find the right thing. (`crate` doesn't seem to work in rustdoc, perhaps deliberately, although the error messages are ridiculous and claim the nonexistence of intermediate modules.) 3. Wrap the lines a bit more.
* tor-netdoc: Expose test data under new "testing" feature flagIan Jackson2023-04-056-25/+39
|
* tor-netdoc: Fix feature buildsIan Jackson2023-04-054-5/+8
| | | | | | | | | | | | Fixes cargo +stable test --locked --offline F -p tor-netdoc cargo +stable clippy -p tor-netdoc F --all-targets for values of F including --all-features --features=hs-client --features=hs-common --features=hs-service (nothing)
* Generate a new KP_hss_desc_enc keypair for each new descriptor.Gabriela Moldovan2023-03-312-33/+51
| | | | | | | | | | | | | | | | Previously, to build descriptors for hidden services with client auth enabled, in addition to the list of authorized clients, users of `HsDescBuilder` were required to also provide a descriptor encryption keypair and a descriptor cookie. This was potentially dangerous and/or error-prone, because the ephemeral encryption key and the descriptor cookie are expected to be randomly generated and unique for each descriptor. This change makes `ClientAuth` private to the `hsdesc::build` module and updates `HsDescBuilder` to build `ClientAuth`s internally. Users now only need to provide the list of authorized client public keys. Signed-off-by: Gabriela Moldovan <[email protected]>
* Remove unnecessary test constant.Gabriela Moldovan2023-03-312-14/+8
| | | | | | It's not really needed, it can just be generated at (test) runtime. Signed-off-by: Gabriela Moldovan <[email protected]>
* Add an encode-decode test for descriptors with client auth.Gabriela Moldovan2023-03-311-23/+96
| | | | | | | This adds a test for an `encode -> decode -> encode` flow for a hidden service descriptor with client authorization enabled. Signed-off-by: Gabriela Moldovan <[email protected]>
* Use constants instead of magic numbers.Gabriela Moldovan2023-03-311-6/+10
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* Stop requiring the caller to supply `AuthClient`s.Gabriela Moldovan2023-03-314-102/+151
| | | | | | | | | | | | | | | | | | `AuthClient`s were originally meant to represent parsed `auth-client` lines. In !1070, this struct was repurposed for representing individual authorized clients in the HS descriptor encoder. However, hidden services will likely use a list of public keys to represent the authorized clients rather than a list of `AuthClient`s, as the information from an `AuthClient` (`client_id`, `iv`, `encrypted_cookie`) likely won't be immediately available to the hidden service. This change updates the HS descriptor encoder to represent authorized clients as a list of `curve25519::PublicKey`s. As such, it is now the responsibility of the encoder to create the `client_id`, `iv`, and `encrypted_cookie` using the available keys, the unencrypted descriptor cookie, and HS subcredential. Signed-off-by: Gabriela Moldovan <[email protected]>
* Patchlevel bumps for crates whose dependencies just changed.Nick Mathewson2023-03-311-1/+1
| | | | | | | | | | | | | | | | These crates had no changes until just a moment ago. But since we updated the versions on some of their dependents, they have now changed themselves. Thus they get patchlevel bumps. ``` tor-rtmock tor-protover tor-socksproto tor-consdiff tor-chanmgr tor-dirclient tor-hsservice ```
* Bump crate versions that have breaking changesNick Mathewson2023-03-311-1/+1
| | | | | | | | | | These crates have had breaking changes. They are pre-1.0, so they get a minor bump. ``` tor-basic-utils tor-config ```
* Bump patchlevel on crates with non-breaking changesNick Mathewson2023-03-311-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For these crates, the changes are nontrivial, so we _do_ bump the versions on which their dependent crates depend. Fortunately, since they are all pre-1.0, we don't need to distinguish semver-additions from other changes. (Except for arti, which _is_ post-1.0, but gets a patchlevel bump anyway.) These are unstable crates with breaking changes: ``` tor-hscrypto tor-hsclient ``` These have new or extended APIs: ``` safelog tor-bytes tor-cell tor-linkspec tor-llcrypto tor-proto tor-cert arti-client ``` These have new unstable APIs or features: ``` tor-netdoc tor-circmgr (also broke some unstable APIs) arti (is post-1.0) ``` These have bugfixes only: ``` caret tor-dirmgr ```
* Merge branch 'fix-broken-doc-links' into 'main'Nick Mathewson2023-03-302-5/+5
|\ | | | | | | | | Fix broken doc link. See merge request tpo/core/arti!1082
| * Fix broken doc link.Gabriela Moldovan2023-03-272-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a broken doc link I introduced in !1070: ``` error: unresolved link to `crate::doc::hsdesc::build::inner::HsDescInnerBuilder` --> crates/tor-netdoc/src/doc/hsdesc/build/middle.rs:34:11 | 34 | /// [`crate::doc::hsdesc::build::inner::HsDescInnerBuilder`] as described in sections | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `HsDescInnerBuilder` in module `inner` | = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings` error: could not document `tor-netdoc` ``` Signed-off-by: Gabriela Moldovan <[email protected]>
* | Remove hard-coded test certs.Gabriela Moldovan2023-03-274-98/+86
| | | | | | | | | | | | We can use a deterministic rng to generate predictable keypairs instead. Signed-off-by: Gabriela Moldovan <[email protected]>
* | Make the HS encoder randomness source injectable.Gabriela Moldovan2023-03-275-50/+46
| | | | | | | | | | | | | | This makes it possible to plug in a deterministic randomness source for testing. Signed-off-by: Gabriela Moldovan <[email protected]>
* | Use the type system to enforce use of blinded keys.Gabriela Moldovan2023-03-272-25/+37
|/ | | | | | | | | | | | | | | Hidden services use blinded singing keys derived from the identity key to sign descriptor signing keys. Before this patch, the hidden descriptor builder represented its blinded signing keys (`blinded_id`) as plain `ed25519::Keypair`s. This was not ideal, as there was nothing preventing the caller from accidentally initializing `blinded_id` with an unblinded keypair. This introduces a new `HsBlindKeypair` type to represent blinded keypairs. Signed-off-by: Gabriela Moldovan <[email protected]>
* Use transparent structs instead of builders.Gabriela Moldovan2023-03-244-100/+95
| | | | | | | | The consensus seems to be the builders don't add much value, see [this comment]. [this comment]: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1070#note_2889488 Signed-off-by: Gabriela Moldovan <[email protected]>
* Refactor the inner doc tests to be more DRY.Gabriela Moldovan2023-03-241-53/+55
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>