diff options
author | David Goulet <dgoulet@torproject.org> | 2017-11-10 14:01:33 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-05 19:39:46 -0500 |
commit | 8365de1da3de53fc02d463d78187625d16a5180b (patch) | |
tree | 0d2698a5dcaed28de426024e40fcb7f07135c422 /src/or/hs_control.c | |
parent | 743d0b9d91c0c26045aa9a725865870f0c052794 (diff) | |
download | tor-8365de1da3de53fc02d463d78187625d16a5180b.tar.gz tor-8365de1da3de53fc02d463d78187625d16a5180b.zip |
hs-v3: Implement HS_DESC FAILED event
A new v3 specific function has been added named
control_event_hsv3_descriptor_failed().
The HS v3 subsystem now uses it.
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 0bcb41dccf..ed77c8e1d5 100644 --- a/src/or/hs_control.c +++ b/src/or/hs_control.c @@ -50,3 +50,30 @@ hs_control_desc_event_requested(const ed25519_public_key_t *onion_pk, memwipe(onion_address, 0, sizeof(onion_address)); } +/* Send on the control port the "HS_DESC FAILED [...]" event. + * + * Using a directory connection identifier, the HSDir identity digest and a + * reason for the failure. None can be NULL. */ +void +hs_control_desc_event_failed(const hs_ident_dir_conn_t *ident, + const char *hsdir_id_digest, + const char *reason) +{ + 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); + tor_assert(reason); + + /* 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_failed(onion_address, base64_blinded_pk, + hsdir_id_digest, reason); +} + |