random-util: add crypto_random_bytes_allocate_iovec()
Just a simple helper that allocates some memory, initializes it randomly, and places this in a struct iovec.
This commit is contained in:
committed by
Luca Boccassi
parent
3b2e99ed8c
commit
4d6222b6a4
@@ -4,9 +4,11 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
void random_bytes(void *p, size_t n); /* Returns random bytes suitable for most uses, but may be insecure sometimes. */
|
||||
int crypto_random_bytes(void *p, size_t n); /* Returns secure random bytes after waiting for the RNG to initialize. */
|
||||
int crypto_random_bytes_allocate_iovec(size_t n, struct iovec *ret);
|
||||
|
||||
static inline uint64_t random_u64(void) {
|
||||
uint64_t u;
|
||||
|
||||
Reference in New Issue
Block a user