![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Functions | |
| int | n_random_bytes (unsigned char *buf, size_t n) |
| fill buf with n cryptographically secure random bytes (getrandom(2) when available, otherwise /dev/urandom). | |
| N_STR * | n_random_hex_token (size_t nbytes) |
| generate nbytes secure random bytes and return them as a lowercase hex N_STR (2*nbytes characters); free with free_nstr. | |
| int n_random_bytes | ( | unsigned char * | buf, |
| size_t | n | ||
| ) |
fill buf with n cryptographically secure random bytes (getrandom(2) when available, otherwise /dev/urandom).
A NULL buffer is rejected unless n is 0. Returns 0 on success, -1 on error.
Definition at line 62 of file n_random.c.
References LOG_ERR, n_log, and n_random_from_urandom().
Referenced by n_random_hex_token(), and test_bytes().
Here is the call graph for this function:
Here is the caller graph for this function:| N_STR * n_random_hex_token | ( | size_t | nbytes | ) |
generate nbytes secure random bytes and return them as a lowercase hex N_STR (2*nbytes characters); free with free_nstr.
Returns NULL on error.
Definition at line 91 of file n_random.c.
References __n_assert, Free, Malloc, n_hex_encode(), and n_random_bytes().
Referenced by test_token().
Here is the call graph for this function:
Here is the caller graph for this function: