diff options
author | David Goulet <dgoulet@torproject.org> | 2017-03-07 14:57:14 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-08 20:29:33 -0400 |
commit | 5e710368b3e9a19862422d4bd43f2c1d8d0ceba8 (patch) | |
tree | c8ee8438e0f710cd75c92da07b8845bffd0e932f /src/or/hs_circuit.c | |
parent | faadbafba37932455ee60e02053e2e1300b63f33 (diff) | |
download | tor-5e710368b3e9a19862422d4bd43f2c1d8d0ceba8.tar.gz tor-5e710368b3e9a19862422d4bd43f2c1d8d0ceba8.zip |
prop224: Handle service INTRODUCE2 cell
At this commit, launching rendezvous circuit is not implemented, only a
placeholder.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_circuit.c')
-rw-r--r-- | src/or/hs_circuit.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c index 51c07c0ba7..a11699227c 100644 --- a/src/or/hs_circuit.c +++ b/src/or/hs_circuit.c @@ -312,6 +312,18 @@ send_establish_intro(const hs_service_t *service, /* Public API */ /* ========== */ +int +hs_circ_launch_rendezvous_point(const hs_service_t *service, + const curve25519_public_key_t *onion_key, + const uint8_t *rendezvous_cookie) +{ + tor_assert(service); + tor_assert(onion_key); + tor_assert(rendezvous_cookie); + /* XXX: Implement rendezvous launch support. */ + return 0; +} + /* For a given service and a service intro point, launch a circuit to the * extend info ei. If the service is a single onion, a one-hop circuit will be * requested. Return 0 if the circuit was successfully launched and tagged @@ -468,6 +480,60 @@ hs_circ_handle_intro_established(const hs_service_t *service, return ret; } +/* Handle an INTRODUCE2 unparsed payload of payload_len for the given circuit + * and service. This cell is associated with the intro point object ip and the + * subcredential. Return 0 on success else a negative value. */ +int +hs_circ_handle_introduce2(const hs_service_t *service, + const origin_circuit_t *circ, + hs_service_intro_point_t *ip, + const uint8_t *subcredential, + const uint8_t *payload, size_t payload_len) +{ + int ret = -1; + hs_cell_introduce2_data_t data; + + tor_assert(service); + tor_assert(circ); + tor_assert(ip); + tor_assert(subcredential); + tor_assert(payload); + + /* Populate the data structure with everything we need for the cell to be + * parsed, decrypted and key material computed correctly. */ + data.auth_pk = &ip->auth_key_kp.pubkey; + data.enc_kp = &ip->enc_key_kp; + data.subcredential = subcredential; + data.payload = payload; + data.payload_len = payload_len; + data.link_specifiers = smartlist_new(); + + if (hs_cell_parse_introduce2(&data, circ, service) < 0) { + goto done; + } + + /* At this point, we just confirmed that the full INTRODUCE2 cell is valid + * so increment our counter that we've seen one on this intro point. */ + ip->introduce2_count++; + + /* Launch rendezvous circuit with the onion key and rend cookie. */ + ret = hs_circ_launch_rendezvous_point(service, &data.onion_pk, + data.rendezvous_cookie); + if (ret < 0) { + goto done; + } + + /* Success. */ + ret = 0; + + done: + SMARTLIST_FOREACH(data.link_specifiers, link_specifier_t *, lspec, + link_specifier_free(lspec)); + smartlist_free(data.link_specifiers); + memwipe(&data, 0, sizeof(data)); + return ret; +} + /* Circuit <b>circ</b> just finished the rend ntor key exchange. Use the key * exchange output material at <b>ntor_key_seed</b> and setup <b>circ</b> to * serve as a rendezvous end-to-end circuit between the client and the |