aboutsummaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_service.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2018-10-30 11:43:54 -0400
committerDavid Goulet <dgoulet@torproject.org>2018-10-30 11:43:54 -0400
commit488969fe9c4279477b1ff6da34ccf44ed19da8c7 (patch)
tree203017250ecd7ee6b154fec5658afe4763fbf633 /src/feature/hs/hs_service.h
parent95559279e15393347c606eaaa323e0b6490782c2 (diff)
parenta614731144be9478617411bb3268a4fccec506d9 (diff)
downloadtor-488969fe9c4279477b1ff6da34ccf44ed19da8c7.tar.gz
tor-488969fe9c4279477b1ff6da34ccf44ed19da8c7.zip
Merge branch 'tor-github/pr/438' into maint-0.3.5
Diffstat (limited to 'src/feature/hs/hs_service.h')
-rw-r--r--src/feature/hs/hs_service.h72
1 files changed, 44 insertions, 28 deletions
diff --git a/src/feature/hs/hs_service.h b/src/feature/hs/hs_service.h
index cc0006f1dc..a8a9faaea9 100644
--- a/src/feature/hs/hs_service.h
+++ b/src/feature/hs/hs_service.h
@@ -99,49 +99,65 @@ typedef struct hs_service_intropoints_t {
digestmap_t *failed_id;
} hs_service_intropoints_t;
-/* Representation of a service descriptor. */
+/* Representation of a service descriptor.
+ *
+ * Some elements of the descriptor are mutable whereas others are immutable:
+
+ * Immutable elements are initialized once when the descriptor is built (when
+ * service descriptors gets rotated). This means that these elements are
+ * initialized once and then they don't change for the lifetime of the
+ * descriptor. See build_service_descriptor().
+ *
+ * Mutable elements are initialized when we build the descriptor but they are
+ * also altered during the lifetime of the descriptor. They could be
+ * _refreshed_ everytime we upload the descriptor (which happens multiple times
+ * over the lifetime of the descriptor), or through periodic events. We do this
+ * for elements like the descriptor revision counter and various
+ * certificates. See refresh_service_descriptor() and
+ * update_service_descriptor_intro_points().
+ */
typedef struct hs_service_descriptor_t {
- /* Decoded descriptor. This object is used for encoding when the service
- * publishes the descriptor. */
- hs_descriptor_t *desc;
-
- /* Client authorization ephemeral keypair. */
+ /* Immutable: Client authorization ephemeral keypair. */
curve25519_keypair_t auth_ephemeral_kp;
- /* Descriptor cookie used to encrypt the descriptor, when the client
- * authorization is enabled */
+ /* Immutable: Descriptor cookie used to encrypt the descriptor, when the
+ * client authorization is enabled */
uint8_t descriptor_cookie[HS_DESC_DESCRIPTOR_COOKIE_LEN];
- /* Descriptor signing keypair. */
+ /* Immutable: Descriptor signing keypair. */
ed25519_keypair_t signing_kp;
- /* Blinded keypair derived from the master identity public key. */
+ /* Immutable: Blinded keypair derived from the master identity public key. */
ed25519_keypair_t blinded_kp;
- /* When is the next time when we should upload the descriptor. */
+ /* Immutable: The time period number this descriptor has been created for. */
+ uint64_t time_period_num;
+
+ /** Immutable: The OPE cipher for encrypting revision counters for this
+ * descriptor. Tied to the descriptor blinded key. */
+ struct crypto_ope_t *ope_cipher;
+
+ /* Mutable: Decoded descriptor. This object is used for encoding when the
+ * service publishes the descriptor. */
+ hs_descriptor_t *desc;
+
+ /* Mutable: When is the next time when we should upload the descriptor. */
time_t next_upload_time;
- /* Introduction points assign to this descriptor which contains
- * hs_service_intropoints_t object indexed by authentication key (the RSA
- * key if the node is legacy). */
+ /* Mutable: Introduction points assign to this descriptor which contains
+ * hs_service_intropoints_t object indexed by authentication key (the RSA key
+ * if the node is legacy). */
hs_service_intropoints_t intro_points;
- /* The time period number this descriptor has been created for. */
- uint64_t time_period_num;
-
- /* True iff we have missing intro points for this descriptor because we
- * couldn't pick any nodes. */
+ /* Mutable: True iff we have missing intro points for this descriptor because
+ * we couldn't pick any nodes. */
unsigned int missing_intro_points : 1;
- /** List of the responsible HSDirs (their b64ed identity digest) last time we
- * uploaded this descriptor. If the set of responsible HSDirs is different
- * from this list, this means we received new dirinfo and we need to
- * reupload our descriptor. */
+ /** Mutable: List of the responsible HSDirs (their b64ed identity digest)
+ * last time we uploaded this descriptor. If the set of responsible HSDirs
+ * is different from this list, this means we received new dirinfo and we
+ * need to reupload our descriptor. */
smartlist_t *previous_hsdirs;
-
- /** The OPE cipher for encrypting revision counters for this descriptor.
- * Tied to the descriptor blinded key. */
- struct crypto_ope_t *ope_cipher;
} hs_service_descriptor_t;
/* Service key material. */
@@ -390,7 +406,7 @@ STATIC int intro_point_should_expire(const hs_service_intro_point_t *ip,
STATIC void run_housekeeping_event(time_t now);
STATIC void rotate_all_descriptors(time_t now);
STATIC void build_all_descriptors(time_t now);
-STATIC void update_all_descriptors(time_t now);
+STATIC void update_all_descriptors_intro_points(time_t now);
STATIC void run_upload_descriptor_event(time_t now);
STATIC void service_descriptor_free_(hs_service_descriptor_t *desc);