Commit Graph

7782 Commits

Author SHA1 Message Date
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
Nick Mathewson 3b9cc6b4e7 Merge branch 'circuit-reactor-first-hop' into 'main'
tor-proto: Extract Create message handling from Reactor::run_once()

See merge request tpo/core/arti!1441
2023-07-27 11:56:14 +00:00
gabi-250 d4fff19ec9 Merge branch 'keymgr-api-updates-gen-key' into 'main'
keymgr: Add KeyMgr::generate() for generating new keys.

See merge request tpo/core/arti!1433
2023-07-27 11:12:12 +00:00
Gabriela Moldovan 0fbd96df82
keymgr: Add TODO regarding generate() being racy. 2023-07-27 11:46:38 +01:00
Gabriela Moldovan 74a2a7937b
keymgr: Document the TOCTOU issue with generate(). 2023-07-27 11:45:05 +01:00
Gabriela Moldovan 249149d4ce
keymgr: Make the return value of generate() indicate if a new key was created. 2023-07-27 11:13:24 +01:00
Gabriela Moldovan 44f6d1c827
keymgr: Make Keystore::generate() return a Result. 2023-07-27 11:03:06 +01:00
Gabriela Moldovan ecfec3b827
tor-proto: Rename create_firsthop() to wait_for_create(). 2023-07-27 10:56:18 +01:00
Gabriela Moldovan 6f22c16ecc
tor-proto: Update handle_control docs. 2023-07-26 19:36:54 +01:00
Gabriela Moldovan 331ec1033a
tor-proto: Add functions for handling Shutdown and AddFakeHop messages.
This helps reduce code duplication, as `CtrlMsg::Shutdown` and
`CtrlMsg::AddFakeHop` are now handled in multiple places.
2023-07-26 19:36:50 +01:00
Gabriela Moldovan fee4baa17f
tor-proto: Extract first-hop creation to a separate function.
I think it's safe to handle `ChanMsg::Create` separately, because
there's nothing for the reactor to do until the first hop of the circuit
is created (so blocking on this _should_ be alright).
2023-07-26 19:36:47 +01:00
Gabriela Moldovan 98b9be0f2d
tor-proto: Create a function for handling the initial CREATE cell.
This logic from `create_firsthop()` was extracted (copied) from
`Reactor::run_once()`. A future commit will update `Reactor::run_once()`
to use `create_firsthop()`.
2023-07-26 19:35:04 +01:00
Ian Jackson 86ee2193b1 dev notes: Draft IPT algorithm: Minor clarifications 2023-07-26 16:14:45 +01:00
Ian Jackson 9966627479 Merge branch 'ipts' into 'main'
dev notes: Draft IPT algorithm: note re intro pt verification (followup)

See merge request tpo/core/arti!1438
2023-07-26 15:14:18 +00:00
Ian Jackson 869df2817a dev notes: Draft IPT algorithm: Added TODO re previous descriptor semantics
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924491
2023-07-26 12:21:34 +01:00
Ian Jackson be31effcae dev notes: Draft IPT algorithm: Added TODO/xref re tuning
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924530
2023-07-26 12:21:34 +01:00
Ian Jackson 98e3d7ac56 dev notes: Draft IPT algorithm: Possible fixed descriptor lifetimes
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924501
2023-07-26 12:21:34 +01:00
Ian Jackson 36cf899dd9 dev notes: Draft IPT algorithm: Add a publication rate limit
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924499
2023-07-26 12:21:34 +01:00
Ian Jackson 0b928f8a5b dev notes: Draft IPT algorithm: Add a TODO re selecting from >N IPTs
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924498
2023-07-26 12:21:34 +01:00
Ian Jackson 348aab8166 dev notes: Draft IPT algorithm: Added 2N IPT limit to tuning params
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924496
2023-07-26 12:21:34 +01:00
Ian Jackson a0d0a90b2b dev notes: Draft IPT algorithm: Delay IPT replacement
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924497
2023-07-26 12:21:34 +01:00
Ian Jackson 360bf843ae dev notes: Draft IPT algorithm: Early descriptor publish timing
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924494
2023-07-26 12:21:34 +01:00
Ian Jackson f050309c60 dev notes: Draft IPT algorithm: Retire IPTs - note re Onion Balance
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924487
2023-07-26 12:21:34 +01:00
Ian Jackson e9935ce2bc dev notes: Draft IPT algorithm: Retire IPTs - timing question
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924485
2023-07-26 12:21:34 +01:00
Ian Jackson 3807b43791 dev notes: Draft IPT algorithm: Retire IPTs after N introductions
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924485
2023-07-26 12:21:34 +01:00
Ian Jackson 75cc7ccf22 dev notes: Draft IPT algorithm: note re unpublished IPT
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924483
2023-07-26 12:21:34 +01:00
Ian Jackson 35a1e269c4 dev notes: Draft IPT algorithm: note re intro pt verification
Discussions here:
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924481
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1429#note_2924495
2023-07-26 12:21:34 +01:00
Ian Jackson 30e25af0a0 Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!1436
2023-07-26 10:21:27 +00:00
Ian Jackson 86e76c1100 Merge branch 'sw1tch/fix_reconfigure_deadlock' into 'main'
fixes deadlock in TorClient::reconfigure

