24 #ifndef MBEDTLS_HMAC_DRBG_H 25 #define MBEDTLS_HMAC_DRBG_H 29 #if defined(MBEDTLS_THREADING_C) 36 #define MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG -0x0003 37 #define MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG -0x0005 38 #define MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR -0x0007 39 #define MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED -0x0009 49 #if !defined(MBEDTLS_HMAC_DRBG_RESEED_INTERVAL) 50 #define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 53 #if !defined(MBEDTLS_HMAC_DRBG_MAX_INPUT) 54 #define MBEDTLS_HMAC_DRBG_MAX_INPUT 256 57 #if !defined(MBEDTLS_HMAC_DRBG_MAX_REQUEST) 58 #define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024 61 #if !defined(MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT) 62 #define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 67 #define MBEDTLS_HMAC_DRBG_PR_OFF 0 68 #define MBEDTLS_HMAC_DRBG_PR_ON 1 95 #if defined(MBEDTLS_THREADING_C) 96 mbedtls_threading_mutex_t mutex;
136 int (*f_entropy)(
void *,
unsigned char *,
size_t),
138 const unsigned char *custom,
156 const unsigned char *data,
size_t data_len );
205 const unsigned char *additional,
size_t add_len );
218 const unsigned char *additional,
size_t len );
237 unsigned char *output,
size_t output_len,
238 const unsigned char *additional,
263 #if ! defined(MBEDTLS_DEPRECATED_REMOVED) 264 #if defined(MBEDTLS_DEPRECATED_WARNING) 265 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 267 #define MBEDTLS_DEPRECATED 284 const unsigned char *additional,
size_t add_len );
285 #undef MBEDTLS_DEPRECATED 288 #if defined(MBEDTLS_FS_IO) 315 #if defined(MBEDTLS_SELF_TEST) 321 int mbedtls_hmac_drbg_self_test(
int verbose );
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.
#define MBEDTLS_MD_MAX_SIZE
Definition: md.h:74
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....
void mbedtls_hmac_drbg_set_reseed_interval(mbedtls_hmac_drbg_context *ctx, int interval)
Set the reseed interval (Default: MBEDTLS_HMAC_DRBG_RESEED_INTERVAL)
Definition: hmac_drbg.h:77
void mbedtls_hmac_drbg_free(mbedtls_hmac_drbg_context *ctx)
Free an HMAC_DRBG context.
int mbedtls_hmac_drbg_random(void *p_rng, unsigned char *output, size_t out_len)
HMAC_DRBG generate random.
void * p_entropy
Definition: hmac_drbg.h:93
int(* f_entropy)(void *, unsigned char *, size_t)
Definition: hmac_drbg.h:92
int reseed_interval
Definition: hmac_drbg.h:89
unsigned char V[MBEDTLS_MD_MAX_SIZE]
Definition: hmac_drbg.h:82
size_t entropy_len
Definition: hmac_drbg.h:86
Threading abstraction layer.
struct mbedtls_hmac_drbg_context mbedtls_hmac_drbg_context
#define MBEDTLS_DEPRECATED
Definition: hmac_drbg.h:267
MBEDTLS_DEPRECATED void mbedtls_hmac_drbg_update(mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t add_len)
HMAC_DRBG update state.
This file contains the generic message-digest wrapper.
void mbedtls_hmac_drbg_init(mbedtls_hmac_drbg_context *ctx)
HMAC_DRBG context initialization Makes the context ready for mbedtls_hmac_drbg_seed(),...
int prediction_resistance
Definition: hmac_drbg.h:87
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.
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)
Definition: md_internal.h:47
mbedtls_md_context_t md_ctx
Definition: hmac_drbg.h:81
int mbedtls_hmac_drbg_update_ret(mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t add_len)
HMAC_DRBG update state.
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,...
int reseed_counter
Definition: hmac_drbg.h:83
void mbedtls_hmac_drbg_set_prediction_resistance(mbedtls_hmac_drbg_context *ctx, int resistance)
Enable / disable prediction resistance (Default: Off)