summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
* Bump versions for tor-* and arti-* cratesSteven Engler2026-08-031-13/+13
| | | | | | | ```bash readarray -t bump < <(maint/list-crates | grep -P '^tor-|^arti-') for crate in "${bump[@]}"; do cargo set-version --bump minor -p "${crate}"; done ```
* Merge branch 'test-support-more' into 'main'Clara Engler2026-08-035-71/+74
|\ | | | | | | | | tor-netdoc: testing: Expose some more test utilities See merge request tpo/core/arti!4250
| * tor-netdoc: testing: Expose regsubIan Jackson2026-07-304-10/+16
| | | | | | | | Involves code motion. Review with --color-moved.
| * tor-netdoc: testing: Expose assert_eq_or_diff (fmt)Ian Jackson2026-07-301-7/+1
| | | | | | | | I don't understand why this suddenly, but whatever.
| * tor-netdoc: testing: Expose assert_eq_or_diffIan Jackson2026-07-304-61/+65
| | | | | | | | Involves lots of code motion. Review with --color-moved.
| * tor-netdoc: testing: Remove a spurious cfgIan Jackson2026-07-301-1/+0
| | | | | | | | This whole module is gated by the very same condition.
| * tor-netdoc: testing: Actually expose the test_support moduleIan Jackson2026-07-301-1/+1
| | | | | | | | I discovered this didn't work, when I tried to use it.
* | Merge branch 'verify-fix' into 'main'Clara Engler2026-07-301-7/+12
|\ \ | | | | | | | | | | | | Important pre-release fixes for RouterDescUnverified::verify() See merge request tpo/core/arti!4252
| * | 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.
* | | Merge branch 'testdata-typo' into 'main'Ian Jackson2026-07-302-3/+3
|\ \ \ | |/ / |/| | | | | | | | tor-netdoc: Fix typo in testdata-live-download and RELAY_* constants See merge request tpo/core/arti!4249
| * | tor-netdoc: Fix typo in testdata-live-download and RELAY_* constantsIan Jackson2026-07-302-3/+3
| |/ | | | | | | | | I still had the previously downloaded full consensus locally, so running testdata-live-download fixed the Rust file.
* | tor-netdoc: Add various TODO follow-upsClara Engler2026-07-302-3/+8
| |
* | tor-netdoc: Make RouterDescUnverified::verify() publicClara Engler2026-07-302-2/+2
| |
* | 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: Enable cvt-x25519 for llcryptoClara Engler2026-07-301-1/+1
| | | | | | | | Required for convert_curve25519_to_ed25519_private().
* | 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: Derive Copy for Ed25519PublicClara Engler2026-07-292-1/+2
|/ | | | The underlying type also implements Copy. We will need it later.
* 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.
* Merge branch 'clippy' into 'main'opara2026-07-272-6/+2
|\ | | | | | | | | Fix some recently-appearing clippy lints See merge request tpo/core/arti!4240
| * tor-netdoc: Replace two open-coded slice::fillIan Jackson2026-07-272-6/+2
| | | | | | | | Placates recent clippy.
* | Merge branch 'intern' into 'main'Ian Jackson2026-07-273-7/+5
|\ \ | | | | | | | | | | | | Tidy some uses of Intern See merge request tpo/core/arti!4233
| * | tor-netdoc: Make RouterStatus.port_policy use Intern, not ArcIan Jackson2026-07-272-2/+1
| | | | | | | | | | | | We intern these in Microdesc, and should be consistent.
| * | tor-netdoc: Make the str in a SoftwareVersion be Intern (fmt)Ian Jackson2026-07-271-3/+1
| | |
| * | tor-netdoc: Make the str in a SoftwareVersion be InternIan Jackson2026-07-272-3/+4
| |/ | | | | | | Rather than converting it to an Arc. This is the new idiom for Intern.
* | Merge branch 'testdata-export-bis' into 'main'Ian Jackson2026-07-2732-484/+728
|\ \ | | | | | | | | | | | | tor-netdoc testdata-live: More shell script, less macrology See merge request tpo/core/arti!4238
| * | tor-netdoc testdata-live: Abolish selected_relays.rsIan Jackson2026-07-272-27/+0
| | | | | | | | | | | | | | | This is no longer used. Get rid of the code which generates it, and the generated file.
| * | tor-netdoc testdata-live: Switch to generated_consts.rsIan Jackson2026-07-271-61/+7
| | | | | | | | | | | | | | | This gits rid of the macrology, apart from the generated macro module file.
| * | tor-netdoc testdata-live-download: Generate generated_consts.rsIan Jackson2026-07-272-1/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the code for the new approach. It's kind of ad-hoc but also much less deep than the previous macrology. And, run the script to see the output. Currently that file isn't used. For now we leave the shell script code for generating selected_relays.rs in testdata-live-download. The new code for generated_consts.rs is very different, so it's clearer to split the changes up this way.
| * | tor-netdoc testdata-live: Run a downloadIan Jackson2026-07-2728-396/+398
| | | | | | | | | | | | | | | | | | | | | | | | | | | I'm going to change the generation, and that means I need input files, so I need to run a download (as per the comment in testdata-live-download). I'm doing this first, so the rest of the MR can see individual changes.
* | | Merge branch 'testdata-report-nits' into 'main'Ian Jackson2026-07-271-1/+5
|\| | | |/ |/| | | | | tor-netdoc testdata-live: Two nits See merge request tpo/core/arti!4237
| * tor-netdoc testdata-live: Add a comment about running without downloadIan Jackson2026-07-271-0/+4
| |
| * tor-netdoc testdata-live: Fail if curl failsIan Jackson2026-07-271-1/+1
| |
* | Merge branch 'netdoc-affordances' into 'main'Ian Jackson2026-07-276-20/+38
|\ \ | | | | | | | | | | | | tor-netdoc: Add a few affordances See merge request tpo/core/arti!4235
| * | tor-netdoc: docs: fix typos and linkifyIan Jackson2026-07-271-2/+2
| | | | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4235#note_3439437 https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4235#note_3439438
| * | tor-netdoc: Don't writhe in a doc commentIan Jackson2026-07-271-1/+1
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4235#note_3439436
| * | tor-netdoc: derive Hash for netstatus::ConsensusMethodsIan Jackson2026-07-232-1/+2
| | |
| * | tor-netdoc: Use encode_netdoc_unsigned in several placesIan Jackson2026-07-233-19/+9
| | |
| * | tor-netdoc: Provide free functions for encodingIan Jackson2026-07-232-0/+27
| | | | | | | | | | | | | | | I keep finding I want to encode things and then I have to prat about with a NetdocEncoder. Let's provide potted versions.
* | | Merge branch 'testdata-export' into 'main'Ian Jackson2026-07-2732-357/+474
|\ \ \ | |/ / |/| / | |/ | | tor-netdoc testdata-live: Export for the benefit of other crates See merge request tpo/core/arti!4229
| * tor-netdoc testdata-live: Export for the benefit of other cratesIan Jackson2026-07-232-0/+89
| | | | | | | | | | | | | | | | Add a new testdata_live module which is exposed with the testing features, containing the testdata-live in string constants. This avoids the need for test cases in other crates to walk the filesystem to an area outside their own crate path.
| * Require derive-deftly 1.11.4Ian Jackson2026-07-231-1/+1
| | | | | | | | | | | | | | | | | | We're about to *use* the fix that was in 1.11.4. We already updated the lockfile in !4228, so this is just Cargo.toml changes (which will prevent the minimal-versions tests failing when we change the code to rely on the fix). git-grep -l '^derive-deftly' |xargs perl -i~ -pe 's{\b\Q1.11.3\E\b}{1.11.4}g'
| * tor-netdoc testdata-live: Run a downloadIan Jackson2026-07-2328-356/+367
| | | | | | | | | | | | | | This updates everything, but really I'm just running it to create the new selected_relays.rs file. The meaning of this file will become clear shortly.
| * tor-netdoc testdata-live: Write out a selected_relays.rs fileIan Jackson2026-07-231-0/+17
| | | | | | | | | | | | | | We could use build.rs for this, but since we have a script already, this seems better. The meaning of this file will become clear shortly.