| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
| |
| |
| |
| | |
Not just NetParams<i32>. We're going to want it for NetParams<u32> in
a moment.
|
| | | |
|
| | |
| |
| |
| | |
Call the existing string encoding code.
|
| | |
| |
| |
| |
| | |
This seems trivial enough I don't feel the need to mark it
"incomplete" even though there is no test case.
|
| | | |
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit changes the data type of RouterDesc::or_address from
Option<(net::IPv6Addr, u16)> to Vec<net::SocketAddr>.
This is the correct behavior according to the spec, meaning I will not
give a lengthy explanation on why this is better.
Reviewers might now be questioning whether the spec is wrong and/or if
this is a dangerous change, as Arti used to only extract the first IPv6
address and CTor doing a similar thing.
Following an IRC discussion with nickm@, we came to the conclusion that
both implementation techniques are right. It is okay for the document
to hold multiple addresses, it is okay for the implementation to ignore
all but the first (IPv6 address). What is not okay however, is for an
implementation to reject documents with multiple addresses.
Besides, router descriptors are not used in the existing code for
selecting the address of a relay, meaning this change has very little
practical meaning.
|
| |
|
|
| |
I unwrapped this for conflict resolution.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As pointed out in
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413185
this was a duplicate.
The new NoFurtherArguments
* Implements encoding
* Implements more traits
* Is in the right module (types::misc - it's not just for parsing)
* Has a slightly better name
* Had an open-coded parsing impl (which we now replace)
* Had minor differences to docs (so we add a line to NoFurtherArguments)
|
| |
|
|
|
| |
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413183
|
| |
|
|
|
|
|
|
| |
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413182
I left the word "fixed" in some of the docs and error messages, where
it seemed to make sense.
|
| | |
|
| |
|
|
|
| |
Replacing poc's. The new define_fixed_string macro is really helping
here.
|
| |
|
|
|
| |
Defining a struct gives us a place to hang the documentation, and
avoids an accidentally-exhaustive tuple.
|
| |
|
|
|
|
|
| |
This is more code than the poc version but much of the extra is
documentation, and it seems much less magical this way.
We still need a handwritten parser for plain consensuses, sadly.
|
| |
|
|
|
|
|
|
| |
The order of arguments of poc's ns_type macro is different to that of
the real code. This is very confusing!
However, the type is correct, once we've added the singleton signature
for votes.
|
| |
|
|
|
|
| |
We're going to need this for type-driven parsing of the
necessarily-absent flavour argument in a vote's
`network-status-version`.
|
| |
|
|
|
|
| |
This will let us (re)use the existing signature checking code with the
parse2 type, since we'll be able to make a SignatureGroup out of a
parse2'd UnverifiedNetworkStatus.
|
| |
|
|
|
| |
This will allow it to be a replacement inside `SignatureHashes`.
Keeping the fields private seems to have been an oversight.
|
| | |
|
| |
|
|
|
| |
This is the whole of the footer section, with docs, appropriate
derives, and so on.
|
| | |
|
| |
|
|
|
| |
Add links to the spec, and delete explanatory text (that ought to be
in the spec, not here).
|
| |
|
|
| |
This matches the spec.
|
| |
|
|
|
|
|
|
|
|
|
| |
This will allow us to include this, conditionally, in the new
per-variety footer types for consensuses, without too much disruption
to the existing code.
We don't leave a compatibility alias because we're going to want a
Footer in each_variety.rs which is the actual sub-document. This old
struct isn't suitable because it doesn't have the intro item and is
just for consensuses.
|
| | |
|
| |
|
|
| |
We're going to want quite a lot of this for eg network-status-version.
|
| |\
| |
| |
| |
| | |
Add Bandwidth support to Router Descriptors
See merge request tpo/core/arti!4005
|
| | |
| |
| |
| |
| |
| | |
This commit adds the bandwidth field to the RouterDesc struct as it is
found within the spec. The legacy parser will not support it, hence why
we do default values there.
|
| | |
| |
| |
| |
| | |
This commit adds the bandwidth struct for router descriptors which is
present in the `bandwidth` item.
|
| |\ \
| |/
|/|
| |
| | |
tor-netdoc: Implement encoding for referenced doc digest in rs entries
See merge request tpo/core/arti!3989
|
| | |
| |
| |
| |
| | |
This is not tested yet. It will be tested when we add round-trip
tests for votes.
|
| | |
| |
| |
| | |
This doesn't parse the keyword, only the value.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
* Rename it so that it doesn't mention parse2, because we're going to
want to encode too.
* Remove the indirection: rename the one in md.rs to be the name
that's used in `with = `. (Previously, things were more complicated
so the extra layer of indirection was helpful.)
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| | |
FixedB64 is the right type for these, when they are present.
This abolishes some ad-hoc boilerplate. Sadly we still need a bit of
that for Reasons.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Previously, this was't possible because derive-deftly wanted a string.
But now it can take a type, and types can contain macro calls inside
their generics etc.
This makes the code much more local and direct.
|
| | |
| |
| |
| | |
This is router *status* not router *descriptor*.
|
| | | |
|
| | | |
|
| |\ \
| | |
| | |
| | |
| | | |
Implement Elliptic Curve Certificates for Router Descriptors
See merge request tpo/core/arti!3939
|
| | | |
| | |
| | |
| | |
| | |
| | | |
This commit removes the Ed25519 round-trip verifciation in certificate
creation because it reduces the code complexity and is pretty uncommon
in cryptographic code.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | | |
This commit tests an invalid certified key type by adding a test that
does not use CertifiedKey::Ed25519.
|
| | | |
| | |
| | |
| | | |
No functional change.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit adjusts the tests to make it possible to add a test for a
non-matching certified key type.
For this, we simply store the certified key as a CertifiedKey and not as
an Ed25519Identity. Inevitably, this requires us to "force" create such
an identity on the fly in order to test the mismatch, which is fine
because it is an edge-case anyways.
|
| | | |
| | |
| | |
| | |
| | | |
Fixes the numbering due to a recently added additional check.
Review using --word-diff=color.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit properly verifies the certified key type by not returning a
bug but rather invalid data in the case of the certified key not being
an Ed25519 key.
Tests and number adjustments will follow.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit adds a new type, Ed25519FamilyCert, which works very similar
to Ed25519IdentityCert, except that it supports family certificates.
A notable difference is, that the identity key must be provided during
verification because it does not make sense to verify these certificates
without it.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit implements the Ed25519IdentityCert type using EmbeddableCert
logic that was introduced recently. These certificates contain the
identity key and the signing key of a relay and the type provides two
methods: .verify() for verification and .new_signed() for construction.
Besides, edcert::* is now made public as this is required now given that
it contains public types.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit adds the test utilities required for testing the
yet-to-be-implemented Ed25519IdentityCert and Ed25519FamilyCert types,
whose interface largely overlaps, making a test "framework" useful to
avoid code duplication.
Their interfaces consist of two functions:
* `.verify(Ed25519Identity, KeyUnknownCert, Duration, SystemTime)`
* Verifies a KeyUnknownCert whether it is valid, given a SystemTime
plus post valid tolerance alongside a well-known identity key in
the case of family certificates.
* `.new_signed(&ed25519::Keypair, Ed25519Identity, SystemTime)`
* Creates a new certificate from a signing keypair plus a certified
key alongside a SystemTime at when this certificate will expire.
The commit introduces a testing trait that will be implemented for both
types once added. Then, there are two generic tests that test the
generation and verification of a valid random one as well as a test that
tests violation of various constraints common to these certificates.
The generic trait is most notable for the .new_signed() and .verify()
method which we are roughly documented. Please see the next commit for
a concrete example if understanding is hard.
|