Commit Graph

687 Commits

Author SHA1 Message Date
Ian Jackson 8d83a50846 tor-hsservice: Provide a sensible HsNickname 2023-08-23 15:35:30 +01:00
Ian Jackson a117564140 tor-hsservice: About half of an IPT Manager
There are many TODOs and no tests, but it does compile.
2023-08-23 10:06:44 +01:00
Ian Jackson 627708af14 tor-hsservice: Provide timeout tracking utilities - tests 2023-08-23 10:03:44 +01:00
Ian Jackson 11874ac7ec tor-hsservice: Provide timeout tracking utilities
This module is perhaps rather more comprehensive than needed right
now.  But I found I kept wanting to change which bits of it I used.
2023-08-23 10:03:44 +01:00
Nick Mathewson 683e607db7 hss: change terminate oneshot to send "void".
We don't actually want to distinguish drop from not-drop.
2023-08-22 10:51:19 -04:00
Nick Mathewson 1309bc6753 HSS: Use correct timeouts and delays in IptEstablisher 2023-08-22 10:50:43 -04:00
Nick Mathewson ec6721ec94 HSS: Refactor RendRequest so we can return a stream of it.
We need a type that holds a rend_handshake::IntroRequest object
internally, but where we don't materialize that object from the
Introduce2 message inside the MsgHandler, since that's more crypto
than we want to put in that task.
2023-08-22 10:50:43 -04:00
Nick Mathewson d83ff291bf hss: Establish intro point by RelayIds. 2023-08-22 10:50:43 -04:00
Ian Jackson 1955e70499 Merge branch 'webpki-update' into 'main'
Resolve (mostly) RUSTSEC-2023-0052

See merge request tpo/core/arti!1534
2023-08-22 14:43:52 +00:00
Ian Jackson 403c931072 Merge branch 'upgrade_num_enum' into 'main'
Upgrade num_enum dependency to 0.7

See merge request tpo/core/arti!1530
2023-08-22 14:15:12 +00:00
Nick Mathewson 15bde8568c Upgrade to rustls-webpki unaffected by RUSTSEC-2023-0053 2023-08-22 09:42:08 -04:00
Nick Mathewson e699607ef8 Upgrade num_enum dependency to 0.7 2023-08-21 13:47:08 -04:00
trinity-1686a 5527da5711 upgrade serde to >=1.0.184
to remove the use of a pre-built blob
2023-08-21 15:54:23 +02:00
gabi-250 15f9da4d0e Merge branch 'hss-err' into 'main'
tor-hsservice errors: Introduce more error types

See merge request tpo/core/arti!1515
2023-08-18 13:39:20 +00:00
Ian Jackson 64c8b38c25 tor-hsservice: Define drop behaviour of IPT establisher status 2023-08-17 14:42:26 +01:00
Ian Jackson e1405cdb11 tor-hsservice errors: Return ReconfigureError from reconfigure
This is what we do elsewhere.
2023-08-17 13:28:44 +01:00
Nick Mathewson 2d2bf1c945 hsservice: new rend_handshake module
This code has most of what we need to go from an INTRODUCE2 message
we've just received to the point where we've connected to the
rendezvous point and we're waiting for a stream of BEGIN messages.
Unfinished pieces are marked with TODO HSS.

Most of #980.
2023-08-17 08:18:21 -04:00
Nick Mathewson 2a3fe5bf20 Merge branch 'more_introducing' into 'main'
Write more of IptEstablisher.

See merge request tpo/core/arti!1510
2023-08-16 13:02:29 +00:00
Nick Mathewson 0ee63cb04b Wire up more of IptEstablisher.
It now supports running in a loop, trying to establish an
introduction point, and reporting status.
2023-08-16 08:22:53 -04:00
Gabriela Moldovan 4b72da73b3
tor-keymgr: Add sec1 0.7.3 dependency. 2023-08-16 10:45:47 +01:00
Gabriela Moldovan b2bcbaa708
keymgr: Bump ssh-key to 0.6.0.
This brings in the changes from #936.
2023-08-16 10:43:21 +01:00
Nick Mathewson 6292f3544a hsservice: migrate IptStatus design to assume a postage::watch 2023-08-15 14:10:06 -04:00
Nick Mathewson 603175b977 Start working on the backend for an IptEstablisher.
This should be enough now to establish real introduction points,
though there is still a lot of work to do.  Part of #976.

This has been rebased and edited to incorporate discussions from
!1465.
2023-08-14 13:57:49 -04:00
Nick Mathewson 0759fdf681 hscrypto: Expose hs_mac as a SimpleMac. 2023-08-14 13:15:00 -04:00
Ian Jackson 6af1485a90 tor-config: Add ConfigurationSources::try_from_cmdline
We'll use this in crates/arti in a moment.
2023-08-07 18:03:03 +01:00
Nick Mathewson 64fca7e45f proto: methods to wait until a channel/circuit is shut down.
The implementation here is perhaps excessively simple: we put
a `oneshot::Sender` in the `Reactor` object, and a
`Shared<oneshot::Receiver>` in the circuit or channel.  When
the reactor is dropped, any copy of the `Shared<Receiver>` will
yield `Err(Cancelled)`.

