Commit Graph

98 Commits

Author SHA1 Message Date
Nick Mathewson 5f54be2234 Give up on suppressing that nightly-only clippy warning 2020-09-18 19:28:55 -04:00
Nick Mathewson 5e1e77a363 Make consensus documents valid DistDelay seconds earlier.
This will prevent arti from hitting the same issue as
https://gitlab.torproject.org/tpo/core/tor/-/issues/25756
2020-09-18 19:24:06 -04:00
Nick Mathewson 6a2c803f98 Resolve some nightly-only clippy warnings 2020-09-17 19:13:56 -04:00
Nick Mathewson eb24b6f019 Fix a panic bug in microdesc parsing.
Found by fuzzing!  The issue was that we were relying on the
arguments slice being within the input string, but we were sometimes
using a different _empty_ slice when there were no arguments.

I've noted a better solution in a comment.
2020-09-17 19:07:38 -04:00
Nick Mathewson 91db8ab6fb Add fuzzers for certs, netdoc, and proto.
This was remarkably simple.
2020-09-17 19:06:56 -04:00
Nick Mathewson ba546a798d use more correct expiration times 2020-09-17 15:19:12 -04:00
Nick Mathewson ee71abe560 Pare down and sort dependencies 2020-09-09 19:17:49 -04:00
Nick Mathewson 875e932898 New "linkspec" module to encapsulate info needed to connect/extend. 2020-09-08 20:43:15 -04:00
Nick Mathewson 8768222acb Start on accessors for relay weight. 2020-09-08 17:20:46 -04:00
Nick Mathewson 8ef0098716 Refactor timerangebound to unwrap bounds earlier.
This will make them easier to adjust
2020-09-08 13:54:01 -04:00
Nick Mathewson e31652afe1 Bugfix: parse ed25519 ids right in mds 2020-09-08 13:30:16 -04:00
Nick Mathewson b5ad25e0d4 Netdir: a few more accessors 2020-09-08 12:56:45 -04:00
Nick Mathewson 17217a7dfa netdoc: add a few accessors 2020-09-07 18:07:34 -04:00
Nick Mathewson a4f1b27334 Fix clippy warnings; improve key type for consensus. 2020-09-07 17:27:29 -04:00
Nick Mathewson b6a3642903 netdoc: ignore bad entries in families.
Some of these are nicknames, which we can safely ignore.
2020-09-07 16:57:57 -04:00
Nick Mathewson 919a7c5970 Start on a 'netdir' crate to wrap netdoc.
For now, this assumes an existing Tor cache directory.
2020-09-07 16:53:06 -04:00
Nick Mathewson b679ab216c Make MDConsensus also follow the checkable pattern. 2020-09-03 16:06:45 -04:00
Nick Mathewson fbb35dc72a Port authcert to use tor_checkable. 2020-09-03 15:02:36 -04:00
Nick Mathewson b3358673b5 Migrate certificate and routerdesc checking to tor-checkable
Now these types are parsed and returned wrapped inside a checkable
object.
2020-09-03 14:45:46 -04:00
Nick Mathewson 4b75c51882 Run cargo-upgrade. 2020-08-28 18:14:17 -04:00
Nick Mathewson 6fabb54033 netdoc: Parser for microdesc consensus documents
There's more to do here, and things to refactor, but this ought to
be enough to get a rudimentary client working.
2020-08-27 14:30:24 -04:00
Nick Mathewson 86f6f30b6d netdoc: parse multiple authcerts from a string. 2020-08-27 12:54:07 -04:00
Nick Mathewson 696e7ad334 netdoc: add a check_len method for B64 2020-08-26 10:57:07 -04:00
Nick Mathewson d4af6a163f Add a B16 argument type, to mirror B64. 2020-07-20 20:55:47 -04:00
Nick Mathewson bbb8fea39b More parsing for fingerprints, including non-spaced fingerprints. 2020-07-20 20:55:47 -04:00
Nick Mathewson 8c0bbfef2c tor-netdoc: Make SectionRules derive Clone.
This is going to come in handy for the networkstatus stuff, where I
need to define different variants of SectionRules for votes and
consensuses.
2020-07-20 20:55:47 -04:00
Nick Mathewson 173bec26a5 Update to latest packages; ed25519 now needs signature crate traits. 2020-07-20 20:55:03 -04:00
Nick Mathewson 7bd7e7ec7d Run cargo fix --edition-idioms 2020-06-26 13:17:14 -04:00
Nick Mathewson e1bbc2fdb0 Run "cargo update". 2020-06-21 11:14:56 -04:00
Nick Mathewson c602883881 Use "cargo upgrade" from cargo-edit to list current versions 2020-06-12 21:06:07 -04:00
Nick Mathewson d36f52eea9 Mark a variable unused 2020-06-12 20:04:55 -04:00
Nick Mathewson c7285c9449 Add documentation for authcert parsing. 2020-06-11 17:08:59 -04:00
Nick Mathewson 6264041b77 update to use latest rust-crypto traits and modules 2020-06-10 14:16:07 -04:00
Nick Mathewson c13728eaa2 Add a couple of commits missing from previous. 2020-06-09 18:46:56 -04:00
Nick Mathewson 3b4c828cb7 netdoc: initial implementation of authority certs. 2020-06-09 17:23:45 -04:00
Nick Mathewson 2d8021420f netdoc: note a forward-compatibility issue with RSA signatures. 2020-06-09 17:22:49 -04:00
Nick Mathewson 6ff619aab3 netdoc: when parsing from a string, detect extra tokens 2020-06-09 14:06:17 -04:00
Nick Mathewson 4408fc7084 Netdoc: allow parsing multiple routerdescs from a string. 2020-06-09 13:58:43 -04:00
Nick Mathewson 4a5b31d6cd netdoc: report microdesc errors at correct offsets. 2020-06-09 13:13:34 -04:00
Nick Mathewson d4f58b0977 netdoc: fix microdesc digest calculation at last. 2020-06-09 13:07:44 -04:00
Nick Mathewson 47c3a11d2c Add a "first_item" entry for Section.
This will make it simpler to implement digests for sections.
2020-06-09 12:44:24 -04:00
Nick Mathewson 96f3d8c846 Add a "last_item" entry for Section.
This will make it simpler to implement digests for sections.
2020-06-09 12:39:07 -04:00
Nick Mathewson ad79778a39 netdoc: recover from microdesc parsing errors
On an error, advance to the start of the next microdesc.

