aboutsummaryrefslogtreecommitdiff
path: root/src/or/hs_control.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-11-10 14:48:52 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-05 19:39:46 -0500
commitc7050eaa16ca8c46c2cea81cc2f4d405ccf15968 (patch)
treececbf32ee7838266839fe4c80fa6cfe514c9de12 /src/or/hs_control.c
parentb71a9b60cc0c29899637acc0610cb87c56869c1e (diff)
downloadtor-c7050eaa16ca8c46c2cea81cc2f4d405ccf15968.tar.gz
tor-c7050eaa16ca8c46c2cea81cc2f4d405ccf15968.zip
hs-v3: Implement HS_DESC UPLOAD event
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_control.c')
-rw-r--r--src/or/hs_control.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/or/hs_control.c b/src/or/hs_control.c
index ea010605bb..09dbbeba4b 100644
--- a/src/or/hs_control.c
+++ b/src/or/hs_control.c
@@ -125,3 +125,32 @@ hs_control_desc_event_created(const char *onion_address,
control_event_hs_descriptor_created(onion_address, base64_blinded_pk, -1);
}
+/* Send on the control port the "HS_DESC UPLOAD [...]" event.
+ *
+ * Using the onion address of the descriptor's service, the HSDir identity
+ * digest, the blinded public key of the descriptor as a descriptor ID and the
+ * HSDir index for this particular request. None can be NULL. */
+void
+hs_control_desc_event_upload(const char *onion_address,
+ const char *hsdir_id_digest,
+ const ed25519_public_key_t *blinded_pk,
+ const uint8_t *hsdir_index)
+{
+ char base64_blinded_pk[ED25519_BASE64_LEN + 1];
+
+ tor_assert(onion_address);
+ tor_assert(hsdir_id_digest);
+ tor_assert(blinded_pk);
+ tor_assert(hsdir_index);
+
+ /* Build base64 encoded blinded key. */
+ IF_BUG_ONCE(ed25519_public_to_base64(base64_blinded_pk, blinded_pk) < 0) {
+ return;
+ }
+
+ control_event_hs_descriptor_upload(onion_address, hsdir_id_digest,
+ base64_blinded_pk,
+ hex_str((const char *) hsdir_index,
+ DIGEST256_LEN));
+}
+