mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Add a quick test for get_thread_fast_rng()
This commit is contained in:
parent
b25cd5cfe1
commit
208f04e9b8
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user