summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/crypto
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'misc-upgrades' into 'main'Nick Mathewson2023-09-283-6/+4
|\ | | | | | | | | Upgrade several dependencies See merge request tpo/core/arti!1626
| * Remove direct dependency on generic-arrayNick Mathewson2023-09-283-6/+4
| | | | | | | | | | | | | | | | | | | | Instead of tying ourselves to a particular version of the generic-array crate, we now always use the version re-exported by our RustCrypto crates. This lets us avoid the possibility of version mismatch. (Originally I had planned to upgrade to generic-array 1.0, but then I found that we were not actually using it.)
* | tor-proto: Replace repeating pattern with fillEmil Engler2023-09-281-6/+2
|/ | | | | | | | | This commit replaces a repeating code pattern in the `set_digest` function for setting the 'Recognized' and Digest field to zero with a slice fillment. Besides this, it also adds comments explaining which fields are currently getting zeroized.
* Merge branch 'pad_intro2' into 'main'Nick Mathewson2023-09-251-7/+41
|\ | | | | | | | | | | | | Accept and transmit padding in introduce2 plaintexts Closes #1031 See merge request tpo/core/arti!1602
| * Generate padding in Introduce1 messages.Nick Mathewson2023-09-181-7/+41
| | | | | | | | | | | | Closes #1031. This padding ensures that the introduction point doesn't learn the length of the plaintext being sent to the onion service.
* | hs_ntor: replace "32" with a const.Nick Mathewson2023-09-211-1/+1
| |
* | hs_ntor: rename get_{introduce,rendezvous}1_key_material.Nick Mathewson2023-09-211-6/+6
| |
* | hs_ntor: improve several comments.Nick Mathewson2023-09-211-3/+10
| |
* | hs_ntor: rename enc_key to dec_key in service code.Nick Mathewson2023-09-211-5/+5
| |
* | hs_ntor: allow attempting handshake with a set of subcredentials.Nick Mathewson2023-09-201-27/+45
| | | | | | | | | | | | | | Since we are using the same introduction point circuits for multiple time periods, we need the ability to provide a set of subcredentials and see which of them acually works. Fortunately, we "only" have to do digest operations here, which are much faster than public key.
* | hs_ntor: Take our k_hss_ntor keypair explicitly.Nick Mathewson2023-09-201-18/+18
|/
* tor-proto: Add a missing cfgIan Jackson2023-09-131-0/+1
| | | | | Fixes cargo clippy -p tor-hsclient --all-features --all-targets
* tor-proto: Remove the Display impl of HopNum.Gabriela Moldovan2023-08-251-6/+0
| | | | | This removes the `Display` impl of `HopNum` and replaces its usage with `HopNum::display`.
* tor-proto: Add a HopNum::display function.Gabriela Moldovan2023-08-251-3/+39
| | | | | | | | | This function can be used to display a more user-friendly representation of a `HopNum`. This will print hop numbers as 1-indexed values: #1, #2, etc.. We will soon remove HopNum's Display implementation in favour of `.display()`.
* 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-235-0/+5
|
* proto: API to expose the `CircuitBinding` type.Nick Mathewson2023-08-141-2/+1
| | | | Closes #993
* proto: Add (not-yet-exposed) code to remember and use KH valuesNick Mathewson2023-08-142-13/+78
| | | | | | | | 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-105-0/+5
|
* Back down x25519-dalek to 2.0.0-pre.1 from 2.0.0-rc.2pinkforest2023-06-273-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ========================= 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]>
* proto: Put client and service hs_ntor behind individual featuresNick Mathewson2023-06-211-5/+17
| | | | | This lets us keep the service-side hs-ntor handshake experiemental for now.
* proto: Resolve some hs_ntor "TODO HS" comments.Nick Mathewson2023-06-211-10/+7
|
* Lower tor-proto::util::ct::lookup to tor-llcryptoNick Mathewson2023-06-162-3/+4
| | | | | | | | 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.
* 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.
* proto: Add a commment about a problem in my hs_ntor plans.Nick Mathewson2023-06-121-0/+4
| | | | | I am pretty sure that C tor works around this somehow; we should figure out how!
* proto: code movement and reindentation in hs_ntorNick Mathewson2023-06-121-86/+75
|
* proto: Remove now-unused hs_ntor APIsNick Mathewson2023-06-121-43/+21
|
* proto: refactor hs_ntor to reuse state.Nick Mathewson2023-06-121-14/+49
| | | | | | | | | | We want the ability to send the same handshake request in parallel on multiple introduce circuits. This implies encoding the client handshake more than once. (Sadly we can't _actually_ do this in the protocol as it stands, since the onion service can use a separate KP_hss_ntor for each introduction point; I'll add a comment to that effect later.)
* tor-proto: Remove use of arrayref.Nick Mathewson2023-06-011-2/+5
|
* Merge branch 'virtual_hop' into 'main'Nick Mathewson2023-05-181-24/+93
|\ | | | | | | | | | | | | tor-proto: Add support for extending circuits through virtual hops. Closes #726 See merge request tpo/core/arti!1191
| * 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.
* | hs_ntor: several documentation cleanups.Nick Mathewson2023-05-171-6/+14
| |
* | hs_ntor: make encrypt_and_mac take a typed public keyNick Mathewson2023-05-171-10/+6
| | | | | | | | This is still not the most beautiful interface, but it'll do for now.
* | hs_ntor: remove the last lingering AsRef<[u8]>Nick Mathewson2023-05-171-7/+7
| |
* | hs_ntor: Add a test vector case extracted from C tor.Nick Mathewson2023-05-171-0/+104
| |
* | hs_ntor: Calculate MAC on introduce1 message correctly.Nick Mathewson2023-05-171-3/+12
| | | | | | | | | | | | There were two bugs here that made the behavior unlike that of C tor: we had swapped the MAC inputs, and we had forgotten to include the public key X in the input.
* | hs_ntor: Make internal no-rng variants of the handshake functions.Nick Mathewson2023-05-171-2/+25
| | | | | | | | We'll want these so we can implement some test vectors.
* | hs_ntor: Move extra data outside of the "input" fields.Nick Mathewson2023-05-171-59/+33
| | | | | | | | | | | | | | I think that these Input structs had been defined so that we could use hs_ntor interchangeably with other handshakes. The trouble is, though, that it doesn't really work like any other handshakes we have.
* | hs_ntor: Use MAC implementation from tor-hscryptoNick Mathewson2023-05-171-35/+16
| | | | | | | | | | | | Note that some of the invocations for this function seem to put the key and the message in a questionable order. But that's a thing to figure out later, while debugging.
* | hs_ntor: Use correct PK types from tor_hscrypto.Nick Mathewson2023-05-171-20/+24
| |
* | hs_ntor: Use Subcredential type from tor-hscryptoNick Mathewson2023-05-171-4/+3
|/
* Use non-deprecated *Secret::random_from_rng.Nick Mathewson2023-05-133-13/+13
| | | | The `new` function is deprecated in x25519-dalek 2.0.0-rc.2
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-282-2/+2
| | | | Fixes #756
* 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-275-0/+5
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* tor-proto: Expose support for doing onion service handshakesNick Mathewson2023-01-172-17/+18
| | | | | | This is a little tricky, but I think that we're not actually exposing too much here. I expect we'll need to tweak this stuff between now and our final version.
* tor-proto: Rename "hs" experimental feature to "onion-common"Nick Mathewson2023-01-171-1/+1
| | | | (For consistency with other crates)
* test lint blocks: Add many many automaticallyIan Jackson2022-12-124-0/+33
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.