RetroArch
Macros | Functions
entropy.c File Reference
#include "mbedtls/config.h"
#include "mbedtls/entropy.h"
#include "mbedtls/entropy_poll.h"
#include <string.h>
#include <stdio.h>
#include "mbedtls/platform.h"
#include "arc4_alt.h"
Include dependency graph for entropy.c:

Macros

#define ENTROPY_MAX_LOOP   256
 

Functions

void mbedtls_entropy_init (mbedtls_entropy_context *ctx)
 Initialize the context. More...
 
void mbedtls_entropy_free (mbedtls_entropy_context *ctx)
 Free the data in the context. More...
 
int mbedtls_entropy_add_source (mbedtls_entropy_context *ctx, mbedtls_entropy_f_source_ptr f_source, void *p_source, size_t threshold, int strong)
 Adds an entropy source to poll (Thread-safe if MBEDTLS_THREADING_C is enabled) More...
 
static int entropy_update (mbedtls_entropy_context *ctx, unsigned char source_id, const unsigned char *data, size_t len)
 
int mbedtls_entropy_update_manual (mbedtls_entropy_context *ctx, const unsigned char *data, size_t len)
 Add data to the accumulator manually (Thread-safe if MBEDTLS_THREADING_C is enabled) More...
 
static int entropy_gather_internal (mbedtls_entropy_context *ctx)
 
int mbedtls_entropy_gather (mbedtls_entropy_context *ctx)
 Trigger an extra gather poll for the accumulator (Thread-safe if MBEDTLS_THREADING_C is enabled) More...
 
int mbedtls_entropy_func (void *data, unsigned char *output, size_t len)
 Retrieve entropy from the accumulator (Maximum length: MBEDTLS_ENTROPY_BLOCK_SIZE) (Thread-safe if MBEDTLS_THREADING_C is enabled) More...
 
int mbedtls_entropy_write_seed_file (mbedtls_entropy_context *ctx, const char *path)
 Write a seed file. More...
 
int mbedtls_entropy_update_seed_file (mbedtls_entropy_context *ctx, const char *path)
 Read and update a seed file. Seed is added to this instance. No more than MBEDTLS_ENTROPY_MAX_SEED_SIZE bytes are read from the seed file. The rest is ignored. More...
 
static int entropy_dummy_source (void *data, unsigned char *output, size_t len, size_t *olen)
 
int mbedtls_entropy_self_test (int verbose)
 Checkup routine. More...
 

Macro Definition Documentation

◆ ENTROPY_MAX_LOOP

#define ENTROPY_MAX_LOOP   256

Maximum amount to loop before error

Function Documentation

◆ entropy_dummy_source()

static int entropy_dummy_source ( void data,
unsigned char *  output,
size_t  len,
size_t *  olen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entropy_gather_internal()

static int entropy_gather_internal ( mbedtls_entropy_context ctx)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entropy_update()

static int entropy_update ( mbedtls_entropy_context ctx,
unsigned char  source_id,
const unsigned char *  data,
size_t  len 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_entropy_add_source()

int mbedtls_entropy_add_source ( mbedtls_entropy_context ctx,
mbedtls_entropy_f_source_ptr  f_source,
void p_source,
size_t  threshold,
int  strong 
)

Adds an entropy source to poll (Thread-safe if MBEDTLS_THREADING_C is enabled)

Parameters
ctxEntropy context
f_sourceEntropy function
p_sourceFunction data
thresholdMinimum required from source before entropy is released ( with mbedtls_entropy_func() ) (in bytes)
strongMBEDTLS_ENTROPY_SOURCE_STRONG or MBEDTSL_ENTROPY_SOURCE_WEAK. At least one strong source needs to be added. Weaker sources (such as the cycle counter) can be used as a complement.
Returns
0 if successful or MBEDTLS_ERR_ENTROPY_MAX_SOURCES
Here is the caller graph for this function:

◆ mbedtls_entropy_free()

void mbedtls_entropy_free ( mbedtls_entropy_context ctx)

Free the data in the context.

Parameters
ctxEntropy context to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_entropy_func()

int mbedtls_entropy_func ( void data,
unsigned char *  output,
size_t  len 
)

Retrieve entropy from the accumulator (Maximum length: MBEDTLS_ENTROPY_BLOCK_SIZE) (Thread-safe if MBEDTLS_THREADING_C is enabled)

Parameters
dataEntropy context
outputBuffer to fill
lenNumber of bytes desired, must be at most MBEDTLS_ENTROPY_BLOCK_SIZE
Returns
0 if successful, or MBEDTLS_ERR_ENTROPY_SOURCE_FAILED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_entropy_gather()

int mbedtls_entropy_gather ( mbedtls_entropy_context ctx)

Trigger an extra gather poll for the accumulator (Thread-safe if MBEDTLS_THREADING_C is enabled)

Parameters
ctxEntropy context
Returns
0 if successful, or MBEDTLS_ERR_ENTROPY_SOURCE_FAILED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_entropy_init()

void mbedtls_entropy_init ( mbedtls_entropy_context ctx)

Initialize the context.

Parameters
ctxEntropy context to initialize
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_entropy_self_test()

int mbedtls_entropy_self_test ( int  verbose)

Checkup routine.

            This module self-test also calls the entropy self-test,
            mbedtls_entropy_source_self_test();
Returns
0 if successful, or 1 if a test failed
Here is the call graph for this function:

◆ mbedtls_entropy_update_manual()

int mbedtls_entropy_update_manual ( mbedtls_entropy_context ctx,
const unsigned char *  data,
size_t  len 
)

Add data to the accumulator manually (Thread-safe if MBEDTLS_THREADING_C is enabled)

Parameters
ctxEntropy context
dataData to add
lenLength of data
Returns
0 if successful
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_entropy_update_seed_file()

int mbedtls_entropy_update_seed_file ( mbedtls_entropy_context ctx,
const char *  path 
)

Read and update a seed file. Seed is added to this instance. No more than MBEDTLS_ENTROPY_MAX_SEED_SIZE bytes are read from the seed file. The rest is ignored.

Parameters
ctxEntropy context
pathName of the file
Returns
0 if successful, MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR on file error, MBEDTLS_ERR_ENTROPY_SOURCE_FAILED
Here is the call graph for this function:

◆ mbedtls_entropy_write_seed_file()

int mbedtls_entropy_write_seed_file ( mbedtls_entropy_context ctx,
const char *  path 
)

Write a seed file.

Parameters
ctxEntropy context
pathName of the file
Returns
0 if successful, MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR on file error, or MBEDTLS_ERR_ENTROPY_SOURCE_FAILED
Here is the call graph for this function:
Here is the caller graph for this function: