diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-10-06 22:18:01 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-10-06 22:18:01 +0000 |
commit | cc35e1720f7dde775e2c8246c2f9b542954e401f (patch) | |
tree | 68a8b834a6d2a466d883a733923168ea915d4205 /src/or | |
parent | 0e5b6a84eb1ab156437d24c2fc1cb61249b008d4 (diff) | |
download | tor-cc35e1720f7dde775e2c8246c2f9b542954e401f.tar tor-cc35e1720f7dde775e2c8246c2f9b542954e401f.tar.gz |
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.
svn:r5210
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuitlist.c | 2 | ||||
-rw-r--r-- | src/or/connection.c | 2 | ||||
-rw-r--r-- | src/or/rendclient.c | 2 | ||||
-rw-r--r-- | src/or/rendservice.c | 2 | ||||
-rw-r--r-- | src/or/routerlist.c | 4 |
5 files changed, 6 insertions, 6 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 7e5076296..6d93564eb 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -219,7 +219,7 @@ 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); + circ->next_stream_id = crypto_rand_int(1<<16); circ->global_identifier = n_circuits_allocated++; circuit_add(circ); diff --git a/src/or/connection.c b/src/or/connection.c index 32eebe7d5..ae57ffb5a 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -176,7 +176,7 @@ 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->next_circ_id = crypto_rand_int(1<<15); conn->timestamp_created = now; conn->timestamp_lastread = now; diff --git a/src/or/rendclient.c b/src/or/rendclient.c index b4e8f171a..ae312d273 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -460,7 +460,7 @@ rend_client_get_random_intro(const char *query) 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]); diff --git a/src/or/rendservice.c b/src/or/rendservice.c index ff94db3ee..2b456e335 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -1020,7 +1020,7 @@ rend_consider_services_upload(time_t now) 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 && diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 921a3db9d..8678324a4 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -757,7 +757,7 @@ routerlist_sl_choose_by_bandwidth(smartlist_t *sl) 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 @@ update_networkstatus_client_downloads(time_t now) /* 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; |