Commit Graph

111 Commits

Author SHA1 Message Date
Nick Mathewson 3e922e5ede Intoduce1: Use a constant-time check for all-zero RsaIdentity
As a matter of good crypto practice, we shouldn't use
short-circuiting checks to compare keys or key-like objects, since
the amount of time taken by those checks can leak information about
their inputs.

I don't think it's actually _necessary_ to use a constant-time
operation in this case, but let's establish the precedent.

This is a follow-up to !724.
2022-09-20 09:36:49 -04:00
Nick Mathewson 7715b9c8d6 Merge branch 'cell-introduce1' into 'main'
Implement onion service Introduce1

See merge request tpo/core/arti!724
2022-09-20 13:02:02 +00:00
Yuan Lyu 1a3b979ecf
Implement onion service Introduce1 2022-09-08 23:48:56 -04:00
Nick Mathewson a5f704f443 Remove semver.md from arti-1.0.0 2022-09-07 09:17:00 -04:00
Nick Mathewson 96875ea208 Bump crate versions in preparation for Arti 1.0.0 release.
Because we want to work more on ensuring that our semver stability
story is solid, we are _not_ bumping arti-client to 1.0.0 right now.

Here are the bumps we _are_ doing.  Crates with "minor" bumps have
had API breaks; crates with "patch" bumps have had new APIs added.

Note that `tor-congestion` is not bumped here: it's a new crate, and
hasn't been published before.

```
tor-basic-utils         minor
fs-mistrust             minor
tor-config              minor
tor-rtcompat            minor
tor-rtmock              minor
tor-llcrypto            patch
tor-bytes               patch
tor-linkspec            minor
tor-cell                minor
tor-proto               minor
tor-netdoc              patch
tor-netdir              minor
tor-persist             patch
tor-chanmgr             minor
tor-guardmgr            minor
tor-circmgr             minor
tor-dirmgr              minor
arti-client             minor
arti-hyper              minor
arti                    major
arti-bench              minor
arti-testing            minor
```
2022-09-01 08:59:49 -04:00
Yuan Lyu 08e55bc9b1
Clean up EstablishIntro cell 2022-08-25 16:45:40 -04:00
trinity-1686a 7f939fa480 enable doc_auto_cfg feature on every crate when documenting for docs.rs 2022-08-24 18:22:41 +02:00
Ian Jackson d9338293c8 Add semver notes 2022-08-17 10:54:41 +01:00
Ian Jackson 14c6e17797 tor-cell: PaddingNegotiate::start: take IntegerMilliseconds 2022-08-17 10:54:41 +01:00
Ian Jackson bdaee82187 tor-cell: PaddingNegotiate: give better spec xrefs 2022-08-17 10:54:41 +01:00
Ian Jackson 7ed983800d channel padding: Rename low_ms and high_ms
These have the unit in the type.  Putting that in the field name too
is otiose.
2022-08-17 10:54:41 +01:00
Ian Jackson 76403563e5 tor-cell, testing: Provide PaddingNegotiate::from_raw
This allows test cases to describe precisely the contents of the
negotiation cell ought to be generated.
2022-08-16 18:43:23 +01:00
Ian Jackson 38b76578be chancell: PaddingNegotiate: Provide start_default and a Default impl
As proposed in
  https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/77
2022-08-16 18:37:06 +01:00
Ian Jackson a26f341bd7 chancell: Introduce PaddingNegotiateCmd
This gets rid of some random hardcoded literals.  We're going to want
to reuse this, too.
2022-08-16 18:37:06 +01:00
Ian Jackson 0df72449b8 chancell: PaddingNegotiate: Provide two constructors, not one
We don't really want the caller to pass ignored timeout parameters.
And this makes more semantic sense.

The stop constructor uses zero, which is what C Tor does.  See
  https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/76
2022-08-16 18:37:06 +01:00
Ian Jackson ecd6f16b6e chancell: PaddingNegotiate: Make Eq
This will be convenient for managing when to send these negotiation
messages.

