|
@@ -16,7 +16,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
|
|
|
char pk_digest[DIGEST_LEN];
|
|
|
int asn1len;
|
|
|
circuit_t *c;
|
|
|
- char hexid[9];
|
|
|
+ char serviceid[REND_SERVICE_ID_LEN+1];
|
|
|
|
|
|
log_fn(LOG_INFO,
|
|
|
"Received an ESTABLISH_INTRO request on circuit %d", circ->p_circ_id);
|
|
@@ -64,14 +64,17 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
|
- hex_encode(pk_digest, 4, hexid);
|
|
|
+ if (base32_encode(serviceid, REND_SERVICE_ID_LEN+1,
|
|
|
+ pk_digest,10)) {
|
|
|
+ goto err;
|
|
|
+ }
|
|
|
|
|
|
/* Close any other intro circuits with the same pk. */
|
|
|
c = NULL;
|
|
|
while ((c = circuit_get_next_by_pk_and_purpose(
|
|
|
c,pk_digest,CIRCUIT_PURPOSE_INTRO_POINT))) {
|
|
|
log_fn(LOG_INFO, "Replacing old circuit %d for service %s",
|
|
|
- c->p_circ_id, hexid);
|
|
|
+ c->p_circ_id, serviceid);
|
|
|
circuit_mark_for_close(c);
|
|
|
}
|
|
|
|
|
@@ -89,7 +92,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
|
|
|
|
|
|
log_fn(LOG_INFO,
|
|
|
"Established introduction point on circuit %d for service %s",
|
|
|
- circ->p_circ_id, hexid);
|
|
|
+ circ->p_circ_id, serviceid);
|
|
|
|
|
|
return 0;
|
|
|
truncated:
|
|
@@ -108,7 +111,7 @@ int
|
|
|
rend_mid_introduce(circuit_t *circ, const char *request, int request_len)
|
|
|
{
|
|
|
circuit_t *intro_circ;
|
|
|
- char hexid[9];
|
|
|
+ char serviceid[REND_SERVICE_ID_LEN+1];
|
|
|
|
|
|
if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) {
|
|
|
log_fn(LOG_WARN, "Rejecting INTRODUCE1 on non-OR or non-edge circuit %d",
|
|
@@ -124,7 +127,10 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len)
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
|
- hex_encode(request,4,hexid);
|
|
|
+ if (base32_encode(serviceid, REND_SERVICE_ID_LEN+1, request,10)) {
|
|
|
+ goto err;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/* The first 20 bytes are all we look at: they have a hash of Bob's PK. */
|
|
|
intro_circ = circuit_get_next_by_pk_and_purpose(
|
|
@@ -132,13 +138,13 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len)
|
|
|
if (!intro_circ) {
|
|
|
log_fn(LOG_WARN,
|
|
|
"No intro circ found for INTRODUCE1 cell (%s) from circuit %d; dropping",
|
|
|
- hexid, circ->p_circ_id);
|
|
|
+ serviceid, circ->p_circ_id);
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
|
log_fn(LOG_INFO,
|
|
|
"Sending introduction request for service %s from circ %d to circ %d",
|
|
|
- hexid, circ->p_circ_id, intro_circ->p_circ_id);
|
|
|
+ serviceid, circ->p_circ_id, intro_circ->p_circ_id);
|
|
|
|
|
|
/* Great. Now we just relay the cell down the circuit. */
|
|
|
if (connection_edge_send_command(NULL, intro_circ,
|
|
@@ -188,7 +194,9 @@ rend_mid_establish_rendezvous(circuit_t *circ, const char *request, int request_
|
|
|
circ->purpose = CIRCUIT_PURPOSE_REND_POINT_WAITING;
|
|
|
memcpy(circ->rend_cookie, request, REND_COOKIE_LEN);
|
|
|
|
|
|
+
|
|
|
hex_encode(request,4,hexid);
|
|
|
+
|
|
|
log_fn(LOG_INFO, "Established rendezvous point on circuit %d for cookie %s",
|
|
|
circ->p_circ_id, hexid);
|
|
|
|