32#define LOG(kind, ...) GNUNET_log_from (kind, "util-crypto-random", __VA_ARGS__)
34#define LOG_STRERROR(kind, syscall) \
35 GNUNET_log_from_strerror (kind, "util-crypto-random", syscall)
40#if ! HAVE_RANDOM || ! HAVE_SRANDOM
47#define RANDOM() glibc_weak_rand32 ()
48#define SRANDOM(s) glibc_weak_srand32 (s)
52#define RAND_MAX 0x7fffffff
90 memset_s (buffer, length, 0, length);
91#elif HAVE_EXPLICIT_BZERO
92 explicit_bzero (buffer, length);
94 volatile unsigned char *
p = buffer;
105 randombytes_buf (buffer,
115 return randombytes_uniform (
max);
129 for (i = 0; i < n; i++)
131 for (i = n - 1; i > 0; i--)
146 return randombytes_uniform (
max);
static int32_t glibc_weak_rand32_state
void glibc_weak_srand32(int32_t s)
int32_t glibc_weak_rand32()
void GNUNET_CRYPTO_random_init(void)
static int ret
Final status code.
static struct GNUNET_Process * p
Helper process we started.
struct GNUNET_PQ_ResultSpec __attribute__
uint64_t GNUNET_CRYPTO_random_u64(uint64_t max)
Generate a random unsigned 64-bit value.
void GNUNET_CRYPTO_random_block(void *buffer, size_t length)
Fill block with a random values.
unsigned int * GNUNET_CRYPTO_random_permute(unsigned int n)
Get an array with a random permutation of the numbers 0...n-1.
void GNUNET_CRYPTO_random_timeflake(struct GNUNET_Uuid *uuid)
Fill UUID with a timeflake pseudo-random value.
void GNUNET_CRYPTO_zero_keys(void *buffer, size_t length)
Zero out buffer, securely against compiler optimizations.
uint32_t GNUNET_CRYPTO_random_u32(uint32_t max)
Produce a random value.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Time for absolute times used by GNUnet, in microseconds.
uint64_t abs_value_us
The actual value.
A UUID, a 128 bit "random" value.