summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/doc
Commit message (Collapse)AuthorAgeFilesLines
* PoW: Consolidate feature flags into a single flag.Wesley Aptekar-Cassels2024-11-255-15/+15
| | | | | | | | | | | | | | | | | This replaces the hs-pow, hs-pow-full, hs-pow-v1, pow-v1, and pow-full features with a single hs-pow-full feature. It's possible that in the future we will want to split different schemes into different features, but we can do that when it comes up. For now, having this as a single flag makes it clearer what's going on, since the previous thing was not actually expressive enough to capture some things we care about (like "at least one pow scheme is enabled" that works in a future-compatible way). This change is not semver breaking since it's a experimental feature. Related: #1751
* tor-netdoc: Error on PowParams::V1 when hs-pow-v1 is disabled.Wesley Aptekar-Cassels2024-11-251-2/+11
|
* tor-netdoc: Don't include pow_params in HsDesc when feature is disabled.Wesley Aptekar-Cassels2024-11-252-7/+8
|
* tor-netdoc: Support writing pow-params line.Wesley Aptekar-Cassels2024-11-252-0/+91
| | | | | | | I'm not particularly happy with the code that does the actual writing out of the pow-params line, in particular the error handling there seems very verbose. However, I don't know of a better way to structure it given that APIs I'm working with.
* TimerangeBound: Stop using std::ops::Bound.Wesley Aptekar-Cassels2024-11-252-7/+7
| | | | Fixes: #1691
* tor-netdoc: add clippy allows and `#[non_exhaustive]`Steven Engler2024-11-201-0/+2
|
* Add a little test coverage for pow-params parsing.Wesley Aptekar-Cassels2024-10-091-0/+108
| | | | | | | | Cover some of the novel edge cases we're introducing around object parameters and repetition. This still feels awfully ad-hoc, but it's better than nothing. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow inner desc: broaden pow-params rule, disallow object for v1.Wesley Aptekar-Cassels2024-10-092-3/+8
| | | | | | | | | | | We should not be restricting pow-params to occur only once at the rule level, and we shouldn't be disallowing object parameters at that level either. Instead, the v1 scheme itself needs to check for and disallow objects. Future schemes may allow object parameters. Test cases for this will be added in a subsequent commit. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: inner doc test using canned data from C tor.Wesley Aptekar-Cassels2024-10-091-4/+39
| | | | | | | | | | | This proliferates the canned hsdesc inner doc testing strategy, adding another file with data encoded with onion-pow-example running on C tor. Tests that it parses successfully, and asserts that the pow params line contents are correct. This is a positive test only. This strategy seems problematic, but it's better than nothing. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Explain what the v1 scheme refers to, in PowParams.Wesley Aptekar-Cassels2024-10-091-0/+7
| | | | | | | Adds another breadcrumb as requested so new folks happening upon this in the docs can get oriented. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Change rule to require pow_params type parameter.Wesley Aptekar-Cassels2024-10-091-1/+1
| | | | | | | This can now notice pow_params lines which are invalid because they have no parameters. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Use TimerangeBound for puzzle parameters.Wesley Aptekar-Cassels2024-10-091-9/+9
| | | | Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Refactor to prefer stub types rather than cfg sprawl.Wesley Aptekar-Cassels2024-10-095-34/+46
| | | | | | | | | | | | | | | | | | | | | | In this design, the thin multiplexing layer between PoW types is always available when onion services are in use, but the specific pow schemes (and their dependency libraries) are gated by crate features everywhere. There are now no new cfg() gates. When the pow-v1 scheme is disabled, we can parse `pow-params v1` lines into an empty type (so clients know a PoW scheme exists that might be supported if they were configured differently). We currently don't save the contents of unknown hsdesc items. On the relaycell side, the hs ext module already sets a strong precedent for keeping unrecognized data as a byte vec, and it doesn't provide a good way to signal soft parse errors like unrecognized optional extensions. There, the `v1` type is completely optional, and services lacking a pow scheme suggested by a client would see one of these 'unrecognized' blobs. This isn't necessarily helpful but it fits the rest of the design. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* tor-hspow: Big refactor, dissolve this crateWesley Aptekar-Cassels2024-10-094-34/+63
| | | | | | | | | | | | | | | | | My previous strategy here was to try and centralize hspow in one crate, writing it like a self-contained feature. That introduced friction in the data types, prompting the use of simplistic types at the netdoc/cell layers and full-featured types in the optional modules. This changes tactics, dissolving the low-level parts of tor-hspow into tor-hscrypto and the high-level parts into hsclient/hsservice. Full featured types are used everywhere now, but the tradeoff is that compile-time configurability is a lot more pervasive. Anything that knows about PoW types at all needs to be fully configured out. I took this opportunity to try a more complete set of crate features, allowing users to configure individual PoW schemes. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* First pass at implementing onion proof-of-work clientWesley Aptekar-Cassels2024-10-092-2/+2
| | | | | | | | This adds a module to tor-hspow for version-independent client logic. The entire module and its invocations are disabled unless the new "hs-pow" compile time feature is set. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* tor-netdoc: Add parsing support for pow-params.Wesley Aptekar-Cassels2024-10-093-0/+120
| | | | | | | | This implements support for extensible proof-of-work parameters. Right now only a single type is defined, but in theory we can see up to one line per type on an onion service. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* tor-netdoc: Wrap some too-long comments and docs.Gabriela Moldovan2024-10-033-4/+7
|
* tor-netdoc: Use the new "restricted discovery" terminology.Gabriela Moldovan2024-10-035-22/+22
| | | | Part of #1476
* Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-1/+1
| | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* tor-netdoc: impl `Extend` on `NetParams`Steven Engler2024-09-031-0/+6
|
* Resolve unreachable_patterns warnings from nightly.Nick Mathewson2024-08-131-12/+5
| | | | | | | | | | | | | | Nightly rust doesn't like it when you have a `match` arm that can never be reached because of an uninhabited type. As such, we can't say stuff like: ``` let x: Option<Void> = ...; match x { Some(_) => unreachable!(), None => ... } ```
* Merge branch 'expose-annotated' into 'main'Nick Mathewson2024-07-221-0/+15
|\ | | | | | | | | | | | | tor-netdoc: Dangerously expose annotation fields Closes #1469 See merge request tpo/core/arti!2213
| * tor-netdoc: Dangerously expose annotation fieldsClara Engler2024-06-211-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | This commit exposes the fields of `routerdesc::AnnotatedRouterDesc` and `routerdesc::RouterAnnotation` with the enabled feature `dangerous-expose-struct-fields`. On one side, it achieves a greater consistency among the other structures found within this module; On the other side it makes the already public API (assuming the feature above is enabled) useable. Fixes #1469
* | Fix clippy::doc_lazy_continuationIan Jackson2024-07-081-3/+4
| |
* | Make TAP keys optional when parsing documents.Nick Mathewson2024-06-272-27/+63
|/ | | | | This is the client-side part of phase 1 for proposal 350, which will eventually remove TAP completely from the Tor network.
* Add exception for cfg(fuzzing) in tor-netdocNick Mathewson2024-05-071-1/+2
| | | | | The use of cfg(fuzzing) here is reasonable and localized, but we need to permit it to avoid a warning from #1395.
* Switch to derive-deftlyIan Jackson2024-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the combination of a number of separate commits, many of which were generated by seddery, and then rebased and squashed. Cargo.toml perl -i~ -pe 's{^derive-adhoc}{derive-deftly = "0.10"}' crates/*/Cargo.toml (not regenerated during rebase) update Cargo.lock `cargo fetch` without --locked (regenerated during rebase) seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{^use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bdefine_derive_adhoc\b}{define_derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bAdhoc\b}{Deftly}g if m{derive}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[derive_adhoc\b}{#[derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc\b}{derive_deftly_adhoc} if m{use.*deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc!}{derive_deftly_adhoc!}' (not regenerated during rebase) Manually add `#[derive_deftly_adhoc]` where needed. seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[adhoc\b}{#[deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc_template}{derive_deftly_template}' (not regenerated during rebase) Manually fix up an import Manually update some builder attrs Manually fix up tor_rtmock::time_core This was missed in my seddery, due to me rebasing the branch and not redoing the seddery.
* Run maint/add_warning.Nick Mathewson2024-03-1316-0/+16
|
* Add a clear_flags function to RouterStatusBuilderNick Mathewson2024-03-121-0/+6
| | | | (For testing.)
* Fix typos in doc commentsTobias Stoeckmann2024-03-061-1/+1
|
* Fix typos in commentsTobias Stoeckmann2024-03-061-1/+1
|
* Upgrade to latest signature.Gabriela Moldovan2024-02-281-2/+0
|
* Merge branch 'enc_key_cert_signbit' into 'main'Nick Mathewson2024-01-172-6/+14
|\ | | | | | | | | | | | | hsdesc: Document why enc_key_cert signbit is always zero. Closes #1221 See merge request tpo/core/arti!1888
| * hsdesc: Document why enc_key_cert signbit is always zero.Nick Mathewson2024-01-162-6/+14
| | | | | | | | | | | | Closes #1221. See torspec!240 for a corresponding spec change.
* | RouterStatus: Add test functions for Fast and Stable flags.Nick Mathewson2024-01-161-0/+8
|/ | | | | (We don't need Fast right now, but we will certainly need it down the line.)
* tor-netdoc: Turn a TODO HSS into #1221.Gabriela Moldovan2024-01-111-1/+2
|
* tor-netdoc: Downgrade some TODO HSS to TODO.Gabriela Moldovan2024-01-112-2/+2
|
* tor-netdoc: Make HsDescBuilder::auth_clients take an Option.Gabriela Moldovan2023-12-141-11/+18
| | | | Closes #1019
* llcrypto: Hide the members of ExpandedKeypair.Nick Mathewson2023-11-291-3/+3
| | | | | With this change, we no longer expose the ExpandedSecretKey unescorted, which makes it harder to misuse the API.
* llcrypto: Remove redundant re-exports in keymanip.Nick Mathewson2023-11-292-3/+2
| | | | (These types were all already re-exported from pk::ed25519.)
* Remove RngCompatExt.Nick Mathewson2023-11-294-15/+8
| | | | | | | | | | This code was needed with the old version of dalek-cryptography, which wasn't compatible with up-to-date versions of the `rand` crate(s). But now that we've upgraded, we can drop this. (We could have left it around and deprecated it, but we are already making a breaking change to tor-llcrypto by upgrading dalek-cryptography.)
* Convert to the latest versions of dalek-cryptographyNick Mathewson2023-11-294-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes that we have to adjust for are as follows: * In x25519-dalek: * `StaticSecret` is now behind a feature. * `StaticSecret::new` is deprecated in favor of `StaticSecret::random_from_rng`. * StaticSecret no longer does its own clamping. * In ed25519-dalek: * `SecretKey` has (in effect) been renamed to `SigningKey`. The name `SecretKey` is now an alias for `[u8; 32]`. * `SigningKey` is effectively a keypair, since it contains a public key as well. * `PublicKey` has been renamed to `VerifyingKey`. * The functions to extract a signing key and verifying key have been renamed as you might expect. * `ExpandedSecretKey` has been moved to `hasmat` and no longer implements `sign`. * `ExpanededSecretKey` now has as its elements a scalar and a hash prefix. * Various functions that took `&[u8]` now take `&[u8; N]`. * We no longer need a wrapper for older versions of rand. There is a single test in tor-keymgr that does not pass. I've marked it as ignore for now, in hopes that @gabi-250 can help me figure it out. This closes #808. There are several changes I want to make before we merge, however. They are marked with TODO DALEK.
* tor-netdoc: Use the new HandshakeType enum to represent CREATE2 HTYPEs (fmt).Gabriela Moldovan2023-10-301-17/+21
|
* tor-netdoc: Use the new HandshakeType enum to represent CREATE2 HTYPEs.Gabriela Moldovan2023-10-302-15/+16
| | | | | | | | | | | Representing the supported HTYPEs as `HandshakeType`s instead of `u32`s makes it more difficult to pass in wrong/invalid values to `HsDescBuilder::create2_formats`. This also fixes a descriptor publisher bug spotted by @jnewsome, where the advertised CREATE2 HTYPEs included HTYPE `1`, which is actually supposed to be a reserved value. The publisher now only advertises the `NTOR` HTYPE (just like C Tor).
* Remove a broken rustdoc link and fix a typo.Nick Mathewson2023-10-271-3/+0
|
* tor-cert, tor-netdoc: Use EncodedEd25519Cert instead of Vec<u8>.Gabriela Moldovan2023-10-253-11/+8
|
* tor-netdoc: Change return type of create_desc_sign_key_cert.Gabriela Moldovan2023-10-251-6/+3
| | | | | | `Bug` wasn't necessarily the right error type here. Plus, with the new error type adding new errors (i.e. `CertEncodeError` variants), is not a breaking change.
* tor-netdoc: Building a descriptor now only requires the public part of ↵Gabriela Moldovan2023-10-251-8/+10
| | | | blinded_id.
* tor-netdoc: Remove now-unused blinded_id field.Gabriela Moldovan2023-10-252-7/+0
|
* tor-netdoc: Update HsDesc, HsDescOuter to accept the hs_desc_sign cert as an ↵Gabriela Moldovan2023-10-252-21/+32
| | | | | | | | | | argument. This will enable us to (eventually) the load the descriptor signing key cert from the keystore (as opposed to always recomputing it when building the `HsDesc`). Part of #1048