summaryrefslogtreecommitdiff
path: root/src/or/rendmid.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-06 03:44:36 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-06 03:44:36 +0000
commit257d509b91f12dc3f4f380a1238a05264ecb50a8 (patch)
treef68d88e98498d406442396daf5d2c447fbc9d840 /src/or/rendmid.c
parent1dca309769f94777d210ba3dddf4ba8781191456 (diff)
downloadtor-257d509b91f12dc3f4f380a1238a05264ecb50a8.tar.gz
tor-257d509b91f12dc3f4f380a1238a05264ecb50a8.zip
Document stuff, reduce magic numbers, add emacs magic
svn:r1502
Diffstat (limited to 'src/or/rendmid.c')
-rw-r--r--src/or/rendmid.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/or/rendmid.c b/src/or/rendmid.c
index 5d795cf4bc..3e341714c9 100644
--- a/src/or/rendmid.c
+++ b/src/or/rendmid.c
@@ -5,7 +5,7 @@
#include "or.h"
/* Respond to an ESTABLISH_INTRO cell by setting the circuit's purpose and
- * rendevous service.
+ * service pk digest..
*/
int
rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
@@ -85,7 +85,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
/* Now, set up this circuit. */
circ->purpose = CIRCUIT_PURPOSE_INTRO_POINT;
- memcpy(circ->rend_pk_digest, pk_digest, 20);
+ memcpy(circ->rend_pk_digest, pk_digest, DIGEST_LEN);
log_fn(LOG_INFO,
"Established introduction point on circuit %d for service %s",
@@ -116,7 +116,8 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len)
goto err;
}
- if (request_len < 246) {
+ if (request_len < (DIGEST_LEN+(MAX_NICKNAME_LEN+1)+REND_COOKIE_LEN+
+ DH_KEY_LEN+CIPHER_KEY_LEN+PKCS1_OAEP_PADDING_OVERHEAD)) {
log_fn(LOG_WARN,
"Impossibly short INTRODUCE1 cell on circuit %d; dropping.",
circ->p_circ_id);
@@ -237,7 +238,8 @@ rend_mid_rendezvous(circuit_t *circ, const char *request, int request_len)
/* Send the RENDEZVOUS2 cell to Alice. */
if (connection_edge_send_command(NULL, rend_circ,
RELAY_COMMAND_RENDEZVOUS2,
- request+20, request_len-20, NULL)) {
+ request+REND_COOKIE_LEN,
+ request_len-REND_COOKIE_LEN, NULL)) {
log_fn(LOG_WARN, "Unable to send RENDEZVOUS2 cell to OP on circuit %d",
rend_circ->p_circ_id);
goto err;
@@ -250,7 +252,7 @@ rend_mid_rendezvous(circuit_t *circ, const char *request, int request_len)
circ->purpose = CIRCUIT_PURPOSE_REND_ESTABLISHED;
rend_circ->purpose = CIRCUIT_PURPOSE_REND_ESTABLISHED;
- memset(circ->rend_cookie, 0, 20);
+ memset(circ->rend_cookie, 0, REND_COOKIE_LEN);
rend_circ->rend_splice = circ;
circ->rend_splice = rend_circ;