| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
| |
I find these names confusing. To my mind "check" implies a function
returning `Result<(), _>`.
Some other APIs use `unwrap` here but I think `if` is good.
|
| |
|
|
|
|
|
|
|
| |
It was confusing that one of these functions had "which bound"
mentioned in its name, but the other didn't. So add `end` and switch
from `tolerance` to `bound` (see previous commit message).
*This* commit should deal only in `extend_tolerance` and `end` and
shouldn't touch `extend_start_bound` or `extend_pre_tolerance`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although it is often used to apply a tolerance, it doesn't make sense
to say that this is extending the "tolerance" of a `TimeRangeBound`.
A `TimeRangeBound` doesn't have a tolerance, only bounds.
Also we should be consistent in our terminology, and use `start`
rather than `pre`.
We'll rename the other method too. Doing them one at a time will
makes it easier to spot any "pre/start" vs "<nothing>/end" slips:
*this* commit should deal only in `pre` and `start` and shouldn't
touch `extend_tolerance`.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
No functional change, just reformatting.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
There is no separate poc authcert type any more. This is a perfectly
fine test case.
Almost entirely code motion; review with
git show --color-moved --color-moved-ws=allow-indentation-change
|
| | |
|
| |
|
|
| |
Precisely the result of rustfmt.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
TimerangeBound is reasonably nice and this will fit in better when we
want to verify votes.
Adjust the one non-test call site (in tor-dirserver) using .and_then.
In the tests:
* Where we expected success, call .check_valid_at and add another .unwrap().
* Where we expected signature verification failure, delete the time parameters.
* Where we expected timeliness failure, call .check_valid_at and map the error.
* With nontrivial tolerance, add calls to `extend_[pre_]tolerance`.
|
| | |
|
| |
|
|
|
|
|
| |
We're about to make UnverifiedAuthCert::verify return a
TimerangeBound, not an AuthCert.
For the success cases, declare the expected return type.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The NetdocParseableUnverified derive macro implements this
trait (amongst other things). Traits and derive macros should have
aligned names.
This is only used for parsing, so let's keep the "Parseable" part of
the name.
I don't think the effort of deprecated alias, for downstream
compatibility, is worth it, our compatibility policy notwithstanding.
|
| | |
|
| |
|
|
| |
This doesn't let us do any verification or anything.
|
| |
|
|
|
| |
This module will be used when we derive ItemValueParseable on
Signature.
|
| | |
|
| |
|
|
|
|
|
|
| |
Abolish the parse2_test and encode_test modules. These mostly existed
because of cfg gates.
Now, we can unify the test module namespace, and also remove an
indentation level (that will come next, with rustfmt).
|
| |
|
|
|
|
|
|
|
|
|
| |
Change "ns-vote" gates to "incomplete":
* `vote` modules, and in the variety macro.
(And make a TODO more likely to be found.)
Change "parse2" gates to "incomplete":
* VoteAuthoritySection
|
| |
|
|
| |
As per #2492.
|
| |
|
|
|
|
|
|
|
| |
plain-consensus
"incomplete" is correct since encoded authcert depends on votes.
"plain-consensus" is going backwards, but stripping "plain-consensus"
gates from everything will be very intrusive.
|
| | |
|
| | |
|
| |\
| |
| |
| |
| | |
Fix the testdata2 situation
See merge request tpo/core/arti!3861
|
| | |
| |
| |
| |
| | |
This removes unused imports as well as the read_b64 and to_der helper
functions which are all no longer used.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit updates the dir_auth_cross_cert() test case with the new
constants, replacing the longclaw ones.
The replacement also involves a slight refactoring on the way how we
obtain the encoded and decoded variable, namely because we have the data
in a PEM encoded string now and no longer in separate file, making the
use of read_b64 impossible.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit updates the invalid outer signature test case by copying the
outer signature of the alternative certificate into our test object,
which should obviously render this to a failure.
It also updates the test vectors to the constant ones because it moves
away from longclaw.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit updates the invalid cross-cert test case by copying the
cross-cert from the alternative cert into our test object, resulting in
a failure.
Of course this also updates the other test vectors to use the constants
declared above, as this moves away from longclaw.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit updates the inconsistent fingerprint test case that tests
whether the fingerprint matches with the identity RSA key. For this, we
load the alternative authority cert and move its identity key into the
identity key of the canonical cert.
Of course, this also replaces the other test vectors that are now
required for this change because it moves away from longclaw.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This commit adds a new constant to the parse2 authcert unit tests,
ALTERNATIVE_AUTHCERT_RAW, with the idea being to be different than
AUTHCERT_RAW, which we will utilize in order to mix up cross-cert
objects from one authcert with the one of another one in order to see it
fail.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This commit updates the "trivial" test cases in the dir_auth_signature
unit tests, namely the ones concerning the outer signature as well as
the timestamp tolerance. A follow-up commit will also update the more
tricky ones, such as the ones testing inconsistent cross-certificates,
etc.
|
| | |
| |
| |
| |
| |
| | |
This commit constifies VALID_SYSTEM_TIME, a timestamp indicating a point
in time at which the certificate is valid. We will need this to test
timestamp validation.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit replaces the longclaw test vectors in dir_auth_cert with the
ones we constified previously and represent the ones found in
testdata2/.
It may look a bit odd that we replaced the file includes for the public
keys but this is because those files should have never existed in
testdata2/ in the first place and were only added by accident, meaning
that the current approach is the correct one.
|
| | | |
|
| | |
| |
| |
| |
| | |
This commit replaces a File::open with the AUTHCERT_RAW constant in the
dir_auth_cert test because that is obviously less error prone.
|
| | |
| |
| |
| |
| |
| |
| | |
This commit adds `const AUTHCERT_RAW` which `include_str`'s the actual
raw authcert we will use for parsing test purposes. The reason for that
being that a single include_str! of the same file is obviously better
than multiple ones.
|
| | |
| |
| |
| |
| | |
This commit constifies the authcert test vectors by extracting them from
testdata2/keys/authority_certificate.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit adds a to_rsa_id() helper function to the authcert tests in
order to convert a hex-encoded RSA identity to an RsaIdentity. It will
be required later on for converting the test vector values to the inner
representations and this function is helpful here because it avoids us
to do repetitive unwrapping and RsaIdentity::from_hex calls, which
overall increase the length/readability.
|
| | |
| |
| |
| |
| |
| |
| | |
This commit adds the pem_to_rsa_pk helper function to the authcert tests
in order to convert a PEM encoded RSA public key to the internal data
structure. It will be required later on in order to convert the test
vector strings to internal representations.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This commit adds a to_system_time helper function accepting an &str in
the Iso8601TimeSp format and converting it to a SystemTime to the
authcert test cases. It will be required later on in order to
conveniently convert human readable timestamps to the test vectors
expected from parsed data.
|
| | | |
|
| |/ |
|
| | |
|
| |
|
|
|
| |
Get rid of the version in poc. Instead, implement the same
functionality in terms of AuthCert::verify, outside poc.
|
| | |
|