While we're here, edit the comment to explain how this is (going to
be) used.
2022-08-16 18:37:06 +01:00
Emptycup 668d8d4858 Clarify `REASON_DONE` 2022-08-16 13:28:43 +00:00
Yuan Lyu 25bb25ddcb
Implement establish rendezvous cell 2022-08-05 00:04:42 -04:00
Nick Mathewson b16c042004 Now that versions have bumped, remove semver.md files. 2022-08-01 10:07:12 -04:00
Nick Mathewson 859ae4acd0 Bump patch versions on crates that have new APIs.
Do _not_ bump the dependency versions on crates that have had no
changes since arti 0.0.5, since those crates do not depend on the
new APIs.

```
cargo set-version -p tor-basic-utils   --bump patch
cargo set-version -p tor-llcrypto      --bump patch
git restore crates/tor-checkable
git restore crates/tor-consdiff
git restore crates/tor-rtmock
```
2022-08-01 09:56:29 -04:00
Nick Mathewson f5dcb98f06 Bump minor versions on all crates that have had breaking changes.
Done with these commands:

```
cargo set-version -p fs-mistrust       --bump minor
cargo set-version -p tor-bytes         --bump minor
cargo set-version -p tor-socksproto    --bump minor
cargo set-version -p tor-cert          --bump minor
cargo set-version -p tor-linkspec      --bump minor
cargo set-version -p tor-cell          --bump minor
cargo set-version -p tor-netdir        --bump minor
cargo set-version -p tor-persist       --bump minor
cargo set-version -p tor-chanmgr       --bump minor
cargo set-version -p tor-guardmgr      --bump minor
cargo set-version -p tor-circmgr       --bump minor
cargo set-version -p tor-dirclient     --bump minor
cargo set-version -p tor-dirmgr        --bump minor
cargo set-version -p arti-client       --bump minor
cargo set-version -p arti              --bump minor
```
2022-08-01 09:43:09 -04:00
Nick Mathewson dfdcc97858 Several typo fixes from `typos`. 2022-07-27 10:12:32 -04:00
Nick Mathewson bc75e6402b Fix compilation of EstablishInto encoding.
It was based on the old `Writeable` API.
2022-07-22 10:30:01 -04:00
eta 274bfb94c7 Merge branch 'hs-cells' into 'main'
Implement ESTABLISH_INTRO relay cell

See merge request tpo/core/arti!626
2022-07-22 13:42:50 +00:00
Nick Mathewson 6f1de00369 Merge branch 'fallible_writers_v2' into 'main'
Revise tor_bytes::Writer::write to return a Result.

Closes #513

See merge request tpo/core/arti!623
2022-07-19 20:29:15 +00:00
Yuan Lyu 248e6136bd
Implement ESTABLISH_INTRO relay cell 2022-07-18 21:22:43 -04:00
Ian Jackson bcf94f33e0 tor-cell: Derive Eq for NtorV3Extension
Apropos clippy complaint.
2022-07-18 17:49:59 +01:00
Nick Mathewson 44314f5076 tor-cell: Stop using write_infallible
Also, stop using "expect" and "assert!" to check for errors.
2022-07-11 11:18:51 -04:00
Nick Mathewson a0a88643f8 tor-cell: Make encoding method signatures fallible. 2022-07-11 11:18:51 -04:00
Nick Mathewson 8810af7f65 Convert each write_onto_infallible implementation into write_onto. 2022-07-11 11:18:51 -04:00
Nick Mathewson 7938f65c66 Rename "write" methods on tor-bytes to "write_infallible".
This comprises four renames:

```
write_onto -> write_onto_infallible
write_into -> write_into_infallible
write -> write_infallible
writer_and_consume -> write_and_consume_infallible.
```

The rest of this branch will be concerned with replacing these
`_infallible` methods with ones that return a `Result`.  This is
part of #513.
2022-07-11 11:18:51 -04:00
eta af64a0a984 Implement a higher-level API for the ntor v3 handshake
This implements a higher-level API for the ntor v3 handshake, in line
with that exposed by the ntor handshake. It does not, however, use the
existing `ClientHandshake` trait, due to fundamental differences in the
handshakes (namely, that the v3 handshake can include some additional
extra extension data).

Currently, the higher-level API assumes circuit extension, and copies
the (undocumented!) magic verification string from c-tor that indicates
this usage.

A rudimentary set of functions for serializing and deserializing
extensions to be sent with the handshake is also included, implementing
the protocol in proposal 332 § A.2. Currently, it only implements the
congestion control extensions specified in proposal 324 § 10.3.

