aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/doc/routerdesc.rs
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'fix-incomplete' into 'main'Nick Mathewson2026-08-051-2/+0
|\ | | | | | | | | tor-netdoc: Fix left-over incompletes See merge request tpo/core/arti!4273
| * tor-netdoc: Fix left-over incompletesClara Engler2026-08-041-2/+0
| | | | | | | | | | This removes two left over incomplete feature flags. Follow-up to c20df8c5f879806f7044c6e26d9e69404c88cfa3.
* | Merge branch 'rd-comment-outdated' into 'main'gabi-2502026-08-051-5/+0
|\ \ | | | | | | | | | | | | tor-netdoc: Remove outdated top-level RouterDesc comment See merge request tpo/core/arti!4274
| * | tor-netdoc: Remove outdated top-level RouterDesc commentClara Engler2026-08-041-5/+0
| |/ | | | | | | | | | | | | | | This feature is no longer present and we now always compile with router descriptors enabled, deferring the optimization to the Rust compiler and linker respectively. Follow-up to arti!3972
* | Merge branch 'consistent-rd-doclinks' into 'main'opara2026-08-041-37/+18
|\ \ | | | | | | | | | | | | Make RouterDesc item docs consistent See merge request tpo/core/arti!4279
| * | tor-netdoc: Make RouterDesc item docs consistentClara Engler2026-08-041-37/+18
| |/ | | | | | | | | | | | | | | | | | | Right now, the documentation for the items is inconsistent in the sense that some items contain specification links whereas others contain copies of the specification. This has historic reasons during the development, but ultimately links to the specification are superior, as they provide up-to-date information and are the canonical source.
* | tor-netdoc: Run cargo-fmt subsequentiallyClara Engler2026-08-041-2/+4
| | | | | | | | No functional change, purely formatting.
* | tor-netdoc: Move misc::routerdesc into types::descriptorClara Engler2026-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | This commit moves the remainder of misc::routerdesc into a new module called types::descriptor, which contains the shared types needed in router descriptors as well as extra-info documents. Please review with --color-moved --color-moved-ws=allow-indentation-change, as this is mainly code motion, except for parts where inputs and type aliases had to be fixed.
* | tor-netdoc: Split types::misc::routerdesc into routerdescClara Engler2026-08-041-1/+177
|/ | | | | | | | | | | | | | This commit moves all non-signature related parts from types::misc::routerdesc into doc::routerdesc, because they are only required for that specific netdoc. The signature related parts will be moved in the next commits, as we will need those for extra info documents as well. Review with --color-moved --color-moved-ws=allow-indentation-change. This is mostly code motion with small import/type name fixes being the notable exception.
* tor-netdoc: Mark RouterDesc verification as completeClara Engler2026-08-031-4/+1
|
* tor-netdoc: Run cargo-fmtClara Engler2026-08-031-68/+68
| | | | | No functional change, please review with --minimal --color-moved --color-moved-ws=allow-indentation-change.
* tor-netdoc: Use TimeRangeBoundBuilder for verificationClara Engler2026-08-031-34/+13
| | | | | | | | | | | This commit utilizes TimeRangeBoundBuilder for the verification of router descriptors by replacing all calls of `.dangerously_unwrap_timely()` with `.unwrap_with()`, while also wrapping the actual logic inside a closure which is then called by `TimeRangeBound::build_intersect()` in the end. Keep in mind, that the replacement also leads to the removal of the use of tuples, as `.unwrap_with()` only returns the actual item.
* tor-netdoc: Mark RouterDescUnverified::verify() incompleteClara Engler2026-07-301-0/+3
| | | | Better do it before the release so we can think about it a bit more.
* tor-netdoc: Properly obtain min/max for start and end timeClara Engler2026-07-301-2/+2
| | | | | | | | | | | We need to obtain the maximum of the lower bound and the minimum of the upper bound instead of vice versa. Another example on why we should replace this with a better implementation. Likewise, `expiry` in the legacy verification code is also obtained like that.
* tor-netdoc: Rename min/max to start and end timeClara Engler2026-07-301-5/+7
| | | | | This makes it more clear, besides it will sound more "correct" with the next commit applied.
* tor-netdoc: Add various TODO follow-upsClara Engler2026-07-301-3/+5
|
* tor-netdoc: Make RouterDescUnverified::verify() publicClara Engler2026-07-301-2/+1
|
* tor-netdoc: Run cargo-fmtClara Engler2026-07-301-3/+13
|
* tor-netdoc: Allow dead_code for RouterDesc::verifyClara Engler2026-07-301-0/+1
| | | | Otherwise clippy complains.
* tor-netdoc: Add large RouterDesc verification testClara Engler2026-07-301-1/+169
| | | | | This commit adds a comprehensive test for router descriptor verification that tests various valid and invalid edge cases.
* tor-netdoc: Add test only rd_encode_sign() methodClara Engler2026-07-301-0/+46
| | | | | | | This is a bad encode_sign() method for RouterDesc that is testing only and will be used soon to implement testing for invalid router descriptors, for which we may need to create invalid ones in the first place.
* tor-netdoc: Call .verify() in test_parse2_simpleClara Engler2026-07-301-1/+8
|
* tor-netdoc: Add RouterDescUnverified::verify()Clara Engler2026-07-301-5/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements verification for router descriptors. 🎉 For this, the following checks are performed: * RouterDesc::identity_ed25519 is validly signed. * RouterDesc::master_key_ed25519 is as implied by identity_ed25519. * RouterDesc::fingerprint is as implied by RouterDesc::signing_key. * RouterDesc::ntor_onion_key_crosscert is validly signed. * RouterDesc::signing_key has correct length and exponent. * All RouterDesc::family_cert elements are valid. * The inner and outer RouterDescSignatures are valid. Unfortunately, we now have two implementations for that, as the legacy parse_internal() also implements its own verification logic for this. It seems merging these two together however would probably cause more harm than good, as the legacy verification is closely intertwined with legacy parsing, making a commonly shared verification logic hard to achieve. In other words: parse2 parses the descriptor in its entirety first, followed by verification afterwards, whereas the legacy code parses and verifies every field before advancing towards the next. Instead, I suggest to read through RouterDesc::parse_internal() and ensure that every verification related check present there is also present here. The notable exception to this is everything TAP related, which is absent on purpose here. Right now, this code is untested. I will add unit tests shortly afterwards.
* tor-netdoc: routerdesc: Abolish onion-key & -crosscert handling in old parserIan Jackson2026-07-291-38/+0
| | | | | | | `onion_key_crosscert` was already absent from `RouterDesc`, even though its item `onion-key-crosscert` was processed by the old parser. Delete it all.
* tor-netdoc: routerdesc: Abolish onion-key (obsolete TAP) fieldIan Jackson2026-07-291-11/+1
| | | | | | | | | | | | | | | | | See prop350 https://spec.torproject.org/proposals/350-remove-tap.html This is part of "Phase 3, Item 2: Remove vestigial TAP code in Arti". Technically we are not at phase 3 yet, because we haven't yet sunsetted C Tor 0.4.8 and made the dirauth changes in Phase 2. However, this field is not used in Arti right now. RouterDescs are used by client code for handling bridges (but we never use TAP keys), and the RouterDesc type will be used for generation and mirroring by by Arti Relay/Dirauth. In prop350 we have decided that we won't be deploying Arti Relay until this as been done.
* Use new TimeRangeBound name throughout the treeIan Jackson2026-07-161-2/+2
|
* Use new TimeBound name throughout the treeIan Jackson2026-07-161-4/+4
|
* tor-netdoc: Remove Eq on various typesClara Engler2026-07-021-2/+2
| | | | | This reverts the Eq derives added in !4150 while keeping the PartialEq, in order to support including this in Unknown.
* tor-netdoc: Add TODO for .encode_sign()Clara Engler2026-07-021-0/+1
|
* tor-netdoc: Change concept of test_parse2Clara Engler2026-07-021-4/+4
| | | | | | | This test is now called test_parse2_simple and intended to test simple parse2 and encode round-trip functionality without edge-cases and such. More edge tests will be added once we have a proper verification logic.
* tor-netdoc: Round-trip encoding testClara Engler2026-07-021-1/+23
| | | | | | This commit adds a round-trip encoding test to test_parse2 that encodes the decoded results and decodes them again in order to verify that the again decoded result is equal to the original one.
* tor-netdoc: Adjust test_parse2 to keep signaturesClara Engler2026-07-021-4/+5
| | | | | | | Required for round trip encode testing which we will add in the next commit. We only keep the actual RouterDescSignatures because then we can do Eq.
* tor-netdoc: NetdocEncodable for RouterDescClara Engler2026-07-021-5/+7
|
* tor-netdoc: NetdocEncodable for RouterDescSignaturesClara Engler2026-07-021-1/+1
|
* tor-netdoc: Derive Eq on RouterDescSignaturesClara Engler2026-06-291-1/+1
|
* tor-netdoc: Derive Eq on RouterDescClara Engler2026-06-291-1/+1
|
* tor-netdoc: Replace string slices with str::get() in doc (fmt)Clara Engler2026-06-241-2/+8
| | | | No functional change, just reformatting.
* tor-netdoc: Replace string slices with str::get() in docClara Engler2026-06-241-3/+2
| | | | | | | | | | | | 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-2/+1
| | | | This commit wraps the port policies in an Intern.
* tor-netdoc: Wrap family in InternClara Engler2026-06-241-3/+4
| | | | This commit wraps the relay family in an Intern instead of an Arc.
* tor-netdoc: Add TODOClara Engler2026-06-231-1/+1
|
* tor-netdoc: Replace assume_wellsigned() with unwrap_unverified()Clara Engler2026-06-231-10/+3
|
* tor-netdoc: Add small RouterDesc parse2 testClara Engler2026-06-221-0/+35
| | | | | | | | | This adds a very small RouterDesc parse2 test only verifying whether the testdata2 gets properly parsed, with a minimal length verification alongside two identity related fields. Once we have encoding and verification support, we have to extend this test of course.
* tor-netdoc: Add test only RouterDesc verifyClara Engler2026-06-221-1/+8
| | | | | Only for testing, just returns the inner body. Will be removed once we have a proper verify method.
* Derive NetdocParseableUnverified for RouterDescClara Engler2026-06-221-1/+15
| | | | | | | | | | | | | | Finally! 🎉 This commit derives NetdocParseableUnverified for RouterDesc by adding the respective derive_deftly attributes to the top-level definition as well as the member fields that require it. A .verify() method as well as unit tests will be added in the next commits. Encoding still depends on a few tiny papercuts but will otherwise be added shortly too, although in a different branch.
* Merge branch 'ntor-cc-rd' into 'main'Ian Jackson2026-06-171-5/+20
|\ | | | | | | | | Add ntor onion key cross certificate to RouterDesc See merge request tpo/core/arti!4109
| * tor-netdoc: Create NtorOnionKeyCrossCert at better placeClara Engler2026-06-171-9/+9
| | | | | | | | | | | | This commit moves the construction place for the NtorOnionKeyCrossCert from the final RouterDesc construction to the crosscert code block, which should be more correct.
| * tor-netdoc: Add ntor_onion_key_crosscert to RouterDescClara Engler2026-06-151-0/+12
| | | | | | | | | | This commit adds ntor_onion_key_crosscert to RouterDesc as well as integrating it into the legacy parser.
| * tor-netdoc: Extract ntor bit and cert in legacy parser (fmt)Clara Engler2026-06-151-3/+6
| | | | | | | | No functional change.
| * tor-netdoc: Extract ntor bit and cert in legacy parserClara Engler2026-06-151-3/+3
| | | | | | | | We will soon need it for the ntor cross certificate.