Commit Graph

690 Commits

Author SHA1 Message Date
Nick Mathewson 0505579497 Upgrade to strum 0.25. 2023-06-21 09:12:36 -04:00
Nick Mathewson 107fbb05de Merge branch 'geoip-nullity-fromstr' into 'main'
Followups wrt country-code robustness

See merge request tpo/core/arti!1268
2023-06-21 12:32:23 +00:00
Ian Jackson 0c18de656f Bump openssl because RUSTSEC-2023-0044 2023-06-21 11:57:34 +01:00
Nick Mathewson cf9d902320 geoip: Make ?? a little more bullet-proof
We want to make sure that ?? is always None, never a CountryCode.
2023-06-20 16:22:21 -04:00
gabi-250 db7f46265e Merge branch 'keymgr-refactor-fs-ops' into 'main'
keymgr: Move FS operations out of KeyType impl

See merge request tpo/core/arti!1263
2023-06-20 18:41:33 +00:00
Nick Mathewson 17fab6e913 netdoc: Use derive amplify::Getters for HsDesc accessors.
Closes #909.
2023-06-20 14:00:41 -04:00
Nick Mathewson 8d4ca94e19 Merge branch 'add-tor-geoip' into 'main'
tor-geoip: Add new crate with GeoIP database functionality

