libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Random. Cryptographically secure random generators.

Functions

void onion_random_init ()
 Initializes the global random number generator.
void onion_random_free ()
 Free up memory used by global random number generator.
void onion_random_generate (void *data, size_t size)
 Generates random data.

Detailed Description

Function Documentation

void onion_random_free ( )

Free up memory used by global random number generator.

Frees the global random number generator

onion_random_free() must not be called more times than onion_random_init()

References onion_random_refcount_mutex_lock, and onion_random_refcount_mutex_unlock.

Referenced by onion_sessions_t::onion_sessions_free(), and onion_websocket_t::onion_websocket_free().

void onion_random_generate ( void *  data,
size_t  size 
)

Generates random data.

Generate size bytes of random data and put on data

Referenced by onion_sessions_t::onion_sessions_generate_id().

void onion_random_init ( )

Initializes the global random number generator.

Initializes the global random number generator

Initializes the global random number generator with some random seed.

onion_random_free() must be called later to free up used memory.

It is safe to call onion_random_init() more than once, but union_random_free() must be called the same amount of times.

References ONION_ERROR, onion_random_refcount_mutex_lock, onion_random_refcount_mutex_unlock, and ONION_WARNING.

Referenced by onion_sessions_mem_new(), onion_sessions_redis_new(), onion_sessions_sqlite3_new(), and onion_websocket_t::onion_websocket_new().