ELinks 0.18.0
random.c File Reference

Random numbers. More...

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "elinks.h"
#include "util/random.h"
Include dependency graph for random.c:

Functions

void seed_rand_once (void)
static void pseudorandom_nonce (unsigned char buf[], size_t size)
void random_nonce (unsigned char buf[], size_t size)
 Fill a buffer with random bytes.

Detailed Description

Random numbers.

Function Documentation

◆ pseudorandom_nonce()

void pseudorandom_nonce ( unsigned char buf[],
size_t size )
static

◆ random_nonce()

void random_nonce ( unsigned char buf[],
size_t size )

Fill a buffer with random bytes.

The bytes are not cryptographically random enough to be used in a key, but they should be good enough for a nonce or boundary string that may be sent in cleartext.

If CONFIG_SSL is defined, then this function is instead defined in src/network/ssl/ssl.c, and it gets random numbers directly from the selected SSL library.

◆ seed_rand_once()

void seed_rand_once ( void )