RetroArch
|
#include "mbedtls/config.h"
#include "mbedtls/hmac_drbg.h"
#include <string.h>
#include <stdio.h>
#include "mbedtls/platform.h"
#include "arc4_alt.h"
Macros | |
#define | OUTPUT_LEN 80 |
#define | CHK(c) |
Functions | |
void | mbedtls_hmac_drbg_init (mbedtls_hmac_drbg_context *ctx) |
HMAC_DRBG context initialization Makes the context ready for mbedtls_hmac_drbg_seed(), mbedtls_hmac_drbg_seed_buf() or mbedtls_hmac_drbg_free(). More... | |
void | mbedtls_hmac_drbg_update (mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t add_len) |
HMAC_DRBG update state. More... | |
int | mbedtls_hmac_drbg_seed_buf (mbedtls_hmac_drbg_context *ctx, const mbedtls_md_info_t *md_info, const unsigned char *data, size_t data_len) |
Initilisation of simpified HMAC_DRBG (never reseeds). (For use with deterministic ECDSA.) More... | |
int | mbedtls_hmac_drbg_reseed (mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t len) |
HMAC_DRBG reseeding (extracts data from entropy source) More... | |
int | mbedtls_hmac_drbg_seed (mbedtls_hmac_drbg_context *ctx, const mbedtls_md_info_t *md_info, int(*f_entropy)(void *, unsigned char *, size_t), void *p_entropy, const unsigned char *custom, size_t len) |
HMAC_DRBG initial seeding Seed and setup entropy source for future reseeds. More... | |
void | mbedtls_hmac_drbg_set_prediction_resistance (mbedtls_hmac_drbg_context *ctx, int resistance) |
Enable / disable prediction resistance (Default: Off) More... | |
void | mbedtls_hmac_drbg_set_entropy_len (mbedtls_hmac_drbg_context *ctx, size_t len) |
Set the amount of entropy grabbed on each reseed (Default: given by the security strength, which depends on the hash used, see mbedtls_hmac_drbg_init() ) More... | |
void | mbedtls_hmac_drbg_set_reseed_interval (mbedtls_hmac_drbg_context *ctx, int interval) |
Set the reseed interval (Default: MBEDTLS_HMAC_DRBG_RESEED_INTERVAL) More... | |
int | mbedtls_hmac_drbg_random_with_add (void *p_rng, unsigned char *output, size_t out_len, const unsigned char *additional, size_t add_len) |
HMAC_DRBG generate random with additional update input. More... | |
int | mbedtls_hmac_drbg_random (void *p_rng, unsigned char *output, size_t out_len) |
HMAC_DRBG generate random. More... | |
void | mbedtls_hmac_drbg_free (mbedtls_hmac_drbg_context *ctx) |
Free an HMAC_DRBG context. More... | |
int | mbedtls_hmac_drbg_write_seed_file (mbedtls_hmac_drbg_context *ctx, const char *path) |
int | mbedtls_hmac_drbg_update_seed_file (mbedtls_hmac_drbg_context *ctx, const char *path) |
static int | hmac_drbg_self_test_entropy (void *data, unsigned char *buf, size_t len) |
int | mbedtls_hmac_drbg_self_test (int verbose) |
Variables | |
static const unsigned char | entropy_pr [] |
static const unsigned char | hmac_result_pr [OUTPUT_LEN] |
static const unsigned char | entropy_nopr [] |
static const unsigned char | hmac_result_nopr [OUTPUT_LEN] |
static size_t | test_offset |
#define CHK | ( | c | ) |
#define OUTPUT_LEN 80 |
|
static |
void mbedtls_hmac_drbg_free | ( | mbedtls_hmac_drbg_context * | ctx | ) |
Free an HMAC_DRBG context.
ctx | HMAC_DRBG context to free. |
void mbedtls_hmac_drbg_init | ( | mbedtls_hmac_drbg_context * | ctx | ) |
HMAC_DRBG context initialization Makes the context ready for mbedtls_hmac_drbg_seed(), mbedtls_hmac_drbg_seed_buf() or mbedtls_hmac_drbg_free().
ctx | HMAC_DRBG context to be initialized |
int mbedtls_hmac_drbg_random | ( | void * | p_rng, |
unsigned char * | output, | ||
size_t | out_len | ||
) |
HMAC_DRBG generate random.
Note: Automatically reseeds if reseed_counter is reached or PR is enabled.
p_rng | HMAC_DRBG context |
output | Buffer to fill |
out_len | Length of the buffer |
int mbedtls_hmac_drbg_random_with_add | ( | void * | p_rng, |
unsigned char * | output, | ||
size_t | output_len, | ||
const unsigned char * | additional, | ||
size_t | add_len | ||
) |
HMAC_DRBG generate random with additional update input.
Note: Automatically reseeds if reseed_counter is reached or PR is enabled.
p_rng | HMAC_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 (can be 0) |
int mbedtls_hmac_drbg_reseed | ( | mbedtls_hmac_drbg_context * | ctx, |
const unsigned char * | additional, | ||
size_t | len | ||
) |
HMAC_DRBG reseeding (extracts data from entropy source)
ctx | HMAC_DRBG context |
additional | Additional data to add to state (Can be NULL) |
len | Length of additional data |
int mbedtls_hmac_drbg_seed | ( | mbedtls_hmac_drbg_context * | ctx, |
const mbedtls_md_info_t * | md_info, | ||
int(*)(void *, unsigned char *, size_t) | f_entropy, | ||
void * | p_entropy, | ||
const unsigned char * | custom, | ||
size_t | len | ||
) |
HMAC_DRBG initial seeding Seed and setup entropy source for future reseeds.
ctx | HMAC_DRBG context to be seeded |
md_info | MD algorithm to use for HMAC_DRBG |
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_hmac_drbg_seed_buf | ( | mbedtls_hmac_drbg_context * | ctx, |
const mbedtls_md_info_t * | md_info, | ||
const unsigned char * | data, | ||
size_t | data_len | ||
) |
Initilisation of simpified HMAC_DRBG (never reseeds). (For use with deterministic ECDSA.)
ctx | HMAC_DRBG context to be initialised |
md_info | MD algorithm to use for HMAC_DRBG |
data | Concatenation of entropy string and additional data |
data_len | Length of data in bytes |
int mbedtls_hmac_drbg_self_test | ( | int | verbose | ) |
void mbedtls_hmac_drbg_set_entropy_len | ( | mbedtls_hmac_drbg_context * | ctx, |
size_t | len | ||
) |
Set the amount of entropy grabbed on each reseed (Default: given by the security strength, which depends on the hash used, see mbedtls_hmac_drbg_init()
)
ctx | HMAC_DRBG context |
len | Amount of entropy to grab, in bytes |
void mbedtls_hmac_drbg_set_prediction_resistance | ( | mbedtls_hmac_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 | HMAC_DRBG context |
resistance | MBEDTLS_HMAC_DRBG_PR_ON or MBEDTLS_HMAC_DRBG_PR_OFF |
void mbedtls_hmac_drbg_set_reseed_interval | ( | mbedtls_hmac_drbg_context * | ctx, |
int | interval | ||
) |
Set the reseed interval (Default: MBEDTLS_HMAC_DRBG_RESEED_INTERVAL)
ctx | HMAC_DRBG context |
interval | Reseed interval |
void mbedtls_hmac_drbg_update | ( | mbedtls_hmac_drbg_context * | ctx, |
const unsigned char * | additional, | ||
size_t | add_len | ||
) |
HMAC_DRBG update state.
ctx | HMAC_DRBG context |
additional | Additional data to update state with, or NULL |
add_len | Length of additional data, or 0 |
int mbedtls_hmac_drbg_update_seed_file | ( | mbedtls_hmac_drbg_context * | ctx, |
const char * | path | ||
) |
int mbedtls_hmac_drbg_write_seed_file | ( | mbedtls_hmac_drbg_context * | ctx, |
const char * | path | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |