Commit Graph

3819 Commits

Author SHA1 Message Date
Nick Mathewson 47a8c05ff3 Fix a rustdoc link. 2022-06-07 19:19:53 -04:00
Nick Mathewson 5854e4bbd9 Merge branch 'use-testing-rng' 2022-06-07 19:02:12 -04:00
Nick Mathewson b1b7f30de0 Merge branch 'netdir_provider_in_guardmgr_v2' into 'main'
Use NetDirProvider in GuardMgr

Closes #93

See merge request tpo/core/arti!568
2022-06-07 20:46:27 +00:00
Nick Mathewson 68942f0c40 Merge branch 'tor-netdoc-tests' into 'main'
Scattered tests throughout tor-netdoc

See merge request tpo/core/arti!562
2022-06-07 18:31:40 +00:00
Ian Jackson cc91252f9d Merge branch 'ticket463_01-cell' into 'main'
cell: Implement UDP cell ABI

See merge request tpo/core/arti!542
2022-06-07 18:03:27 +00:00
Nick Mathewson 126bf7dace Netdoc tests: extract decode-base64-ignore-ws code. 2022-06-07 12:45:59 -04:00
Nick Mathewson d30899d387 microdesc: make sure we recover from an error in the final md.
(This is slightly different from recovering from errors in the
middle of a list of mds, since in this case we _can't_ advance to the
next md.)

Also, note that a given branch is probably not reachable.
2022-06-07 12:45:59 -04:00
Nick Mathewson 42d6d02fbe netdoc: test case for microdesc with no ed25519 id.
The "bad-id" microdescriptor is hand-edited based on one from a
Chutney network.
2022-06-07 12:45:57 -04:00
Nick Mathewson 48fff1d735 netdoc: test a couple of accessors for AuthCert. 2022-06-07 12:45:57 -04:00
Nick Mathewson 97c8c27514 Netdoc: test enforcement for items that mustn't take objects.
Found via coverage.
2022-06-07 12:45:57 -04:00
Nick Mathewson c5e56c734d netdoc: remove an unused method. 2022-06-07 12:45:57 -04:00
Nick Mathewson 41be108b51 netdoc: Test more accessors for tokenized documents. 2022-06-07 12:45:57 -04:00
Nick Mathewson 102600e1c7 Netdoc: add accessor to error for ParseErrorKind
The kind type was already public, but we didn't give the user any
way to get it.
2022-06-07 12:45:57 -04:00
Nick Mathewson 171aa5ea00 netdoc: tests for parsing UnvalidatedEdCert. 2022-06-07 12:45:57 -04:00
Nick Mathewson 086ad51f82 tor-cert: Make more types Clone and Debug.
(Not sure how we missed this before. This is part of making more of
tor-netdoc tested.)
2022-06-07 12:45:57 -04:00
Nick Mathewson 9641d5ff59 Tests for netdoc RsaPublic type. 2022-06-07 12:45:57 -04:00
David Goulet 3da4b95434 udp: New AddressPort used in cells
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:29:51 -04:00
Ian Jackson a591bf353a udp: Allow empty hostname and no nul byte
After changes to the prop339, the domain name in an Address can only be
255 bytes max and can NOT contain nul byte(s).

Unit tests had to be modified to accept this change:

- Centralise msg_ip_address
- Add currently-passing tests for address length
- Test counted address length longer than type wants

Related to #463

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:23:27 -04:00
David Goulet 2ea709674d cell: Don't use NUL terminated string in CONNECT_UDP
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:22:05 -04:00
David Goulet 8fd6541985 cell: Move UDP to its own module and feature gate it
Related to #463

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:22:05 -04:00
David Goulet 8cb012ed78 cell: Implement DATAGRAM cell from prop339
Decoding and encoding of the DATAGRAM cell from proposal 339.

Related to #463.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:22:05 -04:00
David Goulet b7ae1976b5 cell: Implement CONNECTED_UDP cell from prop339
Decoding and encoding implemented according to proposal 339.

Related to #463
2022-06-07 12:22:05 -04:00
David Goulet d74482cd90 cell: Implement CONNECT_UDP cell from prop339
Decoding and encoding is implemented according to proposal 339
specifications.

Related to #463

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:22:05 -04:00
Nick Mathewson 5aebe1f198 Sort tor-rtmock dependencies. 2022-06-07 11:51:07 -04:00
Nick Mathewson cfad648e16 Merge branch 'llcrypto-openssl' into 'main'
add support for openssl backend in llcrypto

Closes #442

See merge request tpo/core/arti!550
2022-06-07 15:50:48 +00:00
Nick Mathewson 20eeca135b GuardMgr: Use installed netdir provider when we want a netdir
Some of our existing code optionally takes a netdir from the
caller.  When it doesn't give us one, use the netdir from the
installed NetDirProvider.

(Possibly someday we should remove the NetDir arguments
entirely. I'm deferring that because there are only two APIs
affected, and because making this change would force us to rewrite a
pretty large mess of unit tests.)
2022-06-07 11:44:51 -04:00
Nick Mathewson dc0a4e3c3d Move responsibility for GuardMgr NetDir updates to GuardMgr.
Previously it was the job of a task in CircMgr to do this; but we're
going to want to give GuardMgr full access to the latest NetDir for
this, and for other code-simplification reasons.

