aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/crypto/cell.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-proto: Make HopNum indices appear 1-based in the Display impl.Gabriela Moldovan2023-08-251-1/+4
| | | | | | | | | | This makes `HopNum`s display as 1-indexed values. This will make error messages more intuitive, because when talking about an N-hop circuit, we generally speak in terms of hops 1..N (rather than 0..N-1). Internally, our `HopNum` indices are still 0-based. Closes #996
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* proto: Add (not-yet-exposed) code to remember and use KH valuesNick Mathewson2023-08-141-13/+25
| | | | | | | | These values are computed as part of the circuit extension handshake, and are used as MAC keys to bind `ESTABLISH_INTRO` messages to a particular circuit so that they can't be replayed. Part of #993.
* tor-proto: Make HopNum public.Gabriela Moldovan2023-08-041-1/+1
| | | | | | `HopNum` will be used in `ClientCirc`'s public API when we refactor `ClientCirc::start_conversation_last_hop` to use the provided hop rather than always using the last one.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* proto: Make sure that auth tags are truncated to 20 bytesNick Mathewson2023-06-131-3/+13
| | | | | | | | Onion service hops (pointlessly) use SHA3-256 for their authentication, but they truncate it to 20 bytes (assuming I'm reading the C right.) See torspec#204 for clarification here.
* tor-proto: Remove use of arrayref.Nick Mathewson2023-06-011-2/+5
|
* proto: Try to improve the documentation in crypto/cell.rsNick Mathewson2023-05-181-24/+86
|
* tor-proto: Code to construct crypto layers for virtual hops.Nick Mathewson2023-05-181-0/+7
| | | | | This is fairly straightforward, thanks to our existing design work on this code.
* tor-cell: Refactor relay cells to copy much lessNick Mathewson2023-02-151-18/+8
| | | | | | | | | | | | | 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.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Merge branch 'zeroize' into 'main'Nick Mathewson2022-08-041-6/+4
|\ | | | | | | | | | | | | Revise our handling of the zeroize trait Closes #254 See merge request tpo/core/arti!655
| * tor-proto: Replace SecretBytes with SecretBuf.Nick Mathewson2022-08-011-6/+4
| | | | | | | | | | | | | | | | | | | | This does not yet make sure that `SecretBuf` is used where it _should_ be, but at least it ensures that most uses of `SecretBytes` will indeed act as intended, and make sure that whatever they contain is zeroized. It requires some corresponding changes to method calls for correctness and type conformance.
* | Rename `.inc` and other included files to end in `.rs`eta2022-07-261-1/+1
|/ | | | | | | | | | | | | In order to mitigate syntax highlighting issues and a rust-analyzer bug (https://github.com/rust-analyzer/rust-analyzer/issues/10178), rename files that are included with the `include!` macro to have a `.rs` extension. Make sure the included files are outside `src/`, in order to not confuse humans and automated editing tools that might mistake them for valid Rust modules. fixes arti#381
* 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-2/+2
| | | | | | | | 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-251-2/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* Update tor-proto errors to latest API.Nick Mathewson2022-02-151-1/+1
|
* tor-proto: use InternalError for internal errors.Nick Mathewson2022-02-151-1/+5
|
* Remove many needless borrows and slicesIan Jackson2022-02-021-4/+4
| | | | | | | Found via clippy::needless_borrow. In some cases I removed needless `[..]` too. See also: needless_borrow suggestion doesn't go far enough https://github.com/rust-lang/rust-clippy/issues/8389
* Merge remote-tracking branch 'origin/mr/180'Nick Mathewson2021-12-081-11/+10
|\
| * In CryptInit, return a Result in initialize()Neel Chauhan2021-12-081-11/+10
| |
* | Upgrade to digest v0.10.0Nick Mathewson2021-12-071-2/+2
|/ | | | | We generally try to track the latest rust-crypto traits when we can: fortunately, this upgrade didn't break much, considering.
* Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-2/+3
| | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* add semicolons if nothing returnedDaniel Eades2021-11-251-1/+1
|
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-4/+4
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+537
This will cause some pain for now, but now is really the best time to do this kind of thing.