summaryrefslogtreecommitdiff
path: root/src/or/hs_common.h
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-02-13 15:31:34 +0200
committerDavid Goulet <dgoulet@torproject.org>2017-04-18 11:03:15 -0400
commite1a59ade9557cc2a7b0345397148dcfd2e16d35c (patch)
tree9bc5f37119a4e64a8d8400ea91d62dad2643c818 /src/or/hs_common.h
parentb081a7ed21ae729f6e195715e130edaca3e0b7fe (diff)
downloadtor-e1a59ade9557cc2a7b0345397148dcfd2e16d35c.tar.gz
tor-e1a59ade9557cc2a7b0345397148dcfd2e16d35c.zip
prop224: Add time period functions and unittests
This will be used by the build blinded key functions. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_common.h')
-rw-r--r--src/or/hs_common.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/or/hs_common.h b/src/or/hs_common.h
index d7d4228da2..a8fded652a 100644
--- a/src/or/hs_common.h
+++ b/src/or/hs_common.h
@@ -40,6 +40,15 @@
/* String prefix for the signature of ESTABLISH_INTRO */
#define ESTABLISH_INTRO_SIG_PREFIX "Tor establish-intro cell v1"
+/* The default HS time period length */
+#define HS_TIME_PERIOD_LENGTH_DEFAULT 1440 /* 1440 minutes == one day */
+/* The minimum time period length as seen in prop224 section [TIME-PERIODS] */
+#define HS_TIME_PERIOD_LENGTH_MIN 30 /* minutes */
+/* The minimum time period length as seen in prop224 section [TIME-PERIODS] */
+#define HS_TIME_PERIOD_LENGTH_MAX (60 * 24 * 10) /* 10 days or 14400 minutes */
+/* The time period rotation offset as seen in prop224 section [TIME-PERIODS] */
+#define HS_TIME_PERIOD_ROTATION_OFFSET (12 * 60) /* minutes */
+
int hs_check_service_private_dir(const char *username, const char *path,
unsigned int dir_group_readable,
unsigned int create);
@@ -60,5 +69,18 @@ const char *rend_data_get_desc_id(const rend_data_t *rend_data,
const uint8_t *rend_data_get_pk_digest(const rend_data_t *rend_data,
size_t *len_out);
+uint64_t hs_get_next_time_period_num(time_t now);
+
+#ifdef HS_COMMON_PRIVATE
+
+#ifdef TOR_UNIT_TESTS
+
+STATIC uint64_t get_time_period_length(void);
+STATIC uint64_t get_time_period_num(time_t now);
+
+#endif /* TOR_UNIT_TESTS */
+
+#endif /* HS_COMMON_PRIVATE */
+
#endif /* TOR_HS_COMMON_H */