diff options
author | David Goulet <dgoulet@torproject.org> | 2016-05-03 10:57:49 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2016-07-01 13:23:27 -0400 |
commit | 5b183328fdd4bf81a3a38afe88d2766e61773fb9 (patch) | |
tree | ab21de7b641144ce46392f9cb38892d8dbf5c807 /src/or/shared_random_state.h | |
parent | b3b4ffce2e23bfb6a2af374cd8bfa5981628a342 (diff) | |
download | tor-5b183328fdd4bf81a3a38afe88d2766e61773fb9.tar.gz tor-5b183328fdd4bf81a3a38afe88d2766e61773fb9.zip |
prop250: Add commit and SR values generation code
This adds the logic of commit and SR values generation. Furthermore, the
concept of a protocol run is added that is commit is generated at the right
time as well as SR values which are also rotated before a new protocol run.
Signed-off-by: George Kadianakis <desnacked@riseup.net>
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/shared_random_state.h')
-rw-r--r-- | src/or/shared_random_state.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/shared_random_state.h b/src/or/shared_random_state.h index a9a80eed4c..d9d97510da 100644 --- a/src/or/shared_random_state.h +++ b/src/or/shared_random_state.h @@ -95,6 +95,8 @@ typedef struct sr_disk_state_t { /* Public methods: */ +void sr_state_update(time_t valid_after); + /* Private methods (only used by shared-random.c): */ void sr_state_set_valid_after(time_t valid_after); @@ -108,6 +110,8 @@ digestmap_t *sr_state_get_commits(void); sr_commit_t *sr_state_get_commit(const char *rsa_fpr); void sr_state_add_commit(sr_commit_t *commit); void sr_state_delete_commits(void); +void sr_state_copy_reveal_info(sr_commit_t *saved_commit, + const sr_commit_t *commit); unsigned int sr_state_srv_is_fresh(void); void sr_state_set_fresh_srv(void); void sr_state_unset_fresh_srv(void); @@ -118,8 +122,15 @@ void sr_state_free(void); #ifdef SHARED_RANDOM_STATE_PRIVATE STATIC int disk_state_load_from_disk_impl(const char *fname); + STATIC sr_phase_t get_sr_protocol_phase(time_t valid_after); + STATIC time_t get_state_valid_until_time(time_t now); +STATIC const char *get_phase_str(sr_phase_t phase); +STATIC void reset_state_for_new_protocol_run(time_t valid_after); +STATIC void new_protocol_run(time_t valid_after); +STATIC void state_rotate_srv(void); +STATIC int is_phase_transition(sr_phase_t next_phase); #endif /* SHARED_RANDOM_STATE_PRIVATE */ |