diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-04-23 11:13:51 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-04-23 11:13:51 -0400 |
commit | 9a81ed1d238e952429a53e7b38a4b6dd4bc5554a (patch) | |
tree | f0c98b9c761ea9e273e5303e5b25ab22d771f24c /src | |
parent | 85eadb733f7a58107e9f3b6fd81094cab4c29b6c (diff) | |
download | tor-9a81ed1d238e952429a53e7b38a4b6dd4bc5554a.tar.gz tor-9a81ed1d238e952429a53e7b38a4b6dd4bc5554a.zip |
Fix some RNG function issues
Diffstat (limited to 'src')
-rw-r--r-- | src/common/crypto.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index f338114d76..7857a54951 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -2330,9 +2330,7 @@ crypto_rand_int_range(unsigned int min, unsigned int max) tor_assert(max <= INT_MAX); /* The overflow is avoided here because crypto_rand_int() returns a value - * between 0 and (max - min - 1) with max being <= INT_MAX and min <= max. - * This is why we add 1 to the maximum value so we can actually get max as - * a return value. */ + * between 0 and (max - min) inclusive. */ return min + crypto_rand_int(max - min); } @@ -2352,7 +2350,7 @@ crypto_rand_time_range(time_t min, time_t max) } /** Return a pseudorandom 64-bit integer, chosen uniformly from the values - * between 0 and <b>max</b>-1. */ + * between 0 and <b>max</b>-1 inclusive. */ uint64_t crypto_rand_uint64(uint64_t max) { |