diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-02-22 16:07:57 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-02-22 16:07:57 +0200 |
commit | f229a336859be89fbf093355b50692b209b5dd30 (patch) | |
tree | 0539525cb7efcf642e8674b6e5868afad2bc6052 /src/test | |
parent | 9ac8c854354eac7178eb8e99384f34c5a7abd5f4 (diff) | |
parent | 208f04e9b8241569fe314f6d5cb65521c9b55d8b (diff) | |
download | tor-f229a336859be89fbf093355b50692b209b5dd30.tar.gz tor-f229a336859be89fbf093355b50692b209b5dd30.zip |
Merge remote-tracking branch 'nickm/thread_rng'
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_crypto_rng.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test_crypto_rng.c b/src/test/test_crypto_rng.c index 23b0c66514..6b7749a889 100644 --- a/src/test/test_crypto_rng.c +++ b/src/test/test_crypto_rng.c @@ -218,6 +218,14 @@ test_crypto_rng_fast(void *arg) tt_int_op(counts[i], OP_GT, 0); } + /* per-thread rand_fast shouldn't crash or leak. */ + crypto_fast_rng_t *t_rng = get_thread_fast_rng(); + for (int i = 0; i < N; ++i) { + uint64_t u64 = crypto_fast_rng_get_uint64(t_rng, UINT64_C(1)<<40); + tt_u64_op(u64, OP_GE, 0); + tt_u64_op(u64, OP_LT, UINT64_C(1)<<40); + } + done: crypto_fast_rng_free(rng); } |