diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-10-01 12:06:39 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-10-01 12:06:39 -0500 |
commit | 58299b2927ffe4c7db7ddb6b3d44d1567c8a341f (patch) | |
tree | 8fb0de157e1118cb1b1d5693e9a4cb4e688dc207 /src/lib | |
parent | c4e29001c48f33ea8b0035da65da50ddf15ffa71 (diff) | |
parent | ea5792f333b1b92306d20e60b5e12bb0633aa740 (diff) | |
download | tor-58299b2927ffe4c7db7ddb6b3d44d1567c8a341f.tar.gz tor-58299b2927ffe4c7db7ddb6b3d44d1567c8a341f.zip |
Merge remote-tracking branch 'public/bug27728'
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/crypt_ops/crypto_rand.c | 12 | ||||
-rw-r--r-- | src/lib/crypt_ops/crypto_rand.h | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/crypt_ops/crypto_rand.c b/src/lib/crypt_ops/crypto_rand.c index 313d829a57..cffd0610f3 100644 --- a/src/lib/crypt_ops/crypto_rand.c +++ b/src/lib/crypt_ops/crypto_rand.c @@ -335,8 +335,18 @@ crypto_strongest_rand_raw(uint8_t *out, size_t out_len) * Try to get <b>out_len</b> bytes of the strongest entropy we can generate, * storing it into <b>out</b>. **/ +void +crypto_strongest_rand(uint8_t *out, size_t out_len) +{ + crypto_strongest_rand_(out, out_len); +} + +/** + * Try to get <b>out_len</b> bytes of the strongest entropy we can generate, + * storing it into <b>out</b>. (Mockable version.) + **/ MOCK_IMPL(void, -crypto_strongest_rand,(uint8_t *out, size_t out_len)) +crypto_strongest_rand_,(uint8_t *out, size_t out_len)) { #define DLEN DIGEST512_LEN diff --git a/src/lib/crypt_ops/crypto_rand.h b/src/lib/crypt_ops/crypto_rand.h index 25bcfa1f1c..0c538d81ac 100644 --- a/src/lib/crypt_ops/crypto_rand.h +++ b/src/lib/crypt_ops/crypto_rand.h @@ -21,7 +21,8 @@ int crypto_seed_rng(void) ATTR_WUR; MOCK_DECL(void,crypto_rand,(char *to, size_t n)); void crypto_rand_unmocked(char *to, size_t n); -MOCK_DECL(void,crypto_strongest_rand,(uint8_t *out, size_t out_len)); +void crypto_strongest_rand(uint8_t *out, size_t out_len); +MOCK_DECL(void,crypto_strongest_rand_,(uint8_t *out, size_t out_len)); int crypto_rand_int(unsigned int max); int crypto_rand_int_range(unsigned int min, unsigned int max); uint64_t crypto_rand_uint64_range(uint64_t min, uint64_t max); |