summaryrefslogtreecommitdiff
path: root/src/or/onion.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-01 22:21:01 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-01 22:21:01 +0000
commit79fc52170edb4919a231234fc14c05640e1ec279 (patch)
tree894f1842937647832b8942e4e00798038a6627fd /src/or/onion.c
parent6b958494f3a5c538a62b1aa0b113d4741085dec1 (diff)
downloadtor-79fc52170edb4919a231234fc14c05640e1ec279.tar.gz
tor-79fc52170edb4919a231234fc14c05640e1ec279.zip
For hidden services: handle INTRODUCE2, send ESTABLISH_INTRO, RENDEZVOUS1.
Also: - Add a pending final cpath element to build_state - Rename S_RENDEZVOUSING to S_CONNECT_REND - Add [CS]_REND_JOINED - Split out logic to initialize cpath crypto objects. - Have circuits/cpaths remember the KH element from their handshake, so they can use it for other authentication later. (As in ESTABLISH_INTRO) svn:r1438
Diffstat (limited to 'src/or/onion.c')
-rw-r--r--src/or/onion.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index 1703d93ed2..2b68cc17c4 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -156,6 +156,8 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key
return -1;
}
+ memcpy(circ->handshake_digest, cell.payload+DH_KEY_LEN, CRYPTO_SHA1_DIGEST_LEN);
+
connection_or_write_cell_to_buf(&cell, circ->p_conn);
log_fn(LOG_DEBUG,"Finished sending 'created' cell.");
@@ -465,6 +467,19 @@ static void remove_twins_from_smartlist(smartlist_t *sl, routerinfo_t *twin) {
}
}
+void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop)
+{
+ if (*head_ptr) {
+ new_hop->next = (*head_ptr);
+ new_hop->prev = (*head_ptr)->prev;
+ (*head_ptr)->prev->next = new_hop;
+ (*head_ptr)->prev = new_hop;
+ } else {
+ *head_ptr = new_hop;
+ new_hop->prev = new_hop->next = new_hop;
+ }
+}
+
int onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t *state, routerinfo_t **router_out)
{
int cur_len;
@@ -554,15 +569,7 @@ int onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t *state, rout
hop = (crypt_path_t *)tor_malloc_zero(sizeof(crypt_path_t));
/* link hop into the cpath, at the end. */
- if (*head_ptr) {
- hop->next = (*head_ptr);
- hop->prev = (*head_ptr)->prev;
- (*head_ptr)->prev->next = hop;
- (*head_ptr)->prev = hop;
- } else {
- *head_ptr = hop;
- hop->prev = hop->next = hop;
- }
+ onion_append_to_cpath(head_ptr, hop);
hop->state = CPATH_STATE_CLOSED;