| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |\
| |
| |
| |
| | |
tor-netdoc: Remove document hash from Microdesc struct (and add MicrodescAndHash for that)
See merge request tpo/core/arti!4138
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| | |
Code motion, plus adding a new impl block, to make the next commit
clearer.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| | |
This commit wraps the port policies in an Intern.
|
| |/
|
|
| |
This commit wraps the relay family in an Intern instead of an Arc.
|
| | |
|
| |
|
|
|
| |
We don't need the type to be private. Indeed, we'd like it not to be
to make Microdesc construction with Constructor regular
|
| |
|
|
|
| |
"OnionKeyIntro" is particularly odd. Mostly people won't need to
refer to this, anyway.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
This commit adds a tor-netdoc test for checking for an edge case related
to UTF-8 symbols found within netdocs.
See arti#2566
|
| |
|
|
| |
And remove a then-unneeded import in a using module.
|
| | |
|
| |
|
|
|
|
| |
These are all parse2, and there are no blocking TODOs.
We're leaving `build_docs` alone.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
This commit adjust the family value for the microdesc test to the one
actually found in testdata2/.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
| |
This commit updates the microdesc onion key with the new one from
testdata2.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
This commit removes the implementation of ItemArgumentParseable for
curve25519::PublicKey in favor of using the already existing
Curve25519Public, which also got beefed up slightly.
|
| |
|
|
|
| |
This commit refactors Ed25519IdentityLine by deriving as much as
possible.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
| |
Fixes #2192
|
| |
|
|
| |
Part of making ns.rs and md.rs largely identical.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
- Replaced `once_cell::sync::Lazy` with `std::sync::LazyLock`.
Signed-off-by: hashcatHitman <[email protected]>
|
| |
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
This is the client-side part of phase 1 for proposal 350,
which will eventually remove TAP completely from the Tor network.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
`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]>
|