See merge request tpo/core/arti!1239
2023-06-20 17:59:15 +00:00
Gabriela Moldovan abdf854547 keymgr: Move FS operations out of ssh.rs
This moves the filesystem calls from the `ssh` module to
`ArtiNativeKeyStore`. While `ArtiNativeKeyStore` shouldn't be concerning
itself with filesystem operations either, that refactoring will be
tackled separately (see arti#899).
2023-06-20 18:54:35 +01:00
eta d5632eacb2 tor-geoip: Add new crate with GeoIP database functionality
- This adds a new crate, `tor-geoip`, which can parse and perform
  lookups in the GeoIP database C-tor already uses (generated by a
  maintenance utility in the C-tor codebase).
- We embed a copy of C-tor's databases with the crate and use
  `include_str!` to ship them with the binary, bloating its size
  somewhat.
  - This does, however, solve the problem of figuring out how to
    distribute these.
  - The plan is to gate this functionality behind a feature flag anyway,
    so the cost should be nil unless explicitly opted into.

Part of tpo/core/onionmasq#47.
2023-06-20 16:57:58 +01:00
Gabriela Moldovan 6837dbce58 keymgr: Add an error variant for fs_mistrust errors.
This will be useful later, when `KeyMgr` will start validating
permissions and paths.
2023-06-20 13:29:10 +01:00
Alexander Færøy f55187e065 Merge branch 'arti-client' into 'main'
Sort out .onion handling in arti-client

See merge request tpo/core/arti!1257
2023-06-19 14:44:55 +00:00
Nick Mathewson b9500c6f3d Merge branch 'netdoc-todos' into 'main'
Resolve many TODO HS items in tor-netdoc

See merge request tpo/core/arti!1251
2023-06-16 17:31:31 +00:00
Nick Mathewson 6edcca7df3 netdoc: use ct_lookup for rend descriptor cookie lookup
(I doubt that there is a viable side channel here, but still we
might as well get in the habit of doing these things properly.)
2023-06-16 12:24:05 -04:00
Ian Jackson 18291cb001 arti-client: Provide ErrorDetailDiscriminants for convenient testing
ErrorDetail isn't PartialEq so we can't assert_eq! it.
But the discriminants will be.
2023-06-16 16:18:02 +01:00
Gabriela Moldovan eda974cd34 keymgr: Move the HS client and service key specifiers out of tor-keymgr.
The HS `HsClientSpecifier` and `HsClientSecretKeySpecifier` are moved to
`tor-hsclient`. The HS service secret key specifier stubs are moved to
`tor-hsservice`.
2023-06-15 18:16:33 +01:00
Gabriela Moldovan 61f37b1b5c keymgr: Add key manager implementation stub. 2023-06-15 18:15:30 +01:00
Gabriela Moldovan a2d0ee63cc keymgr: Add ArtiNativeKeyStore implementation skeleton.
This adds implementation stubs for `ArtiNativeKeyStore`, and introduces
the traits needed to make the `KeyStore` APIs work.
2023-06-15 18:15:30 +01:00
Nick Mathewson ac90cb7500 Upgrade async-trait requirement to 1.54
We need the fix from [82d69902], which first appeared in async-trait
version 1.54.  (Technically we only need this fix in tor-hsclient,
but we may as well update our minimal async-trait version everywhere.)

[82d69902]: 82d6990253
2023-06-12 13:15:59 -04:00
Ian Jackson c2952a5b20 tor-hsclient: Implement rendezvous setup, and retry framework
This contains code to:

 * Iterate over introduction points
 * Make multiple attempts to connect
 * Apply timeouts to the various phases of each attempt
 * Establish a rendezvous point
 * Represent errors that occur during the above

It provides places to add:

 * Implementation of the INTRODUCE1/INTRODUCE_ACK handshake
 * Reception of RENDEZVOUS2 and actual end-to-end circuit establishment
 * Recording of the outcome of connection attempts via particular IPTs
 * Using previous IPT outcome information for selecting IPTs to try
 * Tests of the new code (although more mocking will probably be needed)

Much of this code works with a fixed type ClientCirc rather than going via
the Mockable traits.  That is wrong, and it will be fixed later.
2023-06-09 17:36:48 +01:00
Ian Jackson a50016b3da tor-hscrypto: implement Rng.gen() for RendCookie 2023-06-09 12:24:24 +01:00
Nick Mathewson 924dbf7d8f Merge branch 'ipt_to_circtarget' into 'main'
Construct a CircTarget from an IntroPointDesc.

See merge request tpo/core/arti!1221
2023-06-07 12:35:26 +00:00
Nick Mathewson 618ed48cea hsclient: Create a CircTarget from an IntroPointDesc.
The main body of this function is written so that we can later use
it to create a CircTarget from an INTRODUCE2 message.
2023-06-07 07:55:45 -04:00
Nick Mathewson e7ebb31009 Merge branch 'remove_arrayref' into 'main'
Remove use of arrayref

Closes #872

See merge request tpo/core/arti!1214
2023-06-06 00:37:31 +00:00
Nick Mathewson 362a1f8ac1 arti: Interpret socks request to mean "lookup an RPC session"
The actual decoding here is just a placeholder.  The important part
is that we can get either a (SessionId, StreamId) tuple out of the
request, or we treat it as part of an isolation token.

This commit has a few TODOs for additional things that we'll need
in order to build out our design.
2023-06-05 14:47:38 -04:00
Nick Mathewson 71e98b1a12 RPC: Implement a "global identifier" for non-session-bound IDs
These identifiers are actually only "global" with respect to a given
`RpcMgr`, but they should not be forgeable or reusable across RpcMgr
objects.  We're going to use them so that we have a kind of identifier
for `TorClient`s that we can expose to SOCKS.
2023-06-05 14:46:51 -04:00
Nick Mathewson 545984b095 rpc: Give RpcMgr a registry of connections.
We're going to use this to implement arti#863, which requires that
some RPC objects be globally nameable.
2023-06-05 14:45:42 -04:00
Nick Mathewson 0bf44b1393 tor-cell: remove use of arrayref
Closes #872
2023-06-01 11:14:48 -04:00
Nick Mathewson dfcbd7d4ee tor-llcrypto: remove use of arrayref 2023-06-01 10:50:25 -04:00
Nick Mathewson 744d32d554 tor-netdoc: remove use of arrayref. 2023-06-01 10:36:35 -04:00
Nick Mathewson 46d2a768a1 tor-proto: Remove use of arrayref. 2023-06-01 10:32:00 -04:00
Nick Mathewson daf5ecc153 Bump crate versions in preparation for v1.1.5 release.
Generated with the following commands:

```
cargo set-version --bump minor -p tor-cell
cargo set-version --bump minor -p tor-linkspec
cargo set-version --bump minor -p tor-proto
cargo set-version --bump minor -p tor-netdoc
cargo set-version --bump minor -p tor-circmgr

cargo set-version --bump patch -p tor-cert
cargo set-version --bump patch -p tor-basic-utils
cargo set-version --bump patch -p tor-rpcbase
cargo set-version --bump patch -p tor-llcrypto
cargo set-version --bump patch -p tor-hscrypto
cargo set-version --bump patch -p tor-checkable
cargo set-version --bump patch -p tor-async-utils
cargo set-version --bump patch -p caret
cargo set-version --bump patch -p fs-mistrust
cargo set-version --bump patch -p safelog
cargo set-version --bump patch -p retry-error
cargo set-version --bump patch -p tor-error
cargo set-version --bump patch -p tor-config
cargo set-version --bump patch -p tor-events
cargo set-version --bump patch -p tor-units
cargo set-version --bump patch -p tor-rtcompat
cargo set-version --bump patch -p tor-rtmock
cargo set-version --bump patch -p tor-protover
cargo set-version --bump patch -p tor-bytes
cargo set-version --bump patch -p tor-socksproto
cargo set-version --bump patch -p tor-consdiff
cargo set-version --bump patch -p tor-netdir
cargo set-version --bump patch -p tor-congestion
cargo set-version --bump patch -p tor-persist
cargo set-version --bump patch -p tor-chanmgr
cargo set-version --bump patch -p tor-ptmgr
cargo set-version --bump patch -p tor-guardmgr
cargo set-version --bump patch -p tor-dirclient
cargo set-version --bump patch -p tor-dirmgr
cargo set-version --bump patch -p tor-hsclient
cargo set-version --bump patch -p tor-hsservice
cargo set-version --bump patch -p arti-client
cargo set-version --bump patch -p arti-rpcserver
cargo set-version --bump patch -p arti-config
cargo set-version --bump patch -p arti-hyper
cargo set-version --bump patch -p arti
cargo set-version --bump patch -p arti-bench
cargo set-version --bump patch -p arti-testing
```
2023-06-01 10:03:05 -04:00
Nick Mathewson 65be721f46 Run "cargo update" in preparation for Thursday release. 2023-05-30 10:37:24 -04:00
Nick Mathewson 244ec5dce2 tor-bytes: Remove use of arrayref
Part of #872: Now that const generics are in, we have better ways to
express converting slices into array-references.
2023-05-25 14:48:57 -04:00
Nick Mathewson 45b4845f3a rpc: Remove fake_generational_arena
Now that generation-arena has merged [@diziet's patch] to clarify
their license, we no longer need to disable it.

[@diziet's patch]: https://github.com/fitzgen/generational-arena/pull/56
2023-05-23 13:58:08 -04:00
Nick Mathewson 9848155f59 Upgrade notify dependency to 6.0 2023-05-22 07:54:10 -04:00
Nick Mathewson a179d10ad4 Upgrade async-compression dependency to 0.4.0. 2023-05-22 07:52:18 -04:00
Nick Mathewson 16c992ecd3 Upgrade memmap2 dependency to 0.6.1. 2023-05-22 07:51:22 -04:00
Nick Mathewson 512455da96 Upgrade serde_with dependency to 3.0.0 2023-05-22 07:49:58 -04:00
Nick Mathewson cf06933d95 Run "cargo update". 2023-05-22 07:47:20 -04:00
Nick Mathewson 9d5dd813c0 hs_ntor: Use Subcredential type from tor-hscrypto 2023-05-17 16:18:55 -04:00
Nick Mathewson 2e1115acc3 rpc: Change the formatting of object IDs
We want each ID to have a unique form every time it is given out,
so that you can't use ID==ID to check whether Object==Object.  (See
discussions leading to #848.)

We'd also like the form of object IDs to be a little annoying to
analyze, to discourage people from writing programs that depends on
their particular format.  (We are reserving the right to change the
format whenever we want.)

We _don't_ want to use any cryptography here (yet), lest somebody
think that this is an actual security mechanism.  (This isn't for
security; it's for encouraging developers to treat IDs as opaque.)

With that in mind, we now lightly obfuscate our generational indices
before returning them.
2023-05-15 15:59:58 -04:00
Nick Mathewson bedc47afe7 llcrypto: upgrade x25519-dalek.
This upgrades us to 2.0.0-rc.2, which is the latest in the
not-quite-done-yet 2.0 series.

The only code change that's absolutely needed is opting into the
static_secrets feature.
2023-05-13 16:46:47 -04:00
Nick Mathewson a86aff8399 linkspec: Make LinkSpecType public.
This lets us check the type of an `EncodedLinkSpec` as well, and
lets us remove an interface that took a raw u8.
2023-05-10 12:19:37 -04:00
Nick Mathewson 66aff12f19 bump to latest version of bumpalo to appease cargo_audit. 2023-05-09 15:08:58 -04:00
trinity-1686a a8fd2d390e update rustls to 0.21 2023-05-08 18:01:00 +02:00
trinity-1686a 7d50a34a3a update rsa to 0.9.x 2023-05-08 17:24:23 +02:00
Gabriela Moldovan 6b9e37e07c
tor-netdir: Shuffle the list of HS dirs used for downloading descriptors.
We'll probably need the hsdir list to be shuffled deterministically for
testing purposes (this might be desirable, for example, when we write a
test for HS descriptor download retries).

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-04 17:53:58 +01:00
Nick Mathewson 7f59d7dae5 Temporarily replace generational-arena with a fake version.
This fake version is completely silly, but it will do the job until
we figure out our MPL2 concerns.
2023-05-04 10:37:27 -04:00
Nick Mathewson 475da9b802 Add a generational arena for object mapping for RPC.
See the comments on `TypedAddr` for some explanations about
why this is so tricky.  Thanks to @diziet for helping me figure
this out.
2023-05-04 10:35:05 -04:00
Nick Mathewson d7ab388faf RPC: Start on plumbing TorClient into our RPC code
Because of #837, we won't be able to work with _every_ TorClient<R>,
so I'm only going to be using TorClient<PreferredRuntime> for now.
2023-05-04 10:35:03 -04:00
Nick Mathewson 879a453212 RPC: Move the "listen" part of the RPC listener code to `arti`.
Now there's a module in `arti` that runs the loop for an RPC
listener.  The part of the old `listener` module that made
the framed connections is now part of the `Session` object.

There is now yet another a temporary location for the pipe; we
should pick something better.  At least now it's configurable.
2023-05-04 10:30:40 -04:00
Nick Mathewson 25398b5a3b rpc: Make an RpcMgr type to own the DispatchTable.
In the future, this will probably hold more data as well, like a
TorClient and some configuration info.

The TorClient will present an issue; I've made comments about that.

Closes #820
2023-05-04 10:22:27 -04:00
Gabriela Moldovan 30983c764f
tor-netdir: Update tests to parse the descriptor, make test consensus lifetime configurable.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-03 17:25:25 +01:00
Nick Mathewson e845a553f3 Upgrade tracing to 0.1.36.
This is the first version to impl Value for String.

With luck, this will get minimal_versions CI passing.
2023-05-03 11:09:21 -04:00
Nick Mathewson 1904cfc8b9 Increment crate versions.
Because of the errorkind bumps, we're calling this a breaking change
in everything lower-level than `arti`.

Generated with:
```
cargo set-version -p tor-basic-utils --bump minor
cargo set-version -p tor-async-utils --bump minor
cargo set-version -p caret --bump minor
cargo set-version -p fs-mistrust --bump minor
cargo set-version -p safelog --bump minor
cargo set-version -p retry-error --bump minor
cargo set-version -p tor-error --bump minor
cargo set-version -p tor-config --bump minor
cargo set-version -p tor-events --bump minor
cargo set-version -p tor-units --bump minor
cargo set-version -p tor-rtcompat --bump minor
cargo set-version -p tor-rtmock --bump minor
cargo set-version -p tor-rpcbase --bump minor
cargo set-version -p tor-llcrypto --bump minor
cargo set-version -p tor-protover --bump minor
cargo set-version -p tor-bytes --bump minor
cargo set-version -p tor-hscrypto --bump minor
cargo set-version -p tor-socksproto --bump minor
cargo set-version -p tor-checkable --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-proto --bump minor
cargo set-version -p tor-netdoc --bump minor
cargo set-version -p tor-consdiff --bump minor
cargo set-version -p tor-netdir --bump minor
cargo set-version -p tor-congestion --bump minor
cargo set-version -p tor-persist --bump minor
cargo set-version -p tor-chanmgr --bump minor
cargo set-version -p tor-ptmgr --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 tor-hsclient --bump minor
cargo set-version -p tor-hsservice --bump minor
cargo set-version -p arti-client --bump minor
cargo set-version -p arti-rpcserver --bump minor
cargo set-version -p arti-config --bump minor
cargo set-version -p arti-hyper --bump minor

cargo set-version -p arti --bump patch
cargo set-version -p arti-bench --bump patch
cargo set-version -p arti-testing --bump patch
```
2023-05-03 08:31:11 -04:00
Nick Mathewson 9ecc237c18 Run cargo update again. (Tracing 0.1.38 has been yanked) 2023-04-29 08:10:34 -06:00
Nick Mathewson 6d28469ba1 Run cargo update in preparation for release next week 2023-04-28 15:09:03 -06:00
Nick Mathewson 56b99075f6 Upgrade to serial_test 2.0.0 2023-04-28 10:35:54 -06:00
Nick Mathewson f33aefd76c rpcserver: Use with_fn. 2023-04-19 12:38:26 -04:00
Nick Mathewson 6f6a4d073e rpcbase: Use with_fn. 2023-04-19 12:38:26 -04:00
Ian Jackson 6cdd7cc884 Run cargo update
The lockfile on main seems to be broken.  I skim-eyeballed the diff,
which is entirely autogenerated.
2023-04-13 15:46:00 +01:00
gabi-250 31b6c9243d Merge branch 'use_secmem_proc_03' into 'main'
Update our secmem_proc dependency to 0.3.0

Closes #664

See merge request tpo/core/arti!1138
2023-04-13 14:26:06 +00:00
gabi-250 da790e4b78 Merge branch 'misc_upgrades' into 'main'
Upgrade a couple more dependencies

See merge request tpo/core/arti!1139
2023-04-13 14:25:13 +00:00
Nick Mathewson 4efb423947 Upgrade our hex-literal dependency 2023-04-13 07:51:26 -04:00
Nick Mathewson 50d95964d1 Upgrade our num_enum dependency. 2023-04-13 07:50:11 -04:00
Nick Mathewson 6e83139fc7 Update our secmem_proc dependency to 0.3.0
(This wasn't possible before we updated our MSRV to 1.65.)

Closes #664.
2023-04-13 07:41:46 -04:00
Nick Mathewson 739561b2cb rpcbase: Use correct error codes, and add tests.
Well, mostly correct.  Our current serde implementation doesn't
tell us much about what went wrong with the object, so we can't
tell why we couldn't convert it into a Request.

Also, our output for the data field is not as the spec says:
we should bring them into conformance.

Part of #825.
2023-04-12 13:32:15 -04:00
Nick Mathewson 9a5f319a84 Rename tor-rpccmd to tor-rpcbase. 2023-04-12 07:34:57 -04:00
Nick Mathewson 0eb15ae592 rpc: Reify and expose DispatchTable. 2023-04-12 07:34:57 -04:00
Nick Mathewson 07bb57a4c2 rpc: Remove anyhow dependency 2023-04-12 07:34:57 -04:00
Nick Mathewson 06b2180907 rpc: Add a demonstration feature to "arti"
It's experimental, and tokio-only.  To enable it, build with
the "rpc" feature turned on, and connect to
`~/.arti-rpc-TESTING/PIPE`.  (`nc -U` worked for me)

I'll add some instructions.
2023-04-12 07:34:57 -04:00
Nick Mathewson b024fe5596 rpc: Add an authentication step.
Per our design, every connection starts out unauthenticated, and
needs one authenticate command to become authenticated.

Right now the only authentication type is "This is a unix named
socket where everybody who can connect has permission."
2023-04-12 07:34:57 -04:00
Nick Mathewson f9de7929c1 RPC: add a temporary "listen" function.
It requires tokio, it's unix-only, and makes some unfortunate
shortcuts.  Probably good enough for initial testing.
2023-04-12 07:34:57 -04:00
Nick Mathewson dce9c530ec rpc: Add an RpcError type.
This could have been a trait instead, but I don't know whether
that's smart or not.  There is a lot of opportunity for refactoring
here.
2023-04-12 07:34:57 -04:00
Nick Mathewson dec23c1cf6 rpc: Make invoke return a Result of erased_serde::Serialize
This will let the actual RPC functions return any Result type that
we can serialize.
2023-04-12 07:34:57 -04:00
Nick Mathewson 83b908aa3e rpc: Add Update functionality to rpc::Context.
I'm not sure about these APIs at all!  They force us to use
`async_trait` for `tor_rpccmd::Context`, which bothers me. Should we
just have a function that returns
`Option<Box<dyn Sink<Item=X, Error=Y>>` or something?  If so,
what's the correct Y?
2023-04-12 07:34:57 -04:00
Nick Mathewson e26d9452dc RPC: Initial implementation of a multiple-argument dispatch
This code uses some kludges (discussed with Ian previously and
hopefully well documented here) to get a type-identifier for each
type in a const context.  It then defines a macro to declare a
type-erased versions of a concrete implementation functions, and
register those implementations to be called later.

We will probably want to tweak a bunch of this code as we move ahead.
2023-04-12 07:34:57 -04:00
Nick Mathewson a4660a4e09 Start on a lower-level tor-rpccmd crate.
This crate will hold the backend pieces of RPC interaction that
different parts of Arti get to implement.
2023-04-12 07:34:57 -04:00
Nick Mathewson 5247486cfc rpc: Add asynchronous_codec wrapper for jsonlines. 2023-04-12 07:34:57 -04:00
Nick Mathewson a662fb1296 rpc: Add a cancellable future type.
Ordinarily you can cancel a future just by dropping it, but we'll
want the ability to cancel futures that we no longer own (because we
gave them to a `FuturesUnordered`).
2023-04-12 07:34:57 -04:00
Nick Mathewson 0779d405cf rpc: Implement json message types for serde. 2023-04-12 07:34:57 -04:00
Ian Jackson f5a5743468 hs connect: Test descriptor download 2023-04-11 19:14:01 +01:00
Ian Jackson e6b8752d98 hs dirs: Initial cut at descriptor downloading
There are many TODOs here.  Some are questions; some are
straightforward and can be done in followups.

With this code, I am able to reach the eprintln! and todo! with
  curl --socks5-hostname localhost:9150 https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/
2023-04-11 19:14:01 +01:00
Ian Jackson 99bc97118f hs desc: Record a Timebound<HsDesc> (but not really for now)
We have a local alias of `HsDesc = String` which needs to be got rid
of.

But, right now the alternative would be to implement all the code for
signature checking and decryption of an `HsDesc`, before we can make a
test case for the downloader part.
2023-04-11 19:14:01 +01:00
Nick Mathewson 6f6145c32d Update to new version of crossbeam-channel.
The previous one is yanked, which is making our cargo-audit
script fail.
2023-04-10 07:35:17 -04:00
Ian Jackson 173b577069 Merge branch 'req' into 'main'
tor-dirclient: Provide HsDescDownloadRequest

See merge request tpo/core/arti!1097
2023-04-04 16:15:37 +00:00
Nick Mathewson 559aed002f Merge branch 'x25519' into 'main'
tor-llcrypto: Pin x25519-dalek version, bump our crate version

Closes #807

See merge request tpo/core/arti!1108
2023-04-04 12:51:39 +00:00
Ian Jackson ed594b5a6f tor-llcrypto: Pin x25519-dalek version, bump our crate version
Fixes #807
2023-04-04 11:59:54 +01:00
Ian Jackson 4a754ae76a tor-dirclient: Provide HsDescDownloadRequest
In my tests this seems to do the right thing, but I'm getting 404s.
I'm not sure if actually this URL is wrong.
2023-04-03 17:32:48 +01:00
Nick Mathewson b62ca56805 Run cargo-update to move away from yanked versions of "windows"
(cargo-audit is complaining about these and breaking CI)
2023-03-31 09:40:12 -04:00
Nick Mathewson 9ef115a7fb Patchlevel bumps for crates whose dependencies just changed.
These crates had no changes until just a moment ago. But since
we updated the versions on some of their dependents, they have now
changed themselves.  Thus they get patchlevel bumps.

```
tor-rtmock
tor-protover
tor-socksproto
tor-consdiff
tor-chanmgr
tor-dirclient
tor-hsservice
```
2023-03-31 08:30:14 -04:00
Nick Mathewson e208fb15ad Bump crate versions that have breaking changes
These crates have had breaking changes.  They are pre-1.0, so they get
a minor bump.

```
tor-basic-utils
tor-config
```
2023-03-31 08:28:06 -04:00
Nick Mathewson a81ab391ae Bump patchlevel on crates with non-breaking changes
For these crates, the changes are nontrivial, so we
_do_ bump the versions on which their dependent crates depend.

Fortunately, since they are all pre-1.0, we don't need to
distinguish semver-additions from other changes.  (Except for arti,
which _is_ post-1.0, but gets a patchlevel bump anyway.)

These are unstable crates with breaking changes:

```
tor-hscrypto
tor-hsclient
```

These have new or extended APIs:

```
safelog
tor-bytes
tor-cell
tor-linkspec
tor-llcrypto
tor-proto
tor-cert
arti-client
```

These have new unstable APIs or features:
```
tor-netdoc
tor-circmgr (also broke some unstable APIs)
arti (is post-1.0)
```

These have bugfixes only:
```
caret
tor-dirmgr
```
2023-03-31 08:24:39 -04:00
Nick Mathewson 622c79aaa6 Bump patchlevel on crates with semver-irrelevant changes.
Their dependents are _not_ updated to a more recent version.

These bumped the version of a dependency that they don't expose
```
tor-rtcompat
fs-mistrust
```

This one had internal refactoring:
```
tor-netdir
```

These had trivial changes only:
```
tor-checkable
tor-ptmgr
tor-guardmgr
arti-hyper
arti-bench
arti-testing
```
2023-03-31 08:20:58 -04:00
Nick Mathewson 0158f60506 Run cargo update in preparation for release tomorrow. 2023-03-30 14:49:23 -04:00
Nick Mathewson 26ee1feeb1 Upgrade dependency to latest rusqlite. 2023-03-30 08:33:44 -04:00
Nick Mathewson 289c30c5f0 Upgrade dependency to latest async-native-tls. 2023-03-30 08:32:18 -04:00
Nick Mathewson a62affd66e Move functionality from tor_basic_utils to tor_async_utils
This commit is mostly code movement; I'd recommend reviewing it
with git's `--color-moved` option.
2023-03-29 13:57:11 -04:00
Nick Mathewson 1ee4a98a27 Make a new empty tor-async-utils crate. 2023-03-29 09:02:20 -04:00
Gabi Moldovan a1074c0027 Add builder for encoding hidden service descriptors.
This introduces the `NetdocBuilder` trait described in
`netdoc-builder.md` and a new `tor-netdoc::doc::hsdesc::build` module,
which exports the `HsDescBuilder`. Hidden services will use
`HsDescBuilder` to build and encode hidden service descriptors.

There are several TODOs in the code that I'm planning to address
separately.

Partially addresses #745.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-03-24 18:57:49 +00:00
Ian Jackson 1cdfd4f109 Update to shellexpand 3.1.0 so we can use dirs 5 everywhere
Results of precisely
  cargo update -p shellexpand

Incorporates changes I have made to shellexpand to allow use of
dirs 4 *or* dirs 5.
2023-03-24 13:18:11 +00:00
Nick Mathewson 3459d39906 Update required openssl version
cargo-audit is complaining about 0.10.45.
2023-03-24 08:02:59 -04:00
Alexander Færøy 6fae5cc7e9 Merge branch 'upgrade_dirs' into 'main'
Bump to the lastest versions of dirs and directories.

See merge request tpo/core/arti!1072
2023-03-23 16:00:50 +00:00
Ian Jackson 3d33ad7fdf arti-client: Create an HsClientConnector 2023-03-23 11:50:18 +00:00
Nick Mathewson 19cdb239bf Bump to the lastest versions of dirs and directories. 2023-03-22 15:15:42 -04:00
Nick Mathewson 35967ca38d circmgr: Declare builder() unconditionally.
(Still, only expose it when experimental-api is enabled.)
2023-03-22 12:35:41 -04:00
Nick Mathewson d6bb8fee0b Upgrade to bitflags 2.0
This version of bitflags now requires us to explicitly list the
traits that we want to derive for our bit-flags structs.
2023-03-13 08:47:14 -04:00
Ian Jackson c198a26bf7 arti-client: Parse .onion addresses and dispatch to client.rs
Now, a Host has a separate variant for `.onion` which is always used,
even when HS is disabled.

Currently it ends in a todo!.
2023-03-09 13:41:12 +00:00
Nick Mathewson bc83d1e1de tor-proto: Implement functionality to send a message and accept replies
This new function combines "sending a message" and "accepting
replies in a stream" into a single call, so that there is no gap
between when the message is sent and the replies are available.

There are a number of compromises here, in order to avoid API
proliferation. I've tried to contain them as best I can.

See comments for additional design discussion.
2023-03-08 14:21:33 -05:00
Ian Jackson 7081b73c92 Impl Redactable for HsId 2023-03-07 19:03:28 +00:00
Ian Jackson 641e99af98 impl Display for HsId 2023-03-07 16:32:27 +00:00
Ian Jackson b6fc44aa71 hsclient state: Split off MultikeyIsolatedMap 2023-03-01 16:39:03 +00:00
Ian Jackson 1f03e118ef hsclient state: Restructure using a scope to drop the mutex guard
Explicit drops don't work.  Instead, introduce a scope.

We need two scopes, actually: one where we do the initial table
wrangling, and one for the retries after relock.

So we must put the meat in a closure so we can reuse it.
And we must return the flow control as an enum.  Bah, etc.

Avoid reformatting this for the moment.  This makes the delta legible...
2023-03-01 16:39:03 +00:00
Ian Jackson ab163cf81a hsclient state: Test most important code paths 2023-03-01 16:27:19 +00:00
Ian Jackson d384c3b475 hsclient state: Provide one test 2023-03-01 16:27:17 +00:00
Ian Jackson d7602c5be4 hsclient: Use a generic to provide a mock for connect()
This will allow us to test state.rs.
2023-03-01 16:20:16 +00:00
Ian Jackson feab6faa9e tor-circmgr: Provide testing feature and TestConfig
Like the similar thing in tor-guardmgr.
2023-03-01 16:20:16 +00:00
Ian Jackson e8b5195281 hsclient: Implement connection attempt tracking state machine
This compiles, but it cannot work yet.  Nor can it conveniently be tested.
2023-03-01 16:20:16 +00:00
Ian Jackson 4ec9ec92bc HS secret keys: Move aggregate/config to tor-hsclient
Provide a more cookied "secret keys for use to connecting to a
particular HS" type, with a builder.

This wants to use config stuff, so oughtn't to be in tor-*crypto.
The individual types remain there.
2023-03-01 16:19:31 +00:00
Nick Mathewson d69ed3bc62 hscrypto: Make several types Readable+Writeable
Specifically, RendCookie, Subcredential, HsId, and HsBlindId.
2023-02-28 11:08:31 -05:00
Nick Mathewson 2c9f8e3547 Follow-on patchlevel bumps for crates with changed dependencies
These crates didn't have any changes until now, when I bumped
the versions of some other crates they depend on:

tor-consdiff
arti-hyper
arti-bench
arti-testing
2023-02-28 07:18:37 -05:00
Nick Mathewson f41449d0bd Patchlevel bumps for remaining changed crates.
These crates have had small code changes, but no API additions:

tor-config
tor-socksproto
tor-cert
tor-chanmgr
tor-ptmgr
tor-guardmgr
tor-circmgr
tor-dirclient
tor-dirmgr
arti
tor-hsservice
tor-congestion

These crates have had API extensions:

fs-mistrust
tor-llcrypto
tor-bytes
tor-checkable
tor-linkspec
tor-netdoc
tor-persist
arti-client
2023-02-28 07:13:27 -05:00
Nick Mathewson 3e1ae65212 Bump tor-units version for breaking change.
(The breaking change was removing `as_days()` from IntegerMinutes.)

We are _not_ calling this a downstream-api breaking change, per
discussion at
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012?commit_id=bb2ab7c2a3e0994bb438188511688b5b039cae29#note_2876819
2023-02-28 07:10:00 -05:00
Nick Mathewson 4479d52a88 Bump patch-versions for breaking changes in tor-hs{crypto,client}
These are API breaks, but the crates themselves are currently
100% experimental, so there's no need to bump the minor versions
according to our semver rules.
2023-02-28 07:06:15 -05:00
Nick Mathewson 3e257a7cb5 Bump minor versions for significant breaking changes.
This includes tor-cell, tor-proto, and tor-netdir.
2023-02-28 07:05:15 -05:00
Nick Mathewson 5769cdd9be Run cargo update in preparation for Wednesday Release 2023-02-27 07:47:11 -05:00
Nick Mathewson a300bed405 Run "cargo update" in preparation for the release in 2 weeks. 2023-02-17 14:22:57 -05:00
Nick Mathewson 0f2218f4d3 Merge branch 'ticket_525_part3_take2' into 'main'
Finish #525 for relay messages: Only parse messages at the last instant.

Closes #773 and #525

See merge request tpo/core/arti!1017
2023-02-15 16:35:27 +00:00
Nick Mathewson ca3b33a1af tor-cell: Refactor relay cells to copy much less
We now manipulate raw relay cell bodies as (an alias for)
`Box<[u8;509]>` rather than as (an alias for) `[u8;509]`.  This
enables us to do much less copying.  It will become more important
soon, as we defer parsing relay cell bodies even longer.

Related to #7.

We also use SliceWriter to avoid allocating a Vec<> for every relay
message we want to encode, and instead encode directly into the
cell.
2023-02-15 10:48:19 -05:00
Nick Mathewson f1ec64bfe5 Upgrade to latest toml crate.
(None of the breaking changes affect us this time.)
2023-02-14 11:06:00 -05:00
Nick Mathewson 696b9bd2d5 Merge branch 'ticket_525_part2' into 'main'
Apply restricted_msg to ChanMsg parts of tor-proto

See merge request tpo/core/arti!1013
2023-02-09 18:06:39 +00:00
Nick Mathewson 16b9d23a7c tor-cell: Make RelayEarly a separate type.
This allows us to remove a shenanigan from `restricted_msg!{}`.
2023-02-09 10:20:28 -05:00
Ian Jackson fe1113bd6b hsdir representation: Introduce HsDirs generic type
This already allows us to get rid of some duplication, and will be
useful more widely in a moment.
2023-02-09 13:01:37 +00:00
Ian Jackson 4626ccfcaa hs time handling: Make TimePeriod contain length as IntegerMinutes
Locally, the only functional effect is that now we refuse to handle
non-whole-number-of-minutes lengths - but since the consensus
parameter can't represent those, there's no overall functional change.
2023-02-09 12:56:18 +00:00
Nick Mathewson 0a80c468df hsdesc: Use an IntegerMinutes<u16> to hold lifetime. 2023-02-08 13:33:07 -05:00
Nick Mathewson f5f8402d50 tor-cell: Macro to generate restricted RelayMsg and ChanMsg.
This is the main implementation part of #525.
2023-02-07 16:03:14 -05:00
Nick Mathewson 698b997228 Bump openssl-src to 1.1.1t. 2023-02-07 15:16:44 -05:00
Nick Mathewson 23757d90c1 netdoc: Parse the inner layer of an onion service descriptor.
There are some places where I note certificates which are not
currently validated, because there is no cryptographic point in
doing so.  We should either document that this is okay, or validate
the certificates anyway.

This code might benefit from refactoring to make it prettier.
2023-02-07 09:02:15 -05:00
Nick Mathewson 02fa682bc0 netdoc: implement onion service descryptor encryption
This is tested via a round-trip check, and via a successful
decryption of our example descriptor's outer layer.
2023-02-07 09:02:13 -05:00
Ian Jackson 2dbffa1208 tor-netdir: Use typed-index-collections for router status index 2023-02-01 19:40:17 +00:00
Nick Mathewson a2b1f20216 Bump minor version of tor-cell.
In !948 we renamed a couple of accessor functions, which is a
breaking change in `tor-cell`'s API.

In retrospect, perhaps we should have deprecated the old names and
added the new ones, so we wouldn't have to break the API.  (This is
the only API break AFAICT since 1.1.0.)
2023-02-01 10:42:58 -05:00
Nick Mathewson 7c1b6a5a81 Bump the patch version of every crate that had API additions
These crates had API or behavior changes that may affect downstream
crates. Fortunately, they're all version 0.x, and don't need minor
bumps for this.
2023-02-01 10:36:29 -05:00
Nick Mathewson 66f594a4b6 Bump the patch-level version of crates with _minor_ changes.
These changes influence behavior, but not effect compatibility.
(If I messed up, and any crate except for `arti` has non-breaking
API changes, that's still fine, since they are all version
0.x.)
2023-02-01 10:23:58 -05:00
Nick Mathewson 592d6bf8a3 Bump the patch version of each crate with _trivial_ changes.
These crates have not had changes to their behavior; as such it is
not necessary to bump their dependencies to require the new versions.
2023-02-01 10:10:36 -05:00
Nick Mathewson 970cc6cb29 Run cargo update in preparation for release tomorrow 2023-01-31 15:37:48 -05:00
Nick Mathewson 4e7a552171 netdir: remove the vestigial smallvec implementation I added
It's cute, but I don't think it will help performance, and I'm
undecided about whether the semantic implications are true.
2023-01-28 12:43:08 -05:00
Nick Mathewson 5236c5cf88 netdir: Implement ring-param constructors and time period accessors
This logic is a bit tricky, so I've tried to document it and add
fairly good tests.  The silver lining is that the external API for
all of this logic will make it invisible and hidden.

There are some cases where I added functions that I think might
eventually get lowered into MdConsensus: But I don't want to lower
too much right now, since the convention for our netdoc accessors is
that they are fairly unsophisticated, and they show you the document
as it is.

Closes #686
2023-01-28 12:43:08 -05:00
Ian Jackson f2e254e63d Merge branch 'toml_0.6' into 'main'
Upgrade toml to version 0.6.

See merge request tpo/core/arti!989
2023-01-26 17:34:52 +00:00
Nick Mathewson f9903789d1 Upgrade toml to version 0.6.
This required rewriting some of our error handling code in
command-line processing, since the toml crate now displays and
reports errors differently.  (Admittedly, this code still is kind of
ugly, but at least it is nicely hidden.)
2023-01-25 16:29:53 -05:00
Nick Mathewson 386de7587e hscrypto: Use derive_more, and derive Deref for public keys. 2023-01-25 13:48:40 -05:00