summaryrefslogtreecommitdiff
path: root/src/or/hs_control.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-11-10 14:12:34 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-05 19:39:46 -0500
commit3b436d495fc6ad59ff5d9406d7ef17494286c299 (patch)
treea0238ed65588572666ff9badd541e30f2d22cfd8 /src/or/hs_control.c
parent8365de1da3de53fc02d463d78187625d16a5180b (diff)
downloadtor-3b436d495fc6ad59ff5d9406d7ef17494286c299.tar.gz
tor-3b436d495fc6ad59ff5d9406d7ef17494286c299.zip
hs-v3: Implement HS_DESC RECEIVED event
Adds a v3 specific function to handle a received event. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_control.c')
-rw-r--r--src/or/hs_control.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/or/hs_control.c b/src/or/hs_control.c
index ed77c8e1d5..add62d5832 100644
--- a/src/or/hs_control.c
+++ b/src/or/hs_control.c
@@ -77,3 +77,28 @@ hs_control_desc_event_failed(const hs_ident_dir_conn_t *ident,
hsdir_id_digest, reason);
}
+/* Send on the control port the "HS_DESC RECEIVED [...]" event.
+ *
+ * Using a directory connection identifier and the HSDir identity digest.
+ * None can be NULL. */
+void
+hs_control_desc_event_received(const hs_ident_dir_conn_t *ident,
+ const char *hsdir_id_digest)
+{
+ char onion_address[HS_SERVICE_ADDR_LEN_BASE32 + 1];
+ char base64_blinded_pk[ED25519_BASE64_LEN + 1];
+
+ tor_assert(ident);
+ tor_assert(hsdir_id_digest);
+
+ /* Build onion address and encoded blinded key. */
+ IF_BUG_ONCE(ed25519_public_to_base64(base64_blinded_pk,
+ &ident->blinded_pk) < 0) {
+ return;
+ }
+ hs_build_address(&ident->identity_pk, HS_VERSION_THREE, onion_address);
+
+ control_event_hsv3_descriptor_received(onion_address, base64_blinded_pk,
+ hsdir_id_digest);
+}
+