diff options
author | Dan Klein <danklei@cisco.com> | 2015-08-24 13:22:48 +0300 |
---|---|---|
committer | Dan Klein <danklei@cisco.com> | 2015-08-24 13:22:48 +0300 |
commit | dab741a80699f86e86c91718872a052cca9bbb25 (patch) | |
tree | 1959c4a2cea440170a5113dcb067796cb20ffb64 /external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c | |
parent | d3f26ece7d4383df0b22fe9c3cb3e695381ec737 (diff) |
Fixed dependencies of Control Plane to use external_lib sources
Diffstat (limited to 'external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c')
-rw-r--r-- | external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c new file mode 100644 index 00000000..07e23410 --- /dev/null +++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c @@ -0,0 +1,65 @@ + +#include <sys/types.h> + +#include <assert.h> +#include <limits.h> +#include <stdint.h> + +#include "randombytes.h" +#include "randombytes_sysrandom.h" + +static const randombytes_implementation *implementation = + &randombytes_sysrandom_implementation; + +int +randombytes_set_implementation(randombytes_implementation *impl) +{ + implementation = impl; + + return 0; +} + +const char * +randombytes_implementation_name(void) +{ + return implementation->implementation_name(); +} + +uint32_t +randombytes_random(void) +{ + return implementation->random(); +} + +void +randombytes_stir(void) +{ + implementation->stir(); +} + +uint32_t +randombytes_uniform(const uint32_t upper_bound) +{ + return implementation->uniform(upper_bound); +} + +void +randombytes_buf(void * const buf, const size_t size) +{ + if (size > (size_t) 0U) { + implementation->buf(buf, size); + } +} + +int +randombytes_close(void) +{ + return implementation->close(); +} + +void +randombytes(unsigned char * const buf, const unsigned long long buf_len) +{ + assert(buf_len <= SIZE_MAX); + randombytes_buf(buf, (size_t) buf_len); +} |