[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Using RAND_pseudo_bytes instead of RAND_bytes is an acciden...
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv31848/src/or
Modified Files:
circuitlist.c connection.c rendclient.c rendservice.c
routerlist.c
Log Message:
Using RAND_pseudo_bytes instead of RAND_bytes is an accident waiting to happen, and does not really speed us up much when we do it. So stop doing it.
Index: circuitlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitlist.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- circuitlist.c 5 Oct 2005 22:31:21 -0000 1.59
+++ circuitlist.c 6 Oct 2005 22:18:01 -0000 1.60
@@ -219,7 +219,7 @@
circ->package_window = CIRCWINDOW_START;
circ->deliver_window = CIRCWINDOW_START;
- circ->next_stream_id = crypto_pseudo_rand_int(1<<16);
+ circ->next_stream_id = crypto_rand_int(1<<16);
circ->global_identifier = n_circuits_allocated++;
circuit_add(circ);
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.405
retrieving revision 1.406
diff -u -d -r1.405 -r1.406
--- connection.c 5 Oct 2005 22:32:59 -0000 1.405
+++ connection.c 6 Oct 2005 22:18:01 -0000 1.406
@@ -176,7 +176,7 @@
conn->socks_request = tor_malloc_zero(sizeof(socks_request_t));
}
- conn->next_circ_id = crypto_pseudo_rand_int(1<<15);
+ conn->next_circ_id = crypto_rand_int(1<<15);
conn->timestamp_created = now;
conn->timestamp_lastread = now;
Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendclient.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- rendclient.c 4 Oct 2005 22:23:31 -0000 1.93
+++ rendclient.c 6 Oct 2005 22:18:01 -0000 1.94
@@ -460,7 +460,7 @@
if (!entry->parsed->n_intro_points)
return NULL;
- i = crypto_pseudo_rand_int(entry->parsed->n_intro_points);
+ i = crypto_rand_int(entry->parsed->n_intro_points);
if (entry->parsed->intro_point_extend_info) {
return extend_info_dup(entry->parsed->intro_point_extend_info[i]);
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- rendservice.c 5 Oct 2005 02:06:36 -0000 1.141
+++ rendservice.c 6 Oct 2005 22:18:01 -0000 1.142
@@ -1020,7 +1020,7 @@
service = smartlist_get(rend_service_list, i);
if (!service->next_upload_time) { /* never been uploaded yet */
service->next_upload_time =
- now + crypto_pseudo_rand_int(2*rendpostperiod);
+ now + crypto_rand_int(2*rendpostperiod);
}
if (service->next_upload_time < now ||
(service->desc_is_dirty &&
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.332
retrieving revision 1.333
diff -u -d -r1.332 -r1.333
--- routerlist.c 5 Oct 2005 22:36:18 -0000 1.332
+++ routerlist.c 6 Oct 2005 22:18:01 -0000 1.333
@@ -757,7 +757,7 @@
return smartlist_choose(sl);
}
/* Second, choose a random value from the bandwidth weights. */
- rand_bw = crypto_pseudo_rand_int(total_bw);
+ rand_bw = crypto_rand_int(total_bw);
/* Last, count through sl until we get to the element we picked */
tmp = 0;
for (i=0; ; i++) {
@@ -1820,7 +1820,7 @@
/* If no networkstatus was found, choose a dirserver at random as "most
* recent". */
if (most_recent_idx<0)
- most_recent_idx = crypto_pseudo_rand_int(n_dirservers);
+ most_recent_idx = crypto_rand_int(n_dirservers);
/* Build a request string for all the resources we want. */
resource_len = needed * (HEX_DIGEST_LEN+1) + 6;