I'm marking these methods as experimental because I'm not sure I've
thought of all the implications here, and we might want to change
things around.

Down the road, these methods might want to yield a `Result<>`
indicating why the reactor was shut down.

This feature was inspired by a request from Saksham Mittal, and a
felt need while working on !1472.
2023-08-04 13:37:28 -04:00
Nick Mathewson 5c607e8cf6 Merge branch 'ticket889_fuzz' into 'main'
Fuzzers for Equi-X and HashX

See merge request tpo/core/arti!1459
2023-08-02 22:12:20 +00:00
Micah Elizabeth Scott 82eb88bd74 equix/fuzz: Fixes to get nick's prototype running
There are some places we might improve this, maybe testing more data
types and shapes. This patch just makes the minimal changes necessary
to get it working: adds allocation logic to the fuzzer itself,
and adds visibility for the bucket_array::mem interface.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-08-01 19:34:04 -07:00
Micah Elizabeth Scott ae58ea0697 equix, hashx: Benchmark against C implementation
This is a small batch of improvements for the equix and hashx
benchmarks. The headline feature is that we are now including
the C implementations (slightly modified from tevador's, hosted
as part of c-tor) and using them in apples-to-apples comparisons.

Minor features:
- Benchmarks moved to new nested crates, preventing their
  dependencies from spilling into the main workspace build.
- Tests are now grouped
- We also test the performance of memory reuse where possible
- Code cleanup for per-runtime options

These benchmark builds will now automatically pull in the c-tor
git repo and build portions of it with a Rust wrapper. This uses
the 'cc' and 'bindgen' crates, so it requires a C compiler and
libclang on the host system.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-08-01 19:28:43 -07:00
Nick Mathewson 1dc47a65cf Upgrade to sanitize-filename 0.5.0 2023-08-01 19:47:39 -04:00
Nick Mathewson dee95436f5 Merge branch 'hss_apis' into 'main'
hsservice: Initial data structures and APIs

Closes #972, #971, and #970

See merge request tpo/core/arti!1452
2023-08-01 17:06:10 +00:00
Saksham Mittal 752f748910 Add error if [[bridges.transports]] isn't written in config file 2023-08-01 16:43:46 +00:00
Nick Mathewson 5cc3fe1629 Bump patchlevel versions of crates with trivial changes
These crates have had trivial changes only: typically,
changes to documentation or to clippy warnings.  There's no
good reason to update which version of them other crates depend on,
so we only bump _their_ patchlevels.

```
tor-async-utils
caret
safelog
tor-events
tor-units
tor-rtcompat
tor-rpcbase
tor-llcrypto
tor-protover
tor-bytes
tor-hscrypto
tor-socksproto
tor-cert
tor-cell
tor-consdiff
tor-congestion
arti-rpcserver
arti-testing
arti-bench
arti-config
arti-hyper
```
2023-08-01 11:03:56 -04:00
Nick Mathewson 3acdf102c7 Increment patchlevel versions of crates with minor changes
These crates are at version 0.x.y, so we don't need to distinguish
new-feature changes from other changes:

```
tor-basic-utils
fs-mistrust
tor-error
tor-geoip
tor-checkable
tor-linkspec
tor-netdoc
tor-netdir
tor-persist
tor-ptmgr
tor-hsservice
```

This crate has a breaking change, but only when the semver-breaking
feature `experimental-api` is enabled:

```
tor-config
```

This crate is at version 1.x.y, but has no new public APIs, and
therefore does not need a minor version bump:

```
arti
```
2023-08-01 10:57:55 -04:00
Nick Mathewson 6f2ae59603 Update minor versions on crates that have had breaking changes
These crates had first-order breaking changes:

```
retry-error
tor-keymgr
tor-proto
tor-hsclient
tor-rtmock
```

Additionally, these broke because they re-exposed RetryError:

```
tor-circmgr
```

Additionally, these broke because they may re-expose something from
tor-proto:

```
    arti-client
    tor-chanmgr
    tor-dirclient
    tor-dirmgr
    tor-guardmgr
```

Additionally, these broke for other fiddly reasons:

`tor-ptmgr` implements traits from tor-chanmgr, which has a breaking
change above.

`arti-hyper` exposes types from arti-client in its API.
2023-08-01 10:51:25 -04:00
Nick Mathewson f37915587e Run cargo update in preparation for a release. 2023-08-01 08:10:44 -04:00
Nick Mathewson 20afc76c0a hsservice: Adapt API sketches from onion-service-notes.md 2023-07-31 13:47:44 -04:00
Nick Mathewson 20b3679dbb hsservice: Adapt data structures from onion-service-notes.md
Also, removed some older structures that don't make sense in the
current design.

