| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
This eliminates some string slicing.
|
| |
|
|
|
|
|
|
| |
This commit adds #[allow(clippy::string_slice)] to all functions in the
code where string slices are used, alongside a TODO comment.
We do this add the function header to have it consistent, as things like
expression based allow's are still experimental.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This commit executes maint/add_warning with the just added change to
deny string slices except in tests.
I recommend auditing this by checking out the previous commit followed
by running the script yourself and then verifying that the diff is
identical to this commit.
This commit makes cargo clippy fail. We will add exceptions in the next
commit.
|
| | |
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
|
|
|
| |
I don't know why this was breaking rust-recent-async-std-rustls, but oh
well.
Signed-off-by: hashcatHitman <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
The macros to deftly derive `ConstantTimeEq` and `PartialEq` (for
`ConstantTimeEq`) are now only defined in `tor-llcrypto` and exported.
The macro to deftly derive `ConstantTimeEq` is now struct only and uses
`subtle::Choice::from(1)` for improved clarity.
Signed-off-by: hashcatHitman <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is my initial attempt at deriving ConstantTimeEq and PartialEq.
This includes the previously missed HsSvcNtorKeypair and
HsClientDescEncKeypair types.
In tor-llcrypto, a few implementations still had to be done by hand, and
some types which previously derived normal PartialEq now derive it with
ConstantTimeEq.
I could not figure out how to properly set up the macros such that they
could be used both in the current crate and in others, so for the moment
they are duplicated. Just so I can get feedback. Ideally, this will be
replaced with a better solution before merge.
Signed-off-by: hashcatHitman <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implemented `subtle::ConstantTimeEq` for all of the following types:
- `pk::HsIdKey`
- `pk::HsIdKeypair`
- `pk::HsBlindIdKey`
- `pk::HsBlindIdKeypair`
- `pk::HsDescSigningKey`
- `pk::HsDescSigningKeypair`
- `pk::HsIntroPtSessionIdKey`
- `pk::HsIntroPtSessionIdKeypair`
- `pk::HsSvcNtorKey`
- `pk::HsSvcNtorSecretKey`
- `pk::hs_client_intro_auth::HsClientIntroAuthKey`
- `pk::hs_client_intro_auth::HsClientIntroAuthKeypair`
- `pk::HsClientDescEncKey`
- `pk::HsClientDescEncSecretKey`
- `pk::HsSvcDescEncKey`
- `pk::HsSvcDescEncSecretKey`
- `pk::HsSvcDescEncKeypair`
`PartialEq` has also been implemented for all listed types, using the
constant time comparison under the hood.
Signed-off-by: hashcatHitman <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
```text
INFO tor_hsservice: Generated a new identity for service bar: ???mad.onion
```
After:
```text
INFO tor_hsservice: Generated a new identity for service foo: […]2qd.onion
```
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, run
```
git grep -l "^edition =" |
xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;'
```
Second, manually verify that all Cargo.toml files have changed,
and nothing else has changed.
Third, run cargo fmt again.
|
| |
|
|
| |
Closes #2012.
|
| | |
|
| |
|
|
| |
Made with https://crates.io/crates/typos-cli
|
| |
|
|
|
|
|
|
|
|
|
| |
With this change, we'll no longer need to expose the types from
dalek-cryptography as part of our API, and we'll have more freedom
to switch ed25519 implementations, or to upgrade to a newer
`rand` ahead of their schedule.
Unlike with x25519-dalek, I had to tweak the API a bit: There's no
way to get a &PublicKey out of a Keypair now, and implementing the
old ed25519-dalek traits seemed unnecessary.
|
| |
|
|
|
|
|
|
|
| |
This enables us to get rid of the tor-key-forge -> tor-hscrypto
dependency, partially addressing the TODO from `tor_key_forge::traits`.
This commit is mostly code motion. Best reviewed with `--color-moved`.
See also #1778
|
| |
|
|
|
|
|
|
|
|
| |
Also changes the `ErrorKind` of `BadOnionAddress` to
`ForbbiddenStreamTarget`.
See context in
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2246#note_3045683
Closes #1483
|
| |
|
|
| |
Part of #1476
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
FooKeypairSpecifier` instances
This adds the following trivial `From` instances:
- tor_hsservice: impl From<&HsIdPublicKeySpecifier> for HsIdKeypairSpecifier
- tor_hsservice: impl From<&BlindIdPublicKeySpecifier> for BlindIdKeypairSpecifier
- tor_hscrypto::pk: impl From<HsBlindIdKeypair> for HsBlindIdKey
- tor_llcrypto::pk::ed25519: impl From<ExpandedKeypair> for PublicKey
- tor_keymgr::mgr: impl From<TestKey> for TestPublicKey
- tor::hscrypto::pk: impl From<HsIdKeypair> for HsIdKey
|
| |
|
|
| |
Needed because such keys will be stored in the `OnionServiceConfig`.
|
| | |
|
| |
|
|
| |
Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2246#note_3045656
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
We will use this impl for parsing the authorized clients of a hidden
service running in "restricted discovery" mode.
NB: "Restricted discovery" is the new terminology for "services that
require client authorization", i.e. services that implement "client
authorization" as described in rend-spec HS-DESC-ENC[0]. Note we haven't
fully transitioned to the new terminology yet (see #1476).
Part of #1292
[0]: https://spec.torproject.org/rend-spec/hsdesc-encrypt.html#HS-DESC-SECOND-LAYER
|
| |
|
|
|
|
|
|
|
|
|
| |
I don't think we need a separate wrapper type for displaying
`HsClientDescEncKey` keys in the "C Tor format"
(`<auth-type>:<key-type>:<base32-encoded-public-key>`).
I think this should be the canonical string representation of
`HsClientDescEncKey`, so I'm removing the `display_authorized_client`
function and corresponding `DisplayAuthorizedHsClientDescEncKey` wrapper
type.
|
| |
|
|
|
|
|
| |
This will enable us to implement the `arti hsc` client subcommand for
generating client auth keys (#1281).
Closes #1291
|
| | |
|
| | |
|
| |
|
|
|
| |
With this change, we no longer expose the ExpandedSecretKey
unescorted, which makes it harder to misuse the API.
|
| |
|
|
|
|
|
| |
This type was part of `hazmat`, and was no longer necessary anywhere
in our codebase. (It had one remaining user, which was easy enough
to remove.) By removing it, we remove the opportunity for using an
unescorted ed25519 private key.
|
| |
|
|
|
|
|
|
|
|
| |
This code was needed with the old version of dalek-cryptography,
which wasn't compatible with up-to-date versions of the `rand`
crate(s). But now that we've upgraded, we can drop this.
(We could have left it around and deprecated it, but we are already
making a breaking change to tor-llcrypto by upgrading
dalek-cryptography.)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main changes that we have to adjust for are as follows:
* In x25519-dalek:
* `StaticSecret` is now behind a feature.
* `StaticSecret::new` is deprecated in favor of
`StaticSecret::random_from_rng`.
* StaticSecret no longer does its own clamping.
* In ed25519-dalek:
* `SecretKey` has (in effect) been renamed to `SigningKey`. The name
`SecretKey` is now an alias for `[u8; 32]`.
* `SigningKey` is effectively a keypair, since it contains a
public key as well.
* `PublicKey` has been renamed to `VerifyingKey`.
* The functions to extract a signing key and verifying key have
been renamed as you might expect.
* `ExpandedSecretKey` has been moved to `hasmat` and no longer
implements `sign`.
* `ExpanededSecretKey` now has as its elements a scalar and a hash
prefix.
* Various functions that took `&[u8]` now take `&[u8; N]`.
* We no longer need a wrapper for older versions of rand.
There is a single test in tor-keymgr that does not pass. I've
marked it as ignore for now, in hopes that @gabi-250 can help me
figure it out.
This closes #808. There are several changes I want to make before
we merge, however. They are marked with TODO DALEK.
|
| |
|
|
|
|
|
|
|
| |
1. Move `impl From<SpecificKeypair> for curve25519::StaticKeypair`
(which was just a bespoke impl for HsClientDescEncKeypair)
into the define_pk_keypair macro, so everything has it.
Currently the only other user of the curve25519_pair feature is HsSvcNtorKey.
2. Provide the reverse conversion too.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
We need to add a module-global `#[allow(deprecated)]` to silence the
deprecation warnings coming from the derived `derive_more` impls of the
2 newly deprecated structs. Since we don't want the `allow` to apply to
the entire `pk` module, let's put `HsClientIntroAuthKey` and
`HsClientIntroAuthKeypair` in a separate module and apply the
`#[allow(deprecated)]` there.
|
| |
|
|
| |
Part of #1037
|
| |
|
|
|
|
|
|
| |
Sometimes it's useful to have the ability to derive the `HsIdKey` from
the keypair (for example, if we've just read the `HsIdKeypair` from the
keystore and also need the `HsIdKey`, this `From` impl enables us to
derive the public part of the key, instead of having to read it from the
keystore).
|
| | |
|
| |
|
|
| |
We need it to sign descriptors.
|
| |
|
|
| |
Needed to implement `PartialEq` for `AuthorizedClientConfig`.
|
| |
|
|
|
| |
(Also, extend our macro so that we can wrap other curve25519 keys in
this way, if we want.)
|
| |
|
|
| |
This will be used by the descriptor publisher when building descriptors.
|
| |
|
|
|
|
| |
This function will be used by the descriptor publisher (it needs to
generate descriptors, and for that it needs the subcredential, which can
be derived from the `HsBlindIdKey` and `TimePeriod`).
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Use this to emit HS_BAD_ADDRESS as appropriate.
|
| |
|
|
|
|
|
|
| |
(I'm not removing it entirely since maybe we _should_ use it, and
maybe we _will_ as we do services. I've added a TODO HS for
removing it or using it, and removed the TODO HS at the head of
pk.rs about making sure that all the key types in the module really
belong there.)
|
| | |
|
| |
|
|
|
|
| |
I think it isn't actually a great idea for HsIdParseError to
implement ErrorKind, since the actual ErrorKind would depend
entirely on where the problematic ID came from.
|