diff options
author | David Goulet <dgoulet@torproject.org> | 2017-11-14 11:06:35 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-05 19:39:46 -0500 |
commit | 2c8e97db587df4c3145ab98dd9251290be7a3379 (patch) | |
tree | 0b3b6d2b20ff26091b4cafa3d927ad2daeade2da /src/or/hs_control.c | |
parent | cc26d4fa2131e056dc7728335d877e0322611b12 (diff) | |
download | tor-2c8e97db587df4c3145ab98dd9251290be7a3379.tar.gz tor-2c8e97db587df4c3145ab98dd9251290be7a3379.zip |
hs-v3: Implement HS_DESC_CONTENT event
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_control.c')
-rw-r--r-- | src/or/hs_control.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/or/hs_control.c b/src/or/hs_control.c index fce6466ef1..9a05d936b6 100644 --- a/src/or/hs_control.c +++ b/src/or/hs_control.c @@ -172,3 +172,30 @@ hs_control_desc_event_uploaded(const hs_ident_dir_conn_t *ident, control_event_hs_descriptor_uploaded(hsdir_id_digest, onion_address); } +/* Send on the control port the "HS_DESC_CONTENT [...]" event. + * + * Using the directory connection identifier, the HSDir identity digest and + * the body of the descriptor (as it was received from the directory). None + * can be NULL. */ +void +hs_control_desc_event_content(const hs_ident_dir_conn_t *ident, + const char *hsdir_id_digest, + const char *body) +{ + 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_hs_descriptor_content(onion_address, base64_blinded_pk, + hsdir_id_digest, body); +} + |