summaryrefslogtreecommitdiff
path: root/crates/tor-hscrypto
Commit message (Collapse)AuthorAgeFilesLines
* Bump crate versions in preparation for v1.1.5 release.Nick Mathewson2023-06-011-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generated with the following commands: ``` cargo set-version --bump minor -p tor-cell cargo set-version --bump minor -p tor-linkspec cargo set-version --bump minor -p tor-proto cargo set-version --bump minor -p tor-netdoc cargo set-version --bump minor -p tor-circmgr cargo set-version --bump patch -p tor-cert cargo set-version --bump patch -p tor-basic-utils cargo set-version --bump patch -p tor-rpcbase cargo set-version --bump patch -p tor-llcrypto cargo set-version --bump patch -p tor-hscrypto cargo set-version --bump patch -p tor-checkable cargo set-version --bump patch -p tor-async-utils cargo set-version --bump patch -p caret cargo set-version --bump patch -p fs-mistrust cargo set-version --bump patch -p safelog cargo set-version --bump patch -p retry-error cargo set-version --bump patch -p tor-error cargo set-version --bump patch -p tor-config cargo set-version --bump patch -p tor-events cargo set-version --bump patch -p tor-units cargo set-version --bump patch -p tor-rtcompat cargo set-version --bump patch -p tor-rtmock cargo set-version --bump patch -p tor-protover cargo set-version --bump patch -p tor-bytes cargo set-version --bump patch -p tor-socksproto cargo set-version --bump patch -p tor-consdiff cargo set-version --bump patch -p tor-netdir cargo set-version --bump patch -p tor-congestion cargo set-version --bump patch -p tor-persist cargo set-version --bump patch -p tor-chanmgr cargo set-version --bump patch -p tor-ptmgr cargo set-version --bump patch -p tor-guardmgr cargo set-version --bump patch -p tor-dirclient cargo set-version --bump patch -p tor-dirmgr cargo set-version --bump patch -p tor-hsclient cargo set-version --bump patch -p tor-hsservice cargo set-version --bump patch -p arti-client cargo set-version --bump patch -p arti-rpcserver cargo set-version --bump patch -p arti-config cargo set-version --bump patch -p arti-hyper cargo set-version --bump patch -p arti cargo set-version --bump patch -p arti-bench cargo set-version --bump patch -p arti-testing ```
* hscrypto: Remove an incorrect comment.Nick Mathewson2023-05-181-5/+0
| | | | | (It said that we want to deprecate all unescorted secret keys; in fact, only unescorted EdDSA secrets are bad.)
* hscrypto: Replace ed25519 secret keys with keypairsNick Mathewson2023-05-181-42/+32
| | | | Part of #798: We no longer use unescorted ed25519 secret keys.
* Reformat Cargo.toml files.Nick Mathewson2023-05-151-5/+2
|
* Run fixup-features --no-annotate for initial Cargo.toml fixes.Nick Mathewson2023-05-151-0/+1
| | | | | | | | | This does the following: - Gives every crate a `full`. - Cause every `full` to depend on `full` from the lower-level crates. - Makes every feature listed _directly_ in `experimental` depend on `__is_experimental`.
* hscrypto: Add comment about impl that will be removed after we address #798.Gabriela Moldovan2023-05-031-0/+2
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* hscrypto: Add From impl for deriving KP_hsc_desc_enc out of KS_hsc_desc_enc.Gabriela Moldovan2023-05-031-0/+6
| | | | | | | | | | The `HsClientSecretKeys` stored in the HS client connection context only have the secret keys. Certain APIs (such as `HsDesc::parse`) expect a keypair (both `HsClientDescEncKey` and `HsClientDescEncSecretKey`). This `From` impl makes it possible to get a `HsClientDescEncKey` out of `HsClientDescEncSecretKey`. Signed-off-by: Gabriela Moldovan <[email protected]>
* Increment crate versions.Nick Mathewson2023-05-031-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of the errorkind bumps, we're calling this a breaking change in everything lower-level than `arti`. Generated with: ``` cargo set-version -p tor-basic-utils --bump minor cargo set-version -p tor-async-utils --bump minor cargo set-version -p caret --bump minor cargo set-version -p fs-mistrust --bump minor cargo set-version -p safelog --bump minor cargo set-version -p retry-error --bump minor cargo set-version -p tor-error --bump minor cargo set-version -p tor-config --bump minor cargo set-version -p tor-events --bump minor cargo set-version -p tor-units --bump minor cargo set-version -p tor-rtcompat --bump minor cargo set-version -p tor-rtmock --bump minor cargo set-version -p tor-rpcbase --bump minor cargo set-version -p tor-llcrypto --bump minor cargo set-version -p tor-protover --bump minor cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-hscrypto --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-checkable --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-linkspec --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump minor cargo set-version -p tor-consdiff --bump minor cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-congestion --bump minor cargo set-version -p tor-persist --bump minor cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-ptmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump minor cargo set-version -p tor-dirclient --bump minor cargo set-version -p tor-dirmgr --bump minor cargo set-version -p tor-hsclient --bump minor cargo set-version -p tor-hsservice --bump minor cargo set-version -p arti-client --bump minor cargo set-version -p arti-rpcserver --bump minor cargo set-version -p arti-config --bump minor cargo set-version -p arti-hyper --bump minor cargo set-version -p arti --bump patch cargo set-version -p arti-bench --bump patch cargo set-version -p arti-testing --bump patch ```
* Upgrade our hex-literal dependencyNick Mathewson2023-04-131-1/+1
|
* Increment MSRV to 1.65 in every crate.Nick Mathewson2023-04-111-1/+1
|
* Debug as hex strings for HsBlindId and HsDirIndexIan Jackson2023-03-311-2/+3
|
* Stop requiring the caller to supply `AuthClient`s.Gabriela Moldovan2023-03-311-0/+15
| | | | | | | | | | | | | | | | | | `AuthClient`s were originally meant to represent parsed `auth-client` lines. In !1070, this struct was repurposed for representing individual authorized clients in the HS descriptor encoder. However, hidden services will likely use a list of public keys to represent the authorized clients rather than a list of `AuthClient`s, as the information from an `AuthClient` (`client_id`, `iv`, `encrypted_cookie`) likely won't be immediately available to the hidden service. This change updates the HS descriptor encoder to represent authorized clients as a list of `curve25519::PublicKey`s. As such, it is now the responsibility of the encoder to create the `client_id`, `iv`, and `encrypted_cookie` using the available keys, the unencrypted descriptor cookie, and HS subcredential. Signed-off-by: Gabriela Moldovan <[email protected]>
* Bump crate versions that have breaking changesNick Mathewson2023-03-311-2/+2
| | | | | | | | | | These crates have had breaking changes. They are pre-1.0, so they get a minor bump. ``` tor-basic-utils tor-config ```
* Bump patchlevel on crates with non-breaking changesNick Mathewson2023-03-311-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For these crates, the changes are nontrivial, so we _do_ bump the versions on which their dependent crates depend. Fortunately, since they are all pre-1.0, we don't need to distinguish semver-additions from other changes. (Except for arti, which _is_ post-1.0, but gets a patchlevel bump anyway.) These are unstable crates with breaking changes: ``` tor-hscrypto tor-hsclient ``` These have new or extended APIs: ``` safelog tor-bytes tor-cell tor-linkspec tor-llcrypto tor-proto tor-cert arti-client ``` These have new unstable APIs or features: ``` tor-netdoc tor-circmgr (also broke some unstable APIs) arti (is post-1.0) ``` These have bugfixes only: ``` caret tor-dirmgr ```
* tor-hscrypto: key blinding: Use consistent terminologyIan Jackson2023-03-281-10/+12
| | | | | | | | * Don't ever use the words "parameter" or "param". These doesn't appear in the spec anywhere. * Use `h` as the variable name for the unclamped blinding factor, and `blinding_factor` in function names.
* Use the type system to enforce use of blinded keys.Gabriela Moldovan2023-03-271-0/+24
| | | | | | | | | | | | | | | 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/+10
| | | | | | | | | | | | | | 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]>
* Improve error from HsId parse of "www.B32.onion"Ian Jackson2023-03-091-2/+11
| | | | And add some clarity and todos about address errors.
* Test HsId parse of subdomainIan Jackson2023-03-091-0/+1
| | | | This error is not great.
* Use strip_suffix_ignore_ascii_case to quickly reject non-.onion HsId (fmt)Ian Jackson2023-03-081-1/+3
|
* Use strip_suffix_ignore_ascii_case to quickly reject non-.onion HsIdIan Jackson2023-03-082-3/+4
|
* Impl Redactable for HsIdIan Jackson2023-03-072-1/+26
|
* Debug HsId as the .onion; retain the hex printing as {:x}Ian Jackson2023-03-071-3/+10
|
* impl Display for HsIdIan Jackson2023-03-072-1/+147
|
* Merge branch 'hsconn' into 'main'Ian Jackson2023-03-011-12/+17
|\ | | | | | | | | Implement HS state management See merge request tpo/core/arti!1034
| * tor-llcrypto: Add a TODO re impl Redactable for HsIdIan Jackson2023-03-011-0/+1
| |
| * tor-hscrypto: Provide manual Debug impl for HsIdIan Jackson2023-03-011-1/+16
| | | | | | | | | | This is still not great, but it at least makes the output plausible to read by eye.
| * HS secret keys: Move aggregate/config to tor-hsclientIan Jackson2023-03-011-11/+0
| | | | | | | | | | | | | | | | Provide a more cookied "secret keys for use to connecting to a particular HS" type, with a builder. This wants to use config stuff, so oughtn't to be in tor-*crypto. The individual types remain there.
* | Introduce a constant for the length of the output of hs_mac()Nick Mathewson2023-03-011-2/+5
|/
* hscrypto: Make several types Readable+WriteableNick Mathewson2023-02-282-0/+12
| | | | Specifically, RendCookie, Subcredential, HsId, and HsBlindId.
* Patchlevel bumps for remaining changed crates.Nick Mathewson2023-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates have had small code changes, but no API additions: tor-config tor-socksproto tor-cert tor-chanmgr tor-ptmgr tor-guardmgr tor-circmgr tor-dirclient tor-dirmgr arti tor-hsservice tor-congestion These crates have had API extensions: fs-mistrust tor-llcrypto tor-bytes tor-checkable tor-linkspec tor-netdoc tor-persist arti-client
* Bump tor-units version for breaking change.Nick Mathewson2023-02-281-1/+1
| | | | | | | | (The breaking change was removing `as_days()` from IntegerMinutes.) We are _not_ calling this a downstream-api breaking change, per discussion at https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012?commit_id=bb2ab7c2a3e0994bb438188511688b5b039cae29#note_2876819
* Bump patch-versions for breaking changes in tor-hs{crypto,client}Nick Mathewson2023-02-281-1/+1
| | | | | | These are API breaks, but the crates themselves are currently 100% experimental, so there's no need to bump the minor versions according to our semver rules.
* hscrypto: Use minutes, not seconds, in blinding parameter.Nick Mathewson2023-02-101-8/+4
| | | | | | | | | | | | Fixes an instance of #768. The problem with the test vectors is that I used a random time period number (1234) and the default-in-tor period length (1440) without checking whether 1440 _meant_ minutes or seconds. I'll add another test to Tor to make sure that the time period matches now. With this change, I can test Tor-generated hsdescs with encryption, so I'm fairly confident that the new behavior is correct.
* hs time handling: Make TimePeriod contain length as IntegerMinutesIan Jackson2023-02-093-10/+25
| | | | | | Locally, the only functional effect is that now we refuse to handle non-whole-number-of-minutes lengths - but since the consensus parameter can't represent those, there's no overall functional change.
* hscrypto,netdoc: Add and use a type for KP_hss_desc_enc.Nick Mathewson2023-02-081-0/+8
|
* tor-hscrypto: Rename key types to correspond to new spec names.Nick Mathewson2023-02-081-62/+56
|
* Rename key identifiers that have changed in the specNick Mathewson2023-02-081-1/+1
| | | | | | | | | Generated with perl: s/K([PS])_hs_intro_tid/K$1_hs_ipt_sid/g; s/K([PS])_onion_ntor/K$1_ntor/g; s/K([PS])_hs_intro_ntor/K$1_hss_ntor/g; s/K([PS])_hs_desc_ephem/K$1_hss_desc_enc/g;
* hscrypto: Impl From<Ed25519Identity> for BlindedOnionId.Nick Mathewson2023-02-071-0/+6
|
* hscrypto: add From/Into between RevisionCounter and u64.Nick Mathewson2023-02-071-1/+3
|
* Bump the patch version of every crate that had API additionsNick Mathewson2023-02-011-1/+1
| | | | | | These crates had API or behavior changes that may affect downstream crates. Fortunately, they're all version 0.x, and don't need minor bumps for this.
* netdir: Implement ring-param constructors and time period accessorsNick Mathewson2023-01-281-0/+16
| | | | | | | | | | | | | | This logic is a bit tricky, so I've tried to document it and add fairly good tests. The silver lining is that the external API for all of this logic will make it invisible and hidden. There are some cases where I added functions that I think might eventually get lowered into MdConsensus: But I don't want to lower too much right now, since the convention for our netdoc accessors is that they are fairly unsophisticated, and they show you the document as it is. Closes #686
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-273-0/+3
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | 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.
* hscrypto: Remove Credential.Nick Mathewson2023-01-251-19/+2
| | | | | | It turns out that the credential is only calculated as an intermediate result in order to blind keys and produce the subcredential. As such, it has no need to leave the hscrypto module.
* hscrypto: add a note about maybe replacing epoch_offset with voting_intervalNick Mathewson2023-01-251-0/+3
|
* hscrypto: Explain why vanity onions require expanded secret keys.Nick Mathewson2023-01-251-1/+11
|
* hscrypto: document why we have keys in un-expanded formNick Mathewson2023-01-251-3/+12
|
* hscrypto: Note that maybe Duration is the wrong type to use.Nick Mathewson2023-01-251-0/+5
|
* hscrypto: Note the need for a Result rather than an OptionNick Mathewson2023-01-251-0/+4
|