There's a possible issue with this approach where if we aren't
careful, we might wind up in an infinite loop.  I've made a comment
about the fragility here, but it would probably be good to revisit
this design.
2020-06-08 11:52:26 -04:00
Nick Mathewson 624843668a netdoc: add an iterator that can parse annotated microdescs 2020-06-07 18:57:26 -04:00
Nick Mathewson 78aa76ab36 Implement parsing for microdescriptor annotations
This patch also updates the microdescriptor parsing so we can handle
a whole bunch of them in a row.
2020-06-06 20:51:22 -04:00
Nick Mathewson 1e8bde2c45 netdoc: fix behavior when using a fancy closure with PauseAt.
Previously, every call to peek() or next() would call self.pred().
But this would run us into trouble if we were using a closure that
had mutable state, since it would stop us from checking for things
like "the third occurrence of the foo token".

Now we store the value of self.pred(self.peek()).
2020-06-06 17:13:06 -04:00
Nick Mathewson fe93263d35 netdoc: add annotation fields for microdescriptors 2020-06-06 15:31:03 -04:00
Nick Mathewson b3f2e273c5 note that microdescriptor sha256 calculation is wrong 2020-06-03 17:26:18 -04:00
Nick Mathewson 5d0990658a Restore a pause_at() method, but for NetDocReader. 2020-06-03 17:24:14 -04:00
Nick Mathewson 81f67e240b Remove the Pausable trait as busted.
We need to have the Peekable be long-lived, so we can't consume it.
We _could_ create a second Peekable, which is apparently what we
have been doing, but that breaks down when we try to do it again.
2020-06-03 17:08:47 -04:00