AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
random.h File Reference
#include <core/system.h>

Go to the source code of this file.

Functions

void random_get (void *buf, size_t len)
 Fills a buffer with random bytes.
void random_add (uint32_t value)
 Stirs a value into the pool, which goes into the next key.

Function Documentation

◆ random_add()

void random_add ( uint32_t value)

Stirs a value into the pool, which goes into the next key.

The timer tick adds the cycle counter on each tick.

Parameters
valuethe value, which should be hard to predict

Definition at line 68 of file random.c.

References pool, pool_i, and random_add().

Referenced by random_add(), random_stir(), randomdev_write(), and sched_timer_tick().

◆ random_get()

void random_get ( void * _buf,
size_t len )

Fills a buffer with random bytes.

Parameters
_bufthe buffer
lenits size, in bytes

Definition at line 93 of file random.c.

References chacha20_block(), memcpy(), memset(), MIN, random_get(), random_stir(), and state.

Referenced by bind_port(), random_get(), randomdev_read(), sock_bind(), sys_getrandom(), and tcp_iss().