summaryrefslogtreecommitdiff
path: root/crates/tor-hscrypto/src/time.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* tor-hsservice: Make PowManager persist state.Wesley Aptekar-Cassels2025-05-271-1/+3
|
* tor-hsservice: Initial parts of PowManager.Wesley Aptekar-Cassels2025-05-271-1/+1
| | | | | | | This adds PowManager, as described in doc/dev/notes/service-side-pow.md, hooks it into IptManager and Publisher, and adds code to publish and rotate seeds, and to keep a updated list of Verifier instances for currently active seeds.
* tor-hscrypto: Implement Display for TimePeriodhjrgrn2025-03-131-1/+24
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* tor-hscrypto: Remove TimePeriodOffset, offset_within_period().Gabriela Moldovan2024-01-241-26/+0
| | | | | | These are now unused. Part of #1166
* tor-hscrypto: Return 0 if the timestamp is before the start of the TP.Gabriela Moldovan2023-12-131-1/+3
| | | | | | | | | | | | #1155 was happening because we couldn't compute the offset of the current time from the start of the _next_ TP (`TimePeriod::offset_within_period` expected `when` to come after the start of the TP). `TimePeriod::offset_within_period` now returns an offset of 0 for timestamps that come before the start of the TP, to support computing revision counters for the descriptors uploaded to the HsDirs from the ring associated with the next TP. Fixes #1155
* tor-hscrypto: Make offset_within_period() work with timestamps from later ↵Gabriela Moldovan2023-11-161-2/+2
| | | | | | | | | | | periods. Hidden services can have multiple "active" time periods for which they generate descriptors. We need to be able to compute the offset of a timestamp from the start of a given time period, even if that timestamp falls within the "next" time period (for example, when publishing descriptors for the "previous" time period, the `when` timestamp will fall outside the `(start, end)` range of the "previous" time period).
* Implementation for AES-based Order-preserving encryptionNick Mathewson2023-11-161-0/+24
| | | | | | This is the approach from appendix F.2 in rend-spec. Part of #1053.
* tor-hscrypto: Add a new constructor and an accessor for TimePeriod.Gabriela Moldovan2023-10-191-0/+42
|
* tor-hscrypto: Rename offset_in_sec to epoch_offset_in_sec.Gabriela Moldovan2023-10-191-5/+9
| | | | | | This renaming aims to make it clearer that this offset is _not_ the time between start of the epoch and the start of this time period, but rather the delta between our epoch and the Unix epoch, in seconds.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* 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.
* hs time handling: Make TimePeriod contain length as IntegerMinutesIan Jackson2023-02-091-9/+20
| | | | | | 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.
* 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-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* hscrypto: add a note about maybe replacing epoch_offset with voting_intervalNick Mathewson2023-01-251-0/+3
|
* 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
|
* hscrypto: Revise TimePeriod to account for variable offset.Nick Mathewson2023-01-241-21/+30
| | | | | | | | Previously, the offset was set to 12 hours unconditionally (like the spec says). But based on a conversation on tor-dev, it seems that the offset should actually be 12 times the voting interval. I'm also opening an MR to change the spec.
* hscrypto: Add our standard clippy warningsNick Mathewson2023-01-241-0/+10
| | | | | | (I have squashed the fixes for these warnings into the earlier commits in this branch, so it will look like I did everything right the first time.)
* hscrypto: Implement key blinding.Nick Mathewson2023-01-241-2/+2
| | | | | This implementation was made based on the specification, and then validated against itself, and against C Tor.
* hscrypto: Add an implementation for TimePeriodNick Mathewson2023-01-241-11/+118
| | | | | This required some API tweaks, which is probably to be expected; these time periods are a wonky kind of thing.
* hscrypto: Add several derivesNick Mathewson2023-01-111-0/+1
| | | | | The important addition here is the Copy derives, which affect API design. I'm applying them to the types that are 32 byte or smaller.
* Create a new tor-hscrypto crate.Nick Mathewson2023-01-061-0/+46
This module has types and operations needed in multiple places for an onion service implementation. There are a bunch of TODO hs-crypto comments that we'll need to fill in.