aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-hscrypto/src
Commit message (Collapse)AuthorAgeFilesLines
* tor-hscrypto: Implement PartialEq for HsClientDescEncKey.Gabriela Moldovan2023-09-181-0/+6
| | | | Needed to implement `PartialEq` for `AuthorizedClientConfig`.
* tor-crypto: Fix some derive formattingIan Jackson2023-09-181-1/+1
| | | | This was missing the conventional spaces. Noticed in passing.
* hscrypto: Define a keypair type for HsSvcNtor{,Secret}KeyNick Mathewson2023-09-172-0/+35
| | | | | (Also, extend our macro so that we can wrap other curve25519 keys in this way, if we want.)
* tor-hscrypto: Impl From<&HsBlindIdKeypair> for HsBlindIdKey.Gabriela Moldovan2023-08-251-0/+7
| | | | This will be used by the descriptor publisher when building descriptors.
* tor-hscrypto: Add a function for deriving the subcredential.Gabriela Moldovan2023-08-251-3/+15
| | | | | | This function will be used by the descriptor publisher (it needs to generate descriptors, and for that it needs the subcredential, which can be derived from the `HsBlindIdKey` and `TimePeriod`).
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-233-0/+3
|
* hscrypto: Expose hs_mac as a SimpleMac.Nick Mathewson2023-08-141-1/+16
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-104-0/+4
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* tor-hscrypto: Provide values for NUM_INTRO_POINTIan Jackson2023-06-281-0/+12
| | | | These are in the spec and tor-hsclient is about to want them.
* hscrypto: downgrade a comment to HSSNick Mathewson2023-06-221-1/+1
|
* Merge branch 'socks_errorkinds' into 'main'Nick Mathewson2023-06-221-0/+15
|\ | | | | | | | | | | | | Generate correct-ish socks5 errors for onion service errors. Closes #736 See merge request tpo/core/arti!1279
| * New ErrorKind for invalid onion addressesNick Mathewson2023-06-221-0/+15
| | | | | | | | Use this to emit HS_BAD_ADDRESS as appropriate.
* | lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|/
* hscrypto: fix TODOs in time-period code.Nick Mathewson2023-06-131-32/+53
| | | | | | * Return a more informative error type (instead of Option) * Check that time periods are an integer number of seconds * Decide not to change the semantics of an argument.
* hscrypto: remove compatibility note about time periods.Nick Mathewson2023-06-131-9/+0
| | | | | We updated and clarified the spec in arti!107, and noted the remaining infelicities in proposal 342.
* hscrypto: note that hs_mac is not a good choice for new protocolsNick Mathewson2023-06-131-1/+4
|
* hscrypto: comment out an unused key type.Nick Mathewson2023-06-131-5/+6
| | | | | | | | (I'm not removing it entirely since maybe we _should_ use it, and maybe we _will_ as we do services. I've added a TODO HS for removing it or using it, and removed the TODO HS at the head of pk.rs about making sure that all the key types in the module really belong there.)
* hscrypto: Remove a TODO about extending an internal macro.Nick Mathewson2023-06-131-2/+0
|
* hscrypto: Remove a TODO about implementing ErrorKind.Nick Mathewson2023-06-131-1/+0
| | | | | | I think it isn't actually a great idea for HsIdParseError to implement ErrorKind, since the actual ErrorKind would depend entirely on where the problematic ID came from.
* hscrypto: clarify and downgrade TODOs about blinding secretsNick Mathewson2023-06-131-2/+10
|
* tor-hscrypto: implement Rng.gen() for RendCookieIan Jackson2023-06-091-0/+6
|
* tor-hscrypto: Break out REND_COOKIE_LENIan Jackson2023-06-091-1/+4
| | | | We need to reuse this.
* 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.
* 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]>
* 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]>
* 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-081-3/+3
|
* Impl Redactable for HsIdIan Jackson2023-03-071-1/+25
|
* Debug HsId as the .onion; retain the hex printing as {:x}Ian Jackson2023-03-071-3/+10
|
* impl Display for HsIdIan Jackson2023-03-071-1/+144
|
* 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-281-0/+11
| | | | Specifically, RendCookie, Subcredential, HsId, and HsBlindId.
* 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-092-10/+24
| | | | | | 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
|