aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/doc/microdesc.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: Use encode_netdoc_unsigned in several placesIan Jackson2026-07-231-6/+2
|
* Merge branch 'microdesc-sha' into 'main'Clara Engler2026-06-251-39/+56
|\ | | | | | | | | tor-netdoc: Remove document hash from Microdesc struct (and add MicrodescAndHash for that) See merge request tpo/core/arti!4138
| * Apply deferred rustfmt churnIan Jackson2026-06-221-5/+1
| |
| * tor-netdoc: Break Microdesc up into Microdesc and MicrodescAndHashIan Jackson2026-06-221-20/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | The Microdesc type having a copy of the document hash was always weird, and it's weirder now that there's all these parse2 types that don't have it and parse2 derives on Microdesc that don't touch it. Make a new type for the descriptor and its hash. Use deref to arrange that the new type works almost like the old one. Adjust the use lines in the dependencies to temporarily import MicrodescAndHash as Microdesc.
| * tor-netdoc: Move some Microdesc methodsIan Jackson2026-06-221-20/+23
| | | | | | | | | | Code motion, plus adding a new impl block, to make the next commit clearer.
* | tor-netdoc: Replace string slices with str::get() in docClara Engler2026-06-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | This commit replaces the use of string slices with str::get() in all document related code. While this is not a perfect replacement for it, the relevant parts in the code heavily depend upon the byte offsets returned by the low level (legacy) parser where changing it would lead to a very big refactoring. Nonetheless, this approach is better because returning a bug is better than crashing.
* | tor-netdoc: Wrap port policies in InternClara Engler2026-06-241-5/+4
| | | | | | | | This commit wraps the port policies in an Intern.
* | tor-netdoc: Wrap family in InternClara Engler2026-06-241-1/+2
|/ | | | This commit wraps the relay family in an Intern instead of an Arc.
* tor-netdoc: Microdesc: derive ConstructorIan Jackson2026-06-221-2/+10
|
* tor-netdoc Micordesc: Make intro item type publicIan Jackson2026-06-221-6/+6
| | | | | We don't need the type to be private. Indeed, we'd like it not to be to make Microdesc construction with Constructor regular
* tor-netdoc Micordesc: rename the intro item typeIan Jackson2026-06-221-3/+3
| | | | | "OnionKeyIntro" is particularly odd. Mostly people won't need to refer to this, anyway.
* tor-netdoc test: Add a round-trip test for microdescriptorsIan Jackson2026-06-221-1/+12
|
* tor-netdoc: Avoid encoding default values in microdescsIan Jackson2026-06-221-4/+4
|
* tor-netdoc: derive encoding for microdescriptorsIan Jackson2026-06-221-2/+2
| | | | | | | All these types already have parsing derives. The encoding isn't quite right yet. It's legal, but doesn't match C Tor as well as we'd like.
* everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-091-0/+1
| | | | | | | | This commit adds #[allow(clippy::string_slice)] to all functions in the code where string slices are used, alongside a TODO comment. We do this add the function header to have it consistent, as things like expression based allow's are still experimental.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-netdoc: Test for UTF-8 port policy edge case52252252026-06-031-0/+6
| | | | | | | This commit adds a tor-netdoc test for checking for an edge case related to UTF-8 symbols found within netdocs. See arti#2566
* tor-netdoc: parse2: Add missing ItemObjectParseable to preludeIan Jackson2026-04-291-2/+0
| | | | And remove a then-unneeded import in a using module.
* tor-netdoc: Un-gate features in doc/microdesc.rs (fmt)Ian Jackson2026-04-281-3/+1
|
* tor-netdoc: Un-gate features in doc/microdesc.rsIan Jackson2026-04-281-16/+10
| | | | | | These are all parse2, and there are no blocking TODOs. We're leaving `build_docs` alone.
* tor-netdoc: Add manual happy families microdesc testClara Engler2026-04-081-0/+35
| | | | | | | This commit adds a manual test case for happy families in microdesc with parse2. Manual in the sense that we hardcode a microdescriptor taken from the wild here, as testdata2 does not contain them at the current moment, which is unfortunate but reported.
* tor-netdoc: Adjust family values for microdesc testClara Engler2026-04-081-12/+1
| | | | | This commit adjust the family value for the microdesc test to the one actually found in testdata2/.
* tor-netdoc: Update microdesc test EC keysClara Engler2026-04-081-9/+8
| | | | | | This commit updates the microdesc test EC keys with the new ones from testdata2/ while also changing the encoding from a byte array to the base64 value found in the microdesc itself.
* tor-netdoc: Update microdesc test onion keyClara Engler2026-04-081-5/+5
| | | | | This commit updates the microdesc onion key with the new one from testdata2.
* tor-netdoc: "Remove" assert_eq for mds[6]Clara Engler2026-04-081-40/+0
| | | | | | | | | | This commit removes the assert_eq for mds[6]. The reason for this was to have a test case with happy families set. However, these values were manually hacked into the respective file which is not the correct way. Instead, we will test this in a separate test that will be added later, as the current testdata2/ is not capable of this. This is an already reported chutney issue.
* tor-netdoc: No longer ignore microdesc parse2 testClara Engler2026-04-081-2/+0
|
* tor-netdoc: Add TODO to test ignoringClara Engler2026-04-021-0/+1
|
* tor-netdoc: Disable broken test for nowClara Engler2026-04-021-0/+1
|
* tor-netdoc: Note on hardcoded test vectorsClara Engler2026-04-021-0/+5
|
* tor-netdoc: Remove onion_key accessorClara Engler2026-04-021-5/+0
|
* tor-netdoc: Use Curve25519Public for parsingClara Engler2026-04-021-6/+7
| | | | | | This commit removes the implementation of ItemArgumentParseable for curve25519::PublicKey in favor of using the already existing Curve25519Public, which also got beefed up slightly.
* tor-netdoc: Refactor Ed25519IdentityLineClara Engler2026-04-021-16/+17
| | | | | This commit refactors Ed25519IdentityLine by deriving as much as possible.
* tor-netdoc: Use proper PEM parser for testvecsClara Engler2026-04-021-21/+26
| | | | | | | | | This commit uses a proper PEM parser as a dev-dependency to tor-netdoc for parsing PEM entries, instead of hard-coding long DER byte strings. It is better to use an external crate for this here, rather than the existing somewhat accessible (only through traits) implementation of parse2, because it feels wrong testing parse2 with parse2.
* tor-netdoc: Reorder Microdesc according to specClara Engler2026-04-021-11/+11
|
* tor-netdoc: Properly parse mutliple family-idsClara Engler2026-04-021-13/+14
| | | | | | | | | | | | | This commit fixes a bug in the microdescriptor parser to properly parse multiple family-ids. Previously, we interpreted the spec to simply contain multiple `family-ids` lines. This is wrong however. Instead, there may only be a single such line with multiple values. To fix this issues, we itnroduce a `RelayFamilyIds` type, similar to `RelayFamily`, that stores multiple `RelayFamilyId` entires in a `Vec`. Then, we just derive `ItemValueParseable` on it and win.
* tor-netdoc: Add a test for Microdesc with parse2Clara Engler2026-04-021-0/+94
|
* tor-netdoc: Derive NetdocParseable for MicrodescClara Engler2026-04-021-7/+54
| | | | | | | | | | | | This makes it possible to parse2 micro descriptors, which will be very useful later on. For this, it makes a few changes. Most notably, it introduces a (private) field called `onion_key`, which stores an optional RSA onion key, as it serves as the introduction line for this netdoc document type. Besides, it also changes the `ed25519_id` type to the `Ed25519IdentityLine` wrapper type, although the signature of the respective getter remains the same.
* tor-netdoc: RSA: rename helper type to RsaPublicParse1HelperIan Jackson2026-01-061-1/+1
| | | | | | This is used by the old parsing code, apparently as a thing to hang the checking methods off. It is confusing to have so many different RSA types! Let's at least rename this one.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* tor-netdoc: Abolish `dangerous-expose-struct-fields`; always expose, insteadIan Jackson2025-10-011-20/+8
| | | | Fixes #2192
* tor-netdoc: rs: Introduce and use DOC_DIGEST_LENIan Jackson2025-08-181-1/+4
| | | | Part of making ns.rs and md.rs largely identical.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-netdoc: Removed dependency on `once_cell`hashcatHitman2025-06-141-3/+3
| | | | | | - Replaced `once_cell::sync::Lazy` with `std::sync::LazyLock`. Signed-off-by: hashcatHitman <[email protected]>
* netdoc: Make some parsing init functions fallible.Nick Mathewson2025-03-171-8/+9
| | | | | | | I'm about to make our parsers reject some strings at construction time, so it makes sense to have these functions become fallible. This is a breaking change.
* netdoc: Add "family-ids" line to microdesc parserNick Mathewson2025-02-121-1/+45
|
* Make TAP keys optional when parsing documents.Nick Mathewson2024-06-271-7/+21
| | | | | This is the client-side part of phase 1 for proposal 350, which will eventually remove TAP completely from the Tor network.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.Gabriela Moldovan2023-05-101-1/+1
| | | | | | | | | | | `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]>