aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-llcrypto/tests
Commit message (Collapse)AuthorAgeFilesLines
* llcrypto: Don't take or return "unescorted" ed25519 keys.Nick Mathewson2023-05-181-1/+4
| | | | | | | | | | | | 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 )
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-272-0/+4
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* Complete our migration to base64ct.Nick Mathewson2023-01-201-3/+4
| | | | | | | | | This is in lieu of upgrading to the latest base64 crate, which has a different API from the old one. Since we have to migrate either way, we might as well use base64ct everywhere. I don't think that most of these cases _require_ constant-time base64, but it won't hurt.
* Merge branch 'fix-nightly-clippy' into 'main'Ian Jackson2022-09-221-3/+3
|\ | | | | | | | | Fix nightly clippy See merge request tpo/core/arti!729
| * fix clippy::needless_borrowtrinity-1686a2022-09-101-3/+3
| |
* | Add a new constant-time is_zero() check for RsaIdentityNick Mathewson2022-09-201-0/+20
|/ | | | | | | | | | | | | There are some places in the protocol where we have an all-zero RSA identity that does not truly represent a key, but rather represents an absent or unknown key. For these, it's better to use `RsaIdentity::is_zero` instead of manually checking for a set of zero bytes: it expresses the intent better, and ensures that the operation is constant-time. I am deliberately not introducing a more general IsZero trait here, or implementing is_zero for anything else: This is the only one we seem to need right now. We can generalize it later if we have to.
* Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
| | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* Upgrade to AES 0.8Nick Mathewson2022-04-261-1/+1
| | | | | | | | Now that we require Rust 1.56, we can upgrade to AES 0.8. This forces us to have some slight API changes. We require cipher 0.4.1, not cipher 0.4.0, since 0.4.0 has compatibility issues with Rust 1.56.
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-252-4/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* Add a from_hex method for RsaIdentity.Nick Mathewson2022-03-041-2/+13
| | | | | | | | | | | | | We perform this operation in a bunch of places, and most of them use hex::decode(). That's not great, since hex::decode() has to do heap allocation. This implementation uses hex::decode_to_slice(), which should be faster. (In the future we might choose to use one of the faster hex implementations, but I'm hoping that this change will be sufficient to get hex decoding out of our profiles.) Part of #377.
* tor-llcrypto: Add test case for RsaIdentity formattingIan Jackson2022-03-021-0/+19
| | | | | | | I'm going to change the code that does this, so add a test first to check the output doesn't change. At some point we should have more RSA tests.
* Remove clippy::needless_borrow exception in CI.Nick Mathewson2022-02-201-2/+0
| | | | | This exception is no longer necessary now that the underlying CI bug is fixed.
* Temporarily disable some clippy lints on nightlyIan Jackson2022-02-021-0/+2
|
* address lint warningsDaniel Eades2021-12-091-1/+1
|
* tor-llcrypto: Put currently unused functions behind features.Nick Mathewson2021-11-121-0/+1
| | | | | | | | We don't currently need a couple of the key manipulation features that we have, since we aren't yet doing relays or onion service clients. Part of #125
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-272-0/+683
This will cause some pain for now, but now is really the best time to do this kind of thing.