functions to gather random numbers More...
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-crypto-random", __VA_ARGS__) |
#define | LOG_STRERROR(kind, syscall) GNUNET_log_from_strerror (kind, "util-crypto-random", syscall) |
#define | RANDOM() glibc_weak_rand32 () |
#define | SRANDOM(s) glibc_weak_srand32 (s) |
#define | RAND_MAX 0x7fffffff /* Hopefully this is correct */ |
Functions | |
void | glibc_weak_srand32 (int32_t s) |
int32_t | glibc_weak_rand32 () |
static double | get_weak_random (void) |
Create a cryptographically weak pseudo-random number in the interval of 0 to 1. More... | |
void | GNUNET_CRYPTO_seed_weak_random (int32_t seed) |
Seed a weak random generator. More... | |
void | GNUNET_CRYPTO_zero_keys (void *buffer, size_t length) |
Zero out buffer, securely against compiler optimizations. More... | |
void | GNUNET_CRYPTO_random_block (enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length) |
Fill block with a random values. More... | |
uint32_t | GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i) |
Produce a random unsigned 32-bit number modulo i. More... | |
unsigned int * | GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n) |
Get an array with a random permutation of the numbers 0...n-1. More... | |
uint64_t | GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, uint64_t max) |
Generate a random unsigned 64-bit value. More... | |
void | GNUNET_CRYPTO_random_timeflake (enum GNUNET_CRYPTO_Quality mode, struct GNUNET_Uuid *uuid) |
Fill UUID with a timeflake pseudo-random value. More... | |
static void * | w_malloc (size_t n) |
Allocation wrapper for libgcrypt, used to avoid bad locking strategy of libgcrypt implementation. More... | |
static int | w_check (const void *p) |
Allocation wrapper for libgcrypt, used to avoid bad locking strategy of libgcrypt implementation. More... | |
void | GNUNET_CRYPTO_random_init (void) |
void | __attribute__ ((constructor)) |
Initialize libgcrypt. More... | |
void | GNUNET_CRYPTO_random_fini (void) |
void | __attribute__ ((destructor)) |
Nicely shut down libgcrypt. More... | |
Variables | |
static int32_t | glibc_weak_rand32_state = 1 |
functions to gather random numbers
Definition in file crypto_random.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-crypto-random", __VA_ARGS__) |
Definition at line 32 of file crypto_random.c.
#define LOG_STRERROR | ( | kind, | |
syscall | |||
) | GNUNET_log_from_strerror (kind, "util-crypto-random", syscall) |
Definition at line 34 of file crypto_random.c.
#define RANDOM | ( | ) | glibc_weak_rand32 () |
Definition at line 47 of file crypto_random.c.
#define SRANDOM | ( | s | ) | glibc_weak_srand32 (s) |
Definition at line 48 of file crypto_random.c.
#define RAND_MAX 0x7fffffff /* Hopefully this is correct */ |
Definition at line 52 of file crypto_random.c.
void glibc_weak_srand32 | ( | int32_t | s | ) |
Definition at line 59 of file crypto_random.c.
References glibc_weak_rand32_state.
int32_t glibc_weak_rand32 | ( | ) |
Definition at line 66 of file crypto_random.c.
References glibc_weak_rand32_state.
|
static |
Create a cryptographically weak pseudo-random number in the interval of 0 to 1.
Definition at line 84 of file crypto_random.c.
References RAND_MAX.
Referenced by GNUNET_CRYPTO_random_u32(), and GNUNET_CRYPTO_random_u64().
|
static |
Allocation wrapper for libgcrypt, used to avoid bad locking strategy of libgcrypt implementation.
Definition at line 342 of file crypto_random.c.
Referenced by __attribute__().
|
static |
Allocation wrapper for libgcrypt, used to avoid bad locking strategy of libgcrypt implementation.
Definition at line 353 of file crypto_random.c.
References p.
Referenced by __attribute__().
void GNUNET_CRYPTO_random_init | ( | void | ) |
void __attribute__ | ( | (constructor) | ) |
Initialize libgcrypt.
Definition at line 365 of file crypto_random.c.
References _, GNUNET_assert, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_CRYPTO_seed_weak_random(), w_check(), and w_malloc().
void GNUNET_CRYPTO_random_fini | ( | void | ) |
void __attribute__ | ( | (destructor) | ) |
Nicely shut down libgcrypt.
Definition at line 406 of file crypto_random.c.
|
static |
Definition at line 55 of file crypto_random.c.
Referenced by glibc_weak_rand32(), and glibc_weak_srand32().