See merge request tpo/core/arti!1432
2023-07-26 10:20:49 +00:00
Dimitris Apostolou c466edaa07
Fix typos 2023-07-25 21:17:18 +03:00
sw1tch b6873a9b84 pass reconfigure_lock guard into TorClient::reconfigure_inner 2023-07-25 19:31:36 +02:00
Nick Mathewson 2833648bfb Merge branch 'ipts' into 'main'
dev notes: Draft IPT algorithm

See merge request tpo/core/arti!1429
2023-07-25 16:29:38 +00:00
Nick Mathewson 6f841d0fb8 Merge branch 'onion-service-notes-v1' into 'main'
Initial notes about onion service structs and APIs

See merge request tpo/core/arti!1422
2023-07-25 16:29:28 +00:00
gabi-250 e3d2e12624 Merge branch 'keymgr-keygen-key-list' into 'main'
keymgr-doc: Document the list of keys the keymgr needs to generate.

See merge request tpo/core/arti!1413
2023-07-25 10:51:01 +00:00
Ian Jackson 965aab96b9 Merge branch 'safer_build' into 'main'
Add `doc/safer_build.md` to explain path anonymization

Closes #957

See merge request tpo/core/arti!1435
2023-07-25 10:44:51 +00:00
Nick Mathewson 7347a25ab1 Change keyid to nickname 2023-07-24 12:22:46 -04:00
Nick Mathewson 4f5fb5c011 Mention anti-DOS options. 2023-07-24 12:19:43 -04:00
Nick Mathewson 75038d8348 Mention ob_config. Not sure we will want to build it like this. 2023-07-24 12:18:21 -04:00
Nick Mathewson 7166c9e5b5 Add `doc/safer_build.md` to explain path anonymization
Otherwise our default build instructions will lead people
to build binaries that include their home directory.

Closes #957 for now.
2023-07-24 09:34:40 -04:00
Nick Mathewson f400ba2925 Merge branch 'fmt' into 'main'
Run cargo +nightly fmt to format many let ... else ...

See merge request tpo/core/arti!1434
2023-07-24 13:19:36 +00:00
sw1tch 7347d45acc cargo fmt 2023-07-24 14:48:19 +02:00
Ian Jackson 3e2a909707 Run cargo +nightly fmt to format many let ... else ...
rustfmt has grown opinions about how let ... else ... ought to be
formatted.  They don't always agree with our previous manual
decisions.

I think our policy is to always insist on rustfmt.  When that version
of rustfmt hits stable, our CI will start to fail for everyone.
(Right now this discrepancy just causes trouble for contributors who
are using nightly by default.)
2023-07-24 13:46:05 +01:00
Gabriela Moldovan 89dc3a162a
keymgr: Move duplicated match block to KeyMgr::select_keystore(). 2023-07-24 13:17:35 +01: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
Gabriela Moldovan f5f133c04c
keymgr: Test whether insert() creates the missing directories. 2023-07-24 13:17:16 +01:00
Gabriela Moldovan b9f3ba5885
keymgr: Return an unimplemented error instead of panicking.
This will enable us to test the parts of `ArtiNativeKeystore::insert`
that _are_ implemented (such as the part where it creates the missing
directories).
2023-07-24 13:17:12 +01:00
Gabriela Moldovan cfe90f1478
keymgr: Create the parent directories as needed 2023-07-24 13:17:08 +01:00