From f3fdbadfdfeea0fff981303355c3b07f4b1bc718 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 28 Dec 2003 04:46:09 +0000 Subject: [PATCH] randomize the initial circ_id and stream_id, so an adversary who breaks in part-way through can't learn how many circs/streams have been made svn:r960 --- src/or/circuit.c | 2 ++ src/or/connection.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/or/circuit.c b/src/or/circuit.c index f26bb95a5e..1b785958db 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -75,6 +75,8 @@ circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) { circ->package_window = CIRCWINDOW_START; circ->deliver_window = CIRCWINDOW_START; + circ->next_stream_id = crypto_pseudo_rand_int(1<<16); + circuit_add(circ); return circ; diff --git a/src/or/connection.c b/src/or/connection.c index 19be1e8a6f..5299e8965c 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -88,6 +88,8 @@ connection_t *connection_new(int type) { conn->socks_request = tor_malloc_zero(sizeof(socks_request_t)); } + conn->next_circ_id = crypto_pseudo_rand_int(1<<15); + conn->timestamp_created = now; conn->timestamp_lastread = now; conn->timestamp_lastwritten = now;