Commit Graph

7796 Commits

Author SHA1 Message Date
Nick Mathewson ba1600371b Implement authenticated sendme output for circuit-level sendmes.
This patch has a XXXXX kludge note in it.
2020-09-25 18:49:23 -04:00
Nick Mathewson c0ee910413 Add a bad workaround for a deadlock: we should look for a better one. 2020-09-25 17:06:33 -04:00
Nick Mathewson 6071b0e903 Fix encoding/decoding of authenticated sendme. 2020-09-25 17:06:33 -04:00
Nick Mathewson 08cfb40350 Try to get sendme crypto working
There's a problem, though: this code assumes that tags are 20 bytes
long whereas actually the tag type is part of the crypto layer info.

So maybe in the long term we need to move the queue of tags from the
send window into being part of the crypto layers.
2020-09-25 17:06:33 -04:00
Nick Mathewson bc4c05d6a7 Incomplete implementation of circuit SENDME handling.
This is incomplete because the cell crypto code doesn't actually
expose tags yet, and because it demands tags unconditionally,
without caring about the linkspec protocol version.
2020-09-25 17:06:33 -04:00
Nick Mathewson 06ede86f7f Attempted implementation of stream sendme cells 2020-09-25 17:06:33 -04:00
Nick Mathewson 92463dc03e Initial work on a sendme backend.
Parameterized for authenticated/unauthenticated operation, and
operation on circuits and streams.
2020-09-25 09:47:55 -04:00
Nick Mathewson 60ff67113f Initial error cleanup on streams/circuits 2020-09-25 08:35:48 -04:00
Nick Mathewson f945af0c41 Document private members in most crates 2020-09-24 19:25:37 -04:00
Nick Mathewson 18b13e8cae Migrate ClientMain to byte-oriented API. 2020-09-24 18:56:54 -04:00
Nick Mathewson 50848b8fa0 Try to make a send/receive style API for streams. 2020-09-24 18:03:03 -04:00
Nick Mathewson da3a8fdd50 Add support for RELAY_END cells.
This was a hard one.  I need to make sure that we send an END cell
when the stream is dropped.  But we can't call an .await from inside
the drop() function, since drop() isn't async, and we don't have an
executor.

Fortunately, you can call send() on a oneshot::Sender without having
to await on it, so that's the obvious thing to put in drop().  But
we need some way to make sure that the oneshot::Receiver is given to
the reactor, and is .awaited.  For that, we needed a control
channel.  And the reactor needs to treat the control channel and the
close messages as equally important.

So that's how I wound up with a
  Fuse<Select<mpsc::Receiver<Result<Foo>>,
              SelectAll<Once<oneshot::Receiver<Foo>>>>>.

I doubt that this is actually the best way to handle any of this!
2020-09-24 15:33:54 -04:00
Nick Mathewson 9e8350aea0 as Tor does, skip to random initial stream member. 2020-09-23 19:50:15 -04:00
Nick Mathewson c35477bb3d Fuse input streams on creation. 2020-09-23 19:21:49 -04:00
Nick Mathewson 6492334aff Turn IdMap into an extension trait.
Also, use the "right" (cyclic, potentially expensive) algorithm for
stream IDs.
2020-09-23 17:53:58 -04:00
Nick Mathewson bf7672cb77 A few tests for tor-linkspec 2020-09-23 16:47:37 -04:00
Nick Mathewson 49829b49b7 Tests (and correctness fixes) for protover. 2020-09-22 22:39:01 -04:00
Nick Mathewson 06a39719c5 Add tests for SignatureGated 2020-09-22 20:50:35 -04:00
Nick Mathewson e592fff4a2 Tests for Timerangebound. 2020-09-22 20:37:08 -04:00
Nick Mathewson 7130d87d7c Run cargo fix --edition-idioms 2020-09-21 13:50:47 -04:00
Nick Mathewson 0c131dc080 Run cargo upgrade 2020-09-21 13:45:36 -04:00
Nick Mathewson d96a949cb3 Update documentation 2020-09-21 13:43:58 -04:00
Nick Mathewson d5d11d6923 Update TODO file 2020-09-21 13:14:21 -04:00
Nick Mathewson 3eb087bf16 turn hopnum into a first-class type 2020-09-21 12:56:30 -04:00
Nick Mathewson c276cfcb73 Add is_zero for ID types. 2020-09-21 12:27:45 -04:00
Nick Mathewson fb7703f7e9 Fix some errors; document some places where error handling is bogus 2020-09-21 12:22:35 -04:00
Nick Mathewson 68fc1b0f4d More documentation for channel, circuit, stream. 2020-09-21 12:10:51 -04:00
Nick Mathewson bc00417f01 Start implementing streams and circuit-level reactors.
Also, revise nearly all of the circuit/channel interaction to
actually send relay cells to the right place and do sensible things
with them.
2020-09-21 10:42:36 -04:00
Nick Mathewson 296bfbe57b Add RelayCmd::accepts_streamid_val 2020-09-20 14:09:10 -04:00
Nick Mathewson 9567689a30 Refactor accetps_circid_val to be less wonky. 2020-09-20 14:09:10 -04:00
Nick Mathewson a3384bc126 Move is_recognized function into caret. 2020-09-20 14:09:10 -04:00
Nick Mathewson a547cda19f Rename StreamCmd to RelayCmd 2020-09-20 14:09:10 -04:00
Nick Mathewson c6d403472f Improve shutdown support for channel. No idea if it works. 2020-09-20 14:09:10 -04:00
Nick Mathewson 9c4685968c rename a field in RelayCell 2020-09-20 14:09:10 -04:00
Nick Mathewson 988556dbef Create a StreamID->Stream map type.
Also extract the shared part of CircMap and StreamMap into a new
IdMap type.
2020-09-20 14:09:10 -04:00
Nick Mathewson 0075b784a1 De-parameterize channel and circuit
By putting the cell-sink in a box, we can get rid of the need for
having everything that uses a channel or a circuit know what kind
of underlying TLS implementation it has.
2020-09-19 22:29:18 -04:00
Nick Mathewson 56d8bc1756 Add tests for CREATE_FAST handshake 2020-09-19 13:06:40 -04:00
Nick Mathewson 80d1d27810 Add tests for failing ntor handshakes. 2020-09-19 12:37:17 -04:00
Nick Mathewson 389fc03e1e ntor: test the ClientHandshake/ServerHandshake impl 2020-09-18 21:20:22 -04:00
Nick Mathewson 3907e4a0c9 tests for kdf functions in tor_proto 2020-09-18 20:57:56 -04:00
Nick Mathewson 69e1c91ba1 Add tests for tor_proto::util::ct 2020-09-18 20:00:06 -04:00
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 f256847f82 Sort linkspecs in the same order as tor does 2020-09-17 15:33:18 -04:00
Nick Mathewson ba546a798d use more correct expiration times 2020-09-17 15:19:12 -04:00
Nick Mathewson e3a524a659 More tests for tor_bytes::impl 2020-09-15 11:39:09 -04:00
Nick Mathewson 94792f583b tor_bytes: Remove an extraneous println 2020-09-15 11:26:44 -04:00