With this change I'm deprecating a couple of functions in
tor-circmgr.  It's no longer necessary for us to have an artificial
external way for you to feed new NetDirs to a circmgr.  (I could
just remove them, but I want practice deprecating.)
2022-06-07 11:44:51 -04:00
Nick Mathewson 957eb929a0 Remove now-redundant Send+Sync constraints alongside NetDirProvider 2022-06-07 11:44:51 -04:00
Nick Mathewson 2223398eb1 Make NetDirProvider require Send and Sync.
Our own code is the only stuff that consumes NetDirProvider, and all
the code that consumes it wants it to be Send and Sync.

Making this change avoids our having to define a new function to
upcast Arc<dyn Foo> to Arc<dyn NetDirProvider + Send + Sync>.
2022-06-07 11:44:51 -04:00
Ian Jackson 22d6671fc5 Merge branch 'updates-20220607' into 'main'
Update a few dependencies to more recent versions

See merge request tpo/core/arti!570
2022-06-07 15:44:03 +00:00
Nick Mathewson 3502a12da2 Add a `sleep` function to TaskSchedule.
Having this alias makes it easier to implement more complex
schedules, like those used in DirMgr.
2022-06-07 10:41:44 -04:00
Nick Mathewson 897a2d5fa0 Add "suspend" and "resume" to TaskSchedule.
Unlike "cancel" and "fire", "suspend" and "resume" don't change any
pending timers or events: they just prevent execution of those
events for a while, and let them resume later on.
2022-06-07 10:11:49 -04:00
Nick Mathewson aa3a81c3ba Upgrade serial_test dev-dependency to 0.7.0 2022-06-07 09:22:24 -04:00
Nick Mathewson 7f785b66c2 Upgrade float_eq dev-dependency to 1.0.0 2022-06-07 08:03:55 -04:00
Nick Mathewson df06e7b9bc Upgrade tls-api to latest versions in arti-hyper. 2022-06-07 08:01:39 -04:00
Nick Mathewson 125f99a723 Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!567
2022-06-05 16:25:24 +00:00
Dimitris Apostolou 8488192ba1
Fix typos 2022-06-05 18:47:51 +03:00
Nick Mathewson 018fda4f73 Merge branch 'testing-rng' into 'main'
New facility for deterministic and reproducible test PRNGs.

See merge request tpo/core/arti!561
2022-06-02 21:11:36 +00:00
Nick Mathewson 0e6a54351d Add an upcast_arc function to NetDirProvider.
This uses some apparently-standard trickery to implement a function
that lets us upcast from Arc<dyn Subtrait> to Arc<dyn Supertrait>.

I considered as alternatives `as_dyn_trait` and `cast_dyn_object`.
Both were nice, but generated a far larger interface than this.
2022-06-02 17:06:11 -04:00
Nick Mathewson 1076f25031 Rewrite tests in tor-netdir to use testing_rng()
The randomized tests in this crate take a lot of iterations to
converge, so they default to using a deterministic PRNG seed with
few iterations and higher tolerance, and they only randomize the
tests (with more iterations and tighter tolerances) when you
explicitly opt in to randomization.

(If you specify a seed explicitly, you're doing that to reproduce a
randomized case, so we use the same behavior.)
2022-06-02 15:48:41 -04:00
Nick Mathewson b4c0febd97 Refactor fallback-set tests to work with deterministic PRNG.
The trouble was that one of the helper functions they used
did not take a PRNG as an argument.
2022-06-02 14:59:55 -04:00
Nick Mathewson 967ea67b7d Use testing_rng() in tests throughout our crates.
This only affects uses of thread_rng(), and affects them all more or
less indiscriminately.  One test does not work with
ARTI_TEST_PRNG=deterministic; the next commit will fix it.
2022-06-02 14:56:42 -04:00
Nick Mathewson 69d352a7c7 New facility for deterministic and reproducible test PRNGs.
The new `testing_rng()` function is meant as a replacement for
thread_rng() for use in unit tests.  By default, it uses a randomly
seeded RNG, but prints the seed before the test so that you can
reproduce any failures that occur.  You can override this via the
environment to use a previous seed, or by using a deterministic
seed for all your tests.

Backend for #486.
2022-06-02 14:51:51 -04:00
Ian Jackson 6f96736278 Merge branch 'check-license-fixes' into 'main'
Update check_licenses and add it to CI.

Closes #462

See merge request tpo/core/arti!559
2022-06-02 13:59:35 +00:00
Ian Jackson c2d8dac1ce Merge branch 'better-fs-mistrust-badpermissions-string' into 'main'
fs-mistrust: Improve BadPermission string

See merge request tpo/core/arti!554
2022-06-02 11:15:52 +00:00
Nick Mathewson e03833098e Merge branch 'doc' into 'main'
tor-config: Fix a doc link

See merge request tpo/core/arti!563
2022-06-01 15:50:24 +00:00
Ian Jackson 9f4fe6a484 tor-config: Fix a doc link
Nightly cargo doc complaints about this.
2022-06-01 15:48:45 +01:00
Nick Mathewson 07dc49a2dc Fix a copy-paste error in Ed25519 parsing tests.
We accidentally tried to validate (invalid) ed25519 keys
as curve25519 keys.
2022-06-01 08:32:09 -04:00
Nick Mathewson 3de2496303 Add test for parsing bad tor version with too many elements.
This is a coverage-driven test.
2022-06-01 08:32:09 -04:00
Nick Mathewson 3e693fa717 Add test for mutability of RelayFamily. 2022-06-01 08:32:09 -04:00