summaryrefslogtreecommitdiff
path: root/crates/tor-llcrypto/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix a rustdoc error.Nick Mathewson2023-11-291-1/+1
|
* Resolve an unfinished sentenceNick Mathewson2023-11-291-1/+2
|
* grammar fix in commentgabi-2502023-11-291-1/+1
|
* llcrypto: remove a comment suggesting a grand renaming.Nick Mathewson2023-11-291-3/+3
|
* llcrypto: Hide the members of ExpandedKeypair.Nick Mathewson2023-11-291-5/+15
| | | | | With this change, we no longer expose the ExpandedSecretKey unescorted, which makes it harder to misuse the API.
* llcrypto: Undo internal ed25519-dalek renamings in keymanip.rsNick Mathewson2023-11-291-8/+7
|
* llcrypto: Remove redundant re-exports in keymanip.Nick Mathewson2023-11-291-10/+3
| | | | (These types were all already re-exported from pk::ed25519.)
* llcrypto: Remove ExpandedSecretKey export.Nick Mathewson2023-11-292-6/+3
| | | | | | | 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.
* Fix a typo in comment in llcrypto.Nick Mathewson2023-11-291-1/+1
|
* Clarify and downgrade TODO about ReusableSecret.Nick Mathewson2023-11-291-1/+8
|
* Deprecate convert_ed25519_to_curve25519_private as unusedNick Mathewson2023-11-291-0/+5
|
* Remove RngCompatExt.Nick Mathewson2023-11-293-255/+2
| | | | | | | | | | 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.)
* Convert to the latest versions of dalek-cryptographyNick Mathewson2023-11-294-136/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tor-hscrypto: derive the impl of Debug for curve25519::StaticKeypairIan Jackson2023-11-231-10/+4
|
* tor_llcrypto: expose `Shake256Reader`Jim Newsome2023-11-151-1/+1
|
* tor-llcrypto: Implement Clone and Debug for StaticKeypair.Gabriela Moldovan2023-09-251-0/+11
|
* tor-llcrypto: Add a type for x25519 StaticSecret/PublicKey keypairs.Gabriela Moldovan2023-09-251-0/+9
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-234-0/+4
|
* Resolve warnings about ambiguous/redundant doc linksNick Mathewson2023-08-221-2/+2
| | | | | Nightly rustdoc now warns if you have a link that isn't necessary, and if you have a link that might refer to two different things.
* llcrypto: New SimpleMac traitNick Mathewson2023-08-142-0/+19
| | | | | | | | | This will be useful in preference to the regular Mac trait for the places where we need to pass a Mac key around, but we don't need to support incremental operation. Part of arti#993, where we want to expose a MAC object without exposing sensitive data.
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* tor-llcrypto: Add a missing instance of the standard lint blockIan Jackson2023-07-101-0/+10
| | | | This fixes a needless_vec lint on nightly.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-104-0/+4
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* llcrypto: Add reference to paper about keypair reuse.Gabriela Moldovan2023-06-271-0/+2
|
* llcrypto: Remove `# Availability` doc sections.Gabriela Moldovan2023-06-271-8/+0
| | | | | | | | | | This removes the `# Availability` section from the `convert_ed25519_to_curve25519_private` and `convert_curve25519_to_ed25519_private` docs. We don't generally have this sort of section anywhere else in the codebase (we use unstable cargo-docs features to make sure items are annotated correctly).
* llcrypto: Add cvt-x25519 feature flag for exporting key conversion functions.Gabriela Moldovan2023-06-272-4/+5
| | | | | | The `convert_curve25519_to_ed25519_private` and `convert_ed25519_to_curve25519_private` functions are now exported by `tor-llcrypto` if the `cvt-25519` feature is enabled.
* llcrypto: Add keymgr feature to semver.mdGabriela Moldovan2023-06-271-0/+1
|
* llcrypto: Add `Panics`, `Availability` docs for ↵Gabriela Moldovan2023-06-271-0/+12
| | | | convert_ed25519_to_curve25519_private.
* llcrypto: Fix clippy lint.Gabriela Moldovan2023-06-271-1/+1
|
* llcrypto: Explain what we need the ed25519->x25519 conversion for.Gabriela Moldovan2023-06-271-0/+4
|
* llcrypto: Document how convert_ed25519_to_curve25519_private computes the key.Gabriela Moldovan2023-06-271-0/+5
|
* llcrypto: Add note about bumping x25519-dalek and clamping.Gabriela Moldovan2023-06-271-0/+45
| | | | | | | | | | This adds a TODO explaining how convert_ed25519_to_curve25519_private will need to be audited when we upgrade to the latest x25519-dalek. This also adds a `debug_assertions` and a test that ensures `StaticSecret::from` is clamping the input (when we bump x25519-dalek, the assertions will fail, as the latest version doesn't do clamping in StaticSecret::from).
* llcrypto: Document ed25519->curve25519->ed25519 conversion behaviour.Gabriela Moldovan2023-06-271-0/+5
|
* llcrypto: Implement ed25519_to_curve25519_private conversion.Gabriela Moldovan2023-06-271-0/+57
| | | | | | | | | | | | | In `ArtiNativeKeyStore`, private keys are stored in OpenSSH format. However, `ssh-key` (the crate we use for parsing OpenSSH keys) doesn't support x25519 keys. As a workaround, this type of key will stored as ed25519 and converted to x25519 upon retrieval. This commit implements the `convert_ed25519_to_curve25519_private` conversion function (needed by `ArtiNativeKeyStore` to support x25519 keys). Part of #900
* Back down x25519-dalek to 2.0.0-pre.1 from 2.0.0-rc.2pinkforest2023-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ========================= Notes from nickm: (This differs from pinkforest's original MR: It removes the Cargo.lock changes and the version bump on tor-llcrypto.) Minimal Cargo.lock changes from downgrade. (These are exactly those changes generated by running "build" and "test".) There are several reasons to do this: * It's best to bump all of our dalek dependencies at once to rc.3 or later, rather than the piecemeal approach we've been stuck with so far. * We don't want to do this bump right now, since there are some tricky questions about clamping we need to figure out (see #808), and we need to make sure we get them right, and we're in a distracted this week. * We _do_ need to move away from 2.0.0-rc.2 right now, since it was causing a failure in `cargo install arti`, and then it got yanked. Thanks to pinkforest for helping us out here and explaining all of this! Fixes #926. Commit-edited-by: Nick Mathewson <[email protected]>
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* llcrypto: add another warning to ct_lookup.Nick Mathewson2023-06-161-2/+3
|
* Lower tor-proto::util::ct::lookup to tor-llcryptoNick Mathewson2023-06-161-0/+66
| | | | | | | | This is mostly code movement; you may want to review it with `--color-moved`. I'm doing this so we can also use the function in netdoc for looking up hsdesc authentication.
* tor-llcrypto: remove use of arrayrefNick Mathewson2023-06-013-18/+15
|
* llcrypto: Don't take or return "unescorted" ed25519 keys.Nick Mathewson2023-05-181-19/+37
| | | | | | | | | | | | Per #798, we want to make sure that we never pass around an `ed25519::SecretKey`; only an `ed25519::Keypair` (or `ExpandedKeypair`). This is because, when you're computing an ed25519 signature, you have to use the public key as one of your inputs, and if you ever use a mismatched public key you are vulnerable to a nonce reuse attack. (For more info see https://moderncrypto.org/mail-archive/curves/2020/001012.html )
* llcrypto: Add an `ed25519::ExpandedKeypair` type.Nick Mathewson2023-05-181-0/+25
| | | | | | | | This is like an `ed25519::Keypair`, except that instead of a `SecretKey` it contains an `ExpandedSecretKey`. We'll be using this to implement #798, where we impose a rule that there must be no "unescorted" ed25519 secret keys.
* Use non-deprecated *Secret::random_from_rng.Nick Mathewson2023-05-131-1/+1
| | | | The `new` function is deprecated in x25519-dalek 2.0.0-rc.2
* update rsa to 0.9.xtrinity-1686a2023-05-081-5/+4
|
* tor-llcrypto: key blinding: Use consistent terminologyIan Jackson2023-03-281-19/+22
| | | | | | | | | | | | | | | | | | | | Unhelpfully, the spec uses the variable name `h` and the phrase "blinding factor" for both the unclamped and clamped value. The clamped value is internal to the algorithm. In our code: * Don't ever use the word "parameter" or variable name `param`. This doesn't appear in the spec anywhere. * Use `h` for the unclamped blinding factor, and `blinding_factor` for the clamped blinding factor. * Rename `blinding_factor` function to `clamp_blinding_factor`, since in the spec's terminology it takes an (unclamped) "blinding factor" and returns a (clamped) "blinding factor". * State explicitly what thing in the spec the `h` parameters are.
* Use the type system to enforce use of blinded keys.Gabriela Moldovan2023-03-271-0/+12
| | | | | | | | | | | | | | | Hidden services use blinded singing keys derived from the identity key to sign descriptor signing keys. Before this patch, the hidden descriptor builder represented its blinded signing keys (`blinded_id`) as plain `ed25519::Keypair`s. This was not ideal, as there was nothing preventing the caller from accidentally initializing `blinded_id` with an unblinded keypair. This introduces a new `HsBlindKeypair` type to represent blinded keypairs. Signed-off-by: Gabriela Moldovan <[email protected]>
* Add builder for encoding hidden service descriptors.Gabi Moldovan2023-03-241-1/+1
| | | | | | | | | | | | | | 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 <[email protected]>
* Suppress a renamed-lint lint.Nick Mathewson2023-03-101-1/+2
| | | | | | | The derive_hash_xor_eq lint was renamed in 1.68, but we can't use it under its new name, since we still need to support back to 1.60. Instead, we suppress the warning about the lint being renamed.
* Expose a little new functionality from tor-llcrypto.Nick Mathewson2023-02-281-0/+9
| | | | | Expose ED25519 signature length; make ValidatableEd25519Signature implement Debug and Clone.
* llcrypto: Implement `Into<[u8;32]>` for Ed25519IdentityNick Mathewson2023-02-072-0/+7
|