Closes #970
2023-07-31 13:47:44 -04:00
Micah Elizabeth Scott d17c12b152 hashx: use RngCore for HashX's internal PRNG
This refactors the random number generator used within HashX's program
generator so that it uses the rand::RngCore trait. The basic SipHash
powered u64 generator now implements RngCore, while a buffer layer
wraps this and provides u8 and u32 values as needed by the generator.

Some of this new RngCore layer is now exposed to the hashx crate's
public API. The intent is to allow external code to test, benchmark, or
fuzz the program generator by supplying its own random number stream.

Benchmarks show a small but confusing performance improvement
associated with this patch. About a 2% improvement in generation.
This could be due to the Rng changes. No change in compiled hash
execution performance. Even though this patch only touches program
generation, benchmarks show a 4% speedup in interpreted execution.
This seems most likely explained by instruction cache effects,
but I'm not sure.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-07-27 07:20:14 -07:00
Micah Elizabeth Scott e7aa1d6b62 Start implementing Proposal 327
This adds a new tor-hspow crate with the first layers of support in
place for onion service client puzzles as described in Proposal 327.

The API here is experimental, and it's currently only implementing
the self-contained parts of the client puzzle. So, it can verify and
solve puzzles, but it has no event loop integration or nonce replay
tracking or prioritization code yet. These things seem like they would
eventually live in the same crate.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-07-27 07:20:14 -07:00
Micah Elizabeth Scott 16c9bdf178 Reimplement Equi-X in Rust
This is a new pure Rust implementation of the Equi-X algorithm
designed by tevador for Tor's onion service proof of work puzzle v1.

Equi-X is an asymmetric puzzle algorithm based on Equihash, with
N=60, K=3, the XOR replaced with modular addition, a 16-bit index
space, and HashX as the inner hash function.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-07-27 07:20:14 -07:00
Micah Elizabeth Scott a8756f2bce Reimplement HashX in Rust
This is a new pure Rust implementation of the HashX algorithm
designed by tevador for Tor's onion service proof of work puzzle v1.

HashX is a lightweight family of randomly generated hash functions.
A seed, via blake2 and siphash, drives a program generation model
which randomly selects opcodes and registers while following some
constraints that avoid timing stalls or insufficient hash mixing.

The execution of these hash funcions can be done using a pure Rust
interpreter, or about 20x faster using a very simple just in time
compiler based on the dynasm assembler crate. This has been
implemented for x86_64 and aarch64.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-07-27 07:20:06 -07:00
Gabriela Moldovan f96298a791
keymgr: Add KeyMgr::generate() for generating new keys. 2023-07-24 13:17:31 +01:00
Gabriela Moldovan 9c326ced81
keymgr: Add function for generating EncodableKeys. 2023-07-24 13:17:23 +01:00
Nick Mathewson c8e1dad298 Merge branch 'pwd-grp' into 'main'
Update pwd-grp to 0.1.1 to fix MacOS build etc.

See merge request tpo/core/arti!1427
2023-07-20 21:48:33 +00:00
Ian Jackson 1f7911f0d9 Update pwd-grp to 0.1.1 to fix MacOS build etc.
This also gets rid of a duplicate copy of derive-adhoc.
2023-07-20 18:58:02 +01:00
Nick Mathewson 3b7400621c Bump requirement to rlimit 0.10.1
There was a bug in 0.10.0 that broke MacOS.

Part of #963.
2023-07-20 08:15:38 -04:00
Ian Jackson ed29dbcbd4 retry-error: Introduce a Wrapper type in a test
We're going to require that a RetryError contains things that are
AsRef<dyn Error> and ParseIntError isn't so we need a newtype.
2023-07-19 14:16:13 +01:00
Ian Jackson 882ce8c8ce retry-error: Provide fmt_error_with_sources in retry-error
This code came from tor-error.  So now tor-error depends on
retry-error.
2023-07-19 14:16:13 +01:00
Ian Jackson 46492d8af2 Update Cargo.lock for d-a versions
!1410 and !1412 had a semantic conflict *in the Cargo lockfile*!

!1410 added a new indirect dependency on derive-adhoc, which is used
in pwd-grp.  pwd-grp is still declaring a dependency on d-a 0.6.1.
(This ought to be updated there in due course, but isn't a bug.)

!1412 updated our direct dependency on derive-adhoc to require 0.7.x.
In fact, the breaking change 0.6.x to 0.7.x is minor and we could have
written a more relaxed dependency.But cargo's syntax for that is very
clumsy - here is an example from derive-adhoc iteself:
  itertools = ">=0.10.1, <0.12"

Fix this for now in our tree with a `cargo update`, to unbreak main.
2023-07-18 11:13:56 +01:00