part of arti#88
2022-07-08 18:26:18 +01:00
Nick Mathewson 1dda69af2b Remove semver.md files now that 0.5.0 is out 2022-06-24 13:31:38 -04:00
Nick Mathewson 20435aea75 Bump crate and dependency versions.
These were done with the following commands:

```
cargo set-version -p tor-basic-utils   --bump patch
cargo set-version -p fs-mistrust       --bump minor
cargo set-version -p tor-error         --bump patch
cargo set-version -p tor-config        --bump patch
cargo set-version -p tor-units         --bump patch
cargo set-version -p tor-rtcompat      --bump minor
cargo set-version -p tor-llcrypto      --bump patch
cargo set-version -p tor-bytes         --bump minor
cargo set-version -p tor-socksproto    --bump minor
cargo set-version -p tor-cert          --bump minor
cargo set-version -p tor-cell          --bump minor
cargo set-version -p tor-proto         --bump minor
cargo set-version -p tor-netdoc        --bump patch
cargo set-version -p tor-netdir        --bump minor
cargo set-version -p tor-persist       --bump patch
cargo set-version -p tor-chanmgr       --bump minor
cargo set-version -p tor-guardmgr      --bump minor
cargo set-version -p tor-circmgr       --bump patch
cargo set-version -p tor-dirclient     --bump patch
cargo set-version -p tor-dirmgr        --bump minor
cargo set-version -p arti-client       --bump patch
cargo set-version -p arti              --bump minor
cargo set-version -p arti-bench        --bump minor
cargo set-version -p arti-testing      --bump minor
```
2022-06-24 12:00:22 -04:00
Ian Jackson 4831f9d38c Merge branch 'clippy' into 'main'
Fix clippy nightly again

See merge request tpo/core/arti!603
2022-06-24 14:13:58 +00:00
Nick Mathewson ea3160737c Fix a couple of typos in rustdoc comments. 2022-06-24 08:18:15 -04:00
Ian Jackson 589c6e52bb Run maint/add_warning crates/*/src/{lib,main}.rs
Update all lint blocks
2022-06-23 19:15:42 +01:00
Nick Mathewson 0369995364 tor-cell: convert BytesErr to a struct variant 2022-06-22 15:21:12 -04:00
Nick Mathewson c3da82fc2d tor-cell: error usefulness and style fixes 2022-06-22 10:02:42 -04:00
Nick Mathewson 08d9bbf33b Do not include error source() in display() format.
According to doc/Errors.md, and in keeping with current best
practices, we should not include display an error's `source()` as
part of that error's display method.  Instead, we should let the
caller decide to call source() and display that error in turn.

Part of #323.
2022-06-21 14:14:14 -04:00
Nick Mathewson 8a586a40fa Add "full" and "experimental" features to arti-client and below.
The "full" feature is a catch-all for all features, _except_:

   * Those that select a particular implementation (like
     tor-llcrypto/with-openssl) or build flag (like "static")
   * Those that are experimental or unstable (like "experimental-api")
   * Those that are testing-only.
2022-06-10 15:32:21 -04:00
Ian Jackson 8fe63b3192 tor-bytes: read_nested_*: Take a closure
This eliminates the possibility of writing the bug of failing to call
`should_be_exhausted`.

As per this discussion
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/572#note_2811464

Fixes #498
2022-06-10 12:27:00 +01:00
Ian Jackson bcf3bca211 tor-cell: udp: Remove manual length calculations
This does away entirely with `wire_addr_len`, which recapitulates the
length calculation.
2022-06-09 17:08:56 +01:00
Ian Jackson 7e7cda1656 Merge branch 'less-servfail' into 'main'
return nodata instead of servfail in some instances

See merge request tpo/core/arti!564
2022-06-09 11:12:58 +00:00
trinity-1686a 6c6998a65b try to differentiate transient from nontransient error 2022-06-08 16:02:01 +01:00
Ian Jackson 3260a9b720 Fix a second docs link 2022-06-08 14:41:22 +01:00
Ian Jackson 35664c33e2 Fix a doc link 2022-06-08 14:39:18 +01:00
Nick Mathewson 5854e4bbd9 Merge branch 'use-testing-rng' 2022-06-07 19:02:12 -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