summaryrefslogtreecommitdiff
path: root/src/or/cpuworker.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-12-16 08:21:58 +0000
committerRoger Dingledine <arma@torproject.org>2003-12-16 08:21:58 +0000
commit961ecf7abfc80571ab858099d1d4f6362b791ea0 (patch)
treee4535e6a65296391d1819ac8fceaebeef25e3b4d /src/or/cpuworker.c
parentf3b165fdc0b945b5d30a81db7d818d2445487520 (diff)
downloadtor-961ecf7abfc80571ab858099d1d4f6362b791ea0.tar.gz
tor-961ecf7abfc80571ab858099d1d4f6362b791ea0.zip
add H(K|1) to the onionskin reply
verify it at the client end abstract the onionskin handshake lengths breaks backward compatibility (again) svn:r941
Diffstat (limited to 'src/or/cpuworker.c')
-rw-r--r--src/or/cpuworker.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index c964115f90..fee8eebb47 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -9,8 +9,8 @@ extern or_options_t options; /* command-line and config-file options */
#define MIN_CPUWORKERS 1
#define TAG_LEN 8
-#define LEN_ONION_QUESTION (1+TAG_LEN+DH_ONIONSKIN_LEN)
-#define LEN_ONION_RESPONSE (1+TAG_LEN+DH_KEY_LEN+32)
+#define LEN_ONION_QUESTION (1+TAG_LEN+ONIONSKIN_CHALLENGE_LEN)
+#define LEN_ONION_RESPONSE (1+TAG_LEN+ONIONSKIN_REPLY_LEN+32)
int num_cpuworkers=0;
int num_cpuworkers_busy=0;
@@ -95,7 +95,7 @@ int connection_cpu_process_inbuf(connection_t *conn) {
circuit_close(circ);
goto done_processing;
}
- if(onionskin_answer(circ, buf+1+TAG_LEN, buf+1+TAG_LEN+DH_KEY_LEN) < 0) {
+ if(onionskin_answer(circ, buf+1+TAG_LEN, buf+1+TAG_LEN+ONIONSKIN_REPLY_LEN) < 0) {
log_fn(LOG_WARN,"onionskin_answer failed. Closing.");
circuit_close(circ);
goto done_processing;
@@ -113,14 +113,14 @@ done_processing:
}
int cpuworker_main(void *data) {
- unsigned char question[DH_ONIONSKIN_LEN];
+ unsigned char question[ONIONSKIN_CHALLENGE_LEN];
unsigned char question_type;
int *fdarray = data;
int fd;
/* variables for onion processing */
unsigned char keys[32];
- unsigned char reply_to_proxy[DH_KEY_LEN];
+ unsigned char reply_to_proxy[ONIONSKIN_REPLY_LEN];
unsigned char buf[LEN_ONION_RESPONSE];
char tag[TAG_LEN];
@@ -140,7 +140,7 @@ int cpuworker_main(void *data) {
spawn_exit();
}
- if(read_all(fd, question, DH_ONIONSKIN_LEN) != DH_ONIONSKIN_LEN) {
+ if(read_all(fd, question, ONIONSKIN_CHALLENGE_LEN) != ONIONSKIN_CHALLENGE_LEN) {
log_fn(LOG_ERR,"read question failed. Exiting.");
spawn_exit();
}
@@ -156,8 +156,8 @@ int cpuworker_main(void *data) {
log_fn(LOG_INFO,"onion_skin_server_handshake succeeded.");
buf[0] = 1; /* 1 means success */
memcpy(buf+1,tag,TAG_LEN);
- memcpy(buf+1+TAG_LEN,reply_to_proxy,DH_KEY_LEN);
- memcpy(buf+1+TAG_LEN+DH_KEY_LEN,keys,32);
+ memcpy(buf+1+TAG_LEN,reply_to_proxy,ONIONSKIN_REPLY_LEN);
+ memcpy(buf+1+TAG_LEN+ONIONSKIN_REPLY_LEN,keys,32);
}
if(write_all(fd, buf, LEN_ONION_RESPONSE) != LEN_ONION_RESPONSE) {
log_fn(LOG_ERR,"writing response buf failed. Exiting.");
@@ -272,7 +272,7 @@ int assign_to_cpuworker(connection_t *cpuworker, unsigned char question_type,
connection_write_to_buf(&question_type, 1, cpuworker);
connection_write_to_buf(tag, sizeof(tag), cpuworker);
- connection_write_to_buf(circ->onionskin, DH_ONIONSKIN_LEN, cpuworker);
+ connection_write_to_buf(circ->onionskin, ONIONSKIN_CHALLENGE_LEN, cpuworker);
}
return 0;
}