RetroArch
|
#include "mbedtls/config.h"
#include "mbedtls/ctr_drbg.h"
#include <string.h>
#include <stdio.h>
#include "mbedtls/platform.h"
#include "arc4_alt.h"
Macros | |
#define | CHK(c) |
Functions | |
void | mbedtls_ctr_drbg_init (mbedtls_ctr_drbg_context *ctx) |
CTR_DRBG context initialization Makes the context ready for mbedtls_ctr_drbg_seed() or mbedtls_ctr_drbg_free(). More... | |
int | mbedtls_ctr_drbg_seed_entropy_len (mbedtls_ctr_drbg_context *ctx, int(*f_entropy)(void *, unsigned char *, size_t), void *p_entropy, const unsigned char *custom, size_t len, size_t entropy_len) |
int | mbedtls_ctr_drbg_seed (mbedtls_ctr_drbg_context *ctx, int(*f_entropy)(void *, unsigned char *, size_t), void *p_entropy, const unsigned char *custom, size_t len) |
CTR_DRBG initial seeding Seed and setup entropy source for future reseeds. More... | |
void | mbedtls_ctr_drbg_free (mbedtls_ctr_drbg_context *ctx) |
Clear CTR_CRBG context data. More... | |
void | mbedtls_ctr_drbg_set_prediction_resistance (mbedtls_ctr_drbg_context *ctx, int resistance) |
Enable / disable prediction resistance (Default: Off) More... | |
void | mbedtls_ctr_drbg_set_entropy_len (mbedtls_ctr_drbg_context *ctx, size_t len) |
Set the amount of entropy grabbed on each (re)seed (Default: MBEDTLS_CTR_DRBG_ENTROPY_LEN) More... | |
void | mbedtls_ctr_drbg_set_reseed_interval (mbedtls_ctr_drbg_context *ctx, int interval) |
Set the reseed interval (Default: MBEDTLS_CTR_DRBG_RESEED_INTERVAL) More... | |
static int | block_cipher_df (unsigned char *output, const unsigned char *data, size_t data_len) |
static int | ctr_drbg_update_internal (mbedtls_ctr_drbg_context *ctx, const unsigned char data[MBEDTLS_CTR_DRBG_SEEDLEN]) |
void | mbedtls_ctr_drbg_update (mbedtls_ctr_drbg_context *ctx, const unsigned char *additional, size_t add_len) |
CTR_DRBG update state. More... | |
int | mbedtls_ctr_drbg_reseed (mbedtls_ctr_drbg_context *ctx, const unsigned char *additional, size_t len) |
CTR_DRBG reseeding (extracts data from entropy source) More... | |
int | mbedtls_ctr_drbg_random_with_add (void *p_rng, unsigned char *output, size_t output_len, const unsigned char *additional, size_t add_len) |
CTR_DRBG generate random with additional update input. More... | |
int | mbedtls_ctr_drbg_random (void *p_rng, unsigned char *output, size_t output_len) |
CTR_DRBG generate random. More... | |
int | mbedtls_ctr_drbg_write_seed_file (mbedtls_ctr_drbg_context *ctx, const char *path) |
Write a seed file. More... | |
int | mbedtls_ctr_drbg_update_seed_file (mbedtls_ctr_drbg_context *ctx, const char *path) |
Read and update a seed file. Seed is added to this instance. More... | |
static int | ctr_drbg_self_test_entropy (void *data, unsigned char *buf, size_t len) |
int | mbedtls_ctr_drbg_self_test (int verbose) |
Checkup routine. More... | |
Variables | |
static const unsigned char | entropy_source_pr [96] |
static const unsigned char | entropy_source_nopr [64] |
static const unsigned char | nonce_pers_pr [16] |
static const unsigned char | nonce_pers_nopr [16] |
static const unsigned char | ctr_result_pr [16] |
static const unsigned char | ctr_result_nopr [16] |
static size_t | test_offset |
#define CHK | ( | c | ) |
|
static |
|
static |
|
static |
void mbedtls_ctr_drbg_free | ( | mbedtls_ctr_drbg_context * | ctx | ) |
Clear CTR_CRBG context data.
ctx | CTR_DRBG context to clear |
void mbedtls_ctr_drbg_init | ( | mbedtls_ctr_drbg_context * | ctx | ) |
CTR_DRBG context initialization Makes the context ready for mbedtls_ctr_drbg_seed() or mbedtls_ctr_drbg_free().
ctx | CTR_DRBG context to be initialized |
int mbedtls_ctr_drbg_random | ( | void * | p_rng, |
unsigned char * | output, | ||
size_t | output_len | ||
) |
CTR_DRBG generate random.
Note: Automatically reseeds if reseed_counter is reached.
p_rng | CTR_DRBG context |
output | Buffer to fill |
output_len | Length of the buffer |
int mbedtls_ctr_drbg_random_with_add | ( | void * | p_rng, |
unsigned char * | output, | ||
size_t | output_len, | ||
const unsigned char * | additional, | ||
size_t | add_len | ||
) |
CTR_DRBG generate random with additional update input.
Note: Automatically reseeds if reseed_counter is reached.
p_rng | CTR_DRBG context |
output | Buffer to fill |
output_len | Length of the buffer |
additional | Additional data to update with (Can be NULL) |
add_len | Length of additional data |
int mbedtls_ctr_drbg_reseed | ( | mbedtls_ctr_drbg_context * | ctx, |
const unsigned char * | additional, | ||
size_t | len | ||
) |
CTR_DRBG reseeding (extracts data from entropy source)
ctx | CTR_DRBG context |
additional | Additional data to add to state (Can be NULL) |
len | Length of additional data |
int mbedtls_ctr_drbg_seed | ( | mbedtls_ctr_drbg_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_entropy, | ||
void * | p_entropy, | ||
const unsigned char * | custom, | ||
size_t | len | ||
) |
CTR_DRBG initial seeding Seed and setup entropy source for future reseeds.
Note: Personalization data can be provided in addition to the more generic entropy source to make this instantiation as unique as possible.
ctx | CTR_DRBG context to be seeded |
f_entropy | Entropy callback (p_entropy, buffer to fill, buffer length) |
p_entropy | Entropy context |
custom | Personalization data (Device specific identifiers) (Can be NULL) |
len | Length of personalization data |
int mbedtls_ctr_drbg_seed_entropy_len | ( | mbedtls_ctr_drbg_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_entropy, | ||
void * | p_entropy, | ||
const unsigned char * | custom, | ||
size_t | len, | ||
size_t | entropy_len | ||
) |
int mbedtls_ctr_drbg_self_test | ( | int | verbose | ) |
Checkup routine.
void mbedtls_ctr_drbg_set_entropy_len | ( | mbedtls_ctr_drbg_context * | ctx, |
size_t | len | ||
) |
Set the amount of entropy grabbed on each (re)seed (Default: MBEDTLS_CTR_DRBG_ENTROPY_LEN)
ctx | CTR_DRBG context |
len | Amount of entropy to grab |
void mbedtls_ctr_drbg_set_prediction_resistance | ( | mbedtls_ctr_drbg_context * | ctx, |
int | resistance | ||
) |
Enable / disable prediction resistance (Default: Off)
Note: If enabled, entropy is used for ctx->entropy_len before each call! Only use this if you have ample supply of good entropy!
ctx | CTR_DRBG context |
resistance | MBEDTLS_CTR_DRBG_PR_ON or MBEDTLS_CTR_DRBG_PR_OFF |
void mbedtls_ctr_drbg_set_reseed_interval | ( | mbedtls_ctr_drbg_context * | ctx, |
int | interval | ||
) |
Set the reseed interval (Default: MBEDTLS_CTR_DRBG_RESEED_INTERVAL)
ctx | CTR_DRBG context |
interval | Reseed interval |
void mbedtls_ctr_drbg_update | ( | mbedtls_ctr_drbg_context * | ctx, |
const unsigned char * | additional, | ||
size_t | add_len | ||
) |
CTR_DRBG update state.
ctx | CTR_DRBG context |
additional | Additional data to update state with |
add_len | Length of additional data |
int mbedtls_ctr_drbg_update_seed_file | ( | mbedtls_ctr_drbg_context * | ctx, |
const char * | path | ||
) |
Read and update a seed file. Seed is added to this instance.
ctx | CTR_DRBG context |
path | Name of the file |
int mbedtls_ctr_drbg_write_seed_file | ( | mbedtls_ctr_drbg_context * | ctx, |
const char * | path | ||
) |
Write a seed file.
ctx | CTR_DRBG context |
path | Name of the file |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |