aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/crypto
Commit message (Collapse)AuthorAgeFilesLines
* Upgrade cipher, aes, and ctr.Nick Mathewson2026-07-134-14/+25
|
* tor-proto: circ handshake now always uses NONE destroy reasonSteven Engler2026-06-121-14/+0
|
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-097-0/+7
| | | | | | | | | | | | 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.
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-128-28/+34
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* tor-proto: extend `RelayHandshakeError`Steven Engler2026-04-081-1/+27
|
* proto: Upgrade to latest polyval.Nick Mathewson2026-03-041-2/+9
| | | | | | This will improve performance for CGO. Closes #2390.
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-1/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-067-7/+7
| | | | Run maint/add_warning
* proto: Fix typo in OutboundRelayLayer docs.Gabriela Moldovan2025-10-081-1/+1
| | | | | `OutboundRelayLayer::decrypt_outbound()` is for decrypting cells moving *away* from the client (in the "forward direction").
* proto: Consider the channel queue with "Replace" padding to hop 1.Nick Mathewson2025-09-161-0/+5
| | | | | | | | | When we want to send Replace padding (that is, padding that should only be sent if nothing else is queued) to hop 1, we can allow it to be replaced by cells from _any_ circuit being sent over the same channel. (Nobody but hop 1 can tell the difference.) Closes #2169
* proto: derive Ord for HopNum.Nick Mathewson2025-09-101-1/+1
|
* tor-proto: Switched to "assert in const" patternhashcatHitman2025-09-011-2/+1
| | | | | | | Replaced use of [`static_assertions::const_assert`] with the newly available "assert in const" pattern. Signed-off-by: hashcatHitman <[email protected]>
* proto: Add a circuit module shared between client and relay impls.Gabriela Moldovan2025-08-282-2/+2
| | | | | | | This is just code motion (I suggest reviewing with `--color-moved`). This also moves the implementation-agnostic parts from `tor_proto::client::circuit` to a new `tor_proto::circuit` module.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-078-23/+54
| | | | | | | | | | | | | | 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.
* proto: Construct CGO instances if that is what is selected.Nick Mathewson2025-07-231-0/+8
|
* tor-proto: Compile-time key length constant equality assertionhashcatHitman2025-06-241-6/+4
| | | | | | | - Made an equality assertion between two constants compile-time, resolving a TODO. Signed-off-by: hashcatHitman <[email protected]>
* proto: remove bench pub wrappersLionel Goffaux2025-05-226-285/+85
|
* proto: use consts for bench throuputsLionel Goffaux2025-05-142-0/+6
|
* proto: fix doc typosLionel Goffaux2025-05-143-4/+4
|
* proto: fix name mismatch in the bench utils docLionel Goffaux2025-05-083-10/+10
|
* proto: fix typo s(t)ateLionel Goffaux2025-05-081-3/+3
|
* proto: extend benchmarksLionel Goffaux2025-05-085-147/+303
|
* Use simpler way to refer to last byte of tag.Nick Mathewson2025-05-071-1/+1
|
* proto: Clear low 6 bits of counter in CGO PRF.Nick Mathewson2025-05-071-3/+4
| | | | See torspec#332.
* cell,proto: Split request/response extensions into seprate typesNick Mathewson2025-05-071-9/+9
| | | | Implements part of proposal 358.
* cell: Use ExtList to implement CircRequestExt.Nick Mathewson2025-05-071-3/+4
| | | | This required some renaming, so that the types and their codes matched.
* Rename NtorV3Extension to CircRequestExtNick Mathewson2025-05-071-16/+16
| | | | | | | This type will, because of prop358, be shared by ntorv3, hs-ntor, and probably other future handshakes. There will also be a CircResponseExt type.
* tor_proto: name fields in bench_utils.Nick Mathewson2025-05-061-7/+10
|
* proto: Apply type-specific wrappers for tor1 cryptoNick Mathewson2025-05-063-61/+65
| | | | | | | | | | | | | Now instead of using CryptState for everything, we have specific types for each role and direction of crypto. This turned up a harmless-so-far bug in our onion service code: as an onion service, we were using _client_ crypto layers to respond to a client request. That's not correct, and wouldn't have worked with CGO. Instead, we need to use relay crypto layers, wrapped as client layers. Closes #1975.
* proto, cell: Remove RelayCellFormatTrait.Nick Mathewson2025-05-063-136/+76
| | | | | | | | | | | | | | | | The purpose of the trait was to parameterize the tor1 cell crypto on the different possible relay cell layouts. It made sense to have this trait when we thought we would implement the new cell layout for prop340 (packed-and-fragmented) well before we implemented CGO. But it now appears all but certain that CGO will land long before we make any more headway on prop340. Therefore, it doesn't make sense to carry the ability to customize `tor1` for other relay cell layouts. Removing this trait saves a fair bit of complexity.
* tor-proto: Rename some no-longer-apt tor1 members.Nick Mathewson2025-05-061-14/+13
|
* tor-proto: remove some now-unneeded accessors.Nick Mathewson2025-05-061-35/+15
|
* Emit SendmeTag directly from cell crypto.Nick Mathewson2025-05-063-79/+70
| | | | | | | | | | | | | | | | | | | | This changes the code to copy a SendmeTag rather than returning a slice. This isn't actually a big change: sending a slice already required 16 bytes (on 64-bit platforms), so sending a SendmeTag around isn't a big deal. We rely extensively on the compiler's ability to optimize away all the checking in code like this: ``` let slice: &[u8]; let a: [u8;N] = slice[0..N].try_into().expect("Nope"); ``` I've spot-checked it somewhat with "cargo-show-asm", but it could use more thorough checking. Closes #1956.
* proto: Split out CGO BlkCipher trait for Encryption/DecryptionNick Mathewson2025-05-062-57/+172
| | | | | | This lets us use `Aes128Dec` and `Aes128Enc` in place of plain old `Aes128`, which can be less space-efficient depending on the back-end.
* tor-proto: use RelayCellFormat rather than u8 in tests.Nick Mathewson2025-04-291-14/+14
| | | | (The u8 code was written before RelayCellFormat::V1 was introduced.)
* Rename feature cgo => counter-galois-onion.Nick Mathewson2025-04-291-3/+3
|
* CGO: Fix authenticated-sendme tag handling.Nick Mathewson2025-04-291-5/+20
| | | | | | See discussion at torspec#328: it's important that our SENDME authentication tag always be taken based on the _encrypted_ cell.
* CGO: Note another possible performance improvement.Nick Mathewson2025-04-291-0/+3
|
* proto: Implement and test CGO cryptography.Nick Mathewson2025-04-292-13/+316
| | | | | | | | This provides all the operations from proposal 359, along with the necessary integration and unit tests to make sure that they are behaving properly. Closes #1943
* proto: Implement UIV+, the wide-block RPRP used for CGO.Nick Mathewson2025-04-291-1/+174
|
* proto: Implement CGO functions ET and PRFNick Mathewson2025-04-291-3/+321
| | | | | | | These are a tweakable block cipher, and a pseudorandom byte stream. This commit includes test vectors, which were generated from the Python reference implementation and confirmed with a less optimized Rust implementation.
* New empty CGO module.Nick Mathewson2025-04-291-0/+23
|
* proto: Unified integration tests for relay crypto.Nick Mathewson2025-04-291-3/+210
|
* proto: Make relay-side cell crypto traits return tags.Nick Mathewson2025-04-292-15/+20
| | | | | | (We'll need these tags both to implement authenticated SENDMES at the relay side, and also to make sure that cgo is generating them correctly.)
* proto: Make crypt layers take a ChanCmd argumentNick Mathewson2025-04-293-42/+52
| | | | | | CGO will need this argument so that it can authenticate the command as part of its crypto operations. (Trying to meddle with RELAY vs RELAY_EARLY will no longer work!)
* proto: refactor RelayCrypt trait into separate traitsNick Mathewson2025-04-293-19/+78
| | | | | | It seems very likely that, as with client crypto, we'll want relay crypto to separable into "forward" and "reverse" objects, so that the two can be used more or less independently.
* proto: Tweak semantics of RelayCrypt::originate.Nick Mathewson2025-04-293-3/+5
| | | | | | | | | | This makes the behavior of "originate" match the behavior of OutboundClientLayer::originate_for, which creates the message _and_ encrypts it. This will be necessary for CGO, where "originate" and "encrypt" are not easily separated operations. (Nothing uses this trait yet, since relay circuits aren't yet a thing, so it's a good time to get it right.)
* proto: move tor1 testvector test into tor1 module.Nick Mathewson2025-04-292-54/+79
|
* proto: Clean up imports in tor1.rs.Nick Mathewson2025-04-292-6/+8
|
* proto: Move tor1 relay crypto to a separate file.Nick Mathewson2025-04-292-312/+312
| | | | | | | Since we're about to have a second kind of relay cell crypto, it makes sense to move this module. This change is pure code movement.