26#ifndef MBEDTLS_HMAC_DRBG_H
27#define MBEDTLS_HMAC_DRBG_H
29#if !defined(MBEDTLS_CONFIG_FILE)
32#include MBEDTLS_CONFIG_FILE
37#if defined(MBEDTLS_THREADING_C)
51#define MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG -0x0003
52#define MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG -0x0005
53#define MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR -0x0007
54#define MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED -0x0009
64#if !defined(MBEDTLS_HMAC_DRBG_RESEED_INTERVAL)
65#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000
68#if !defined(MBEDTLS_HMAC_DRBG_MAX_INPUT)
69#define MBEDTLS_HMAC_DRBG_MAX_INPUT 256
72#if !defined(MBEDTLS_HMAC_DRBG_MAX_REQUEST)
73#define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024
76#if !defined(MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT)
77#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384
82#define MBEDTLS_HMAC_DRBG_PR_OFF 0
83#define MBEDTLS_HMAC_DRBG_PR_ON 1
97 unsigned char V[MBEDTLS_MD_MAX_SIZE];
110#if defined(MBEDTLS_THREADING_C)
111 mbedtls_threading_mutex_t mutex;
189 int (*f_entropy)(
void *,
unsigned char *,
size_t),
191 const unsigned char *custom,
214 const unsigned char *data,
size_t data_len );
272 const unsigned char *additional,
size_t add_len );
294 const unsigned char *additional,
size_t len );
323 unsigned char *output,
size_t output_len,
324 const unsigned char *additional,
355#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
356#if defined(MBEDTLS_DEPRECATED_WARNING)
357#define MBEDTLS_DEPRECATED __attribute__((deprecated))
359#define MBEDTLS_DEPRECATED
375 const unsigned char *additional,
size_t add_len );
376#undef MBEDTLS_DEPRECATED
379#if defined(MBEDTLS_FS_IO)
411#if defined(MBEDTLS_SELF_TEST)
418int mbedtls_hmac_drbg_self_test(
int verbose );
Configuration options (set of defines)
void mbedtls_hmac_drbg_set_prediction_resistance(mbedtls_hmac_drbg_context *ctx, int resistance)
This function turns prediction resistance on or off.
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.
int mbedtls_hmac_drbg_reseed(mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t len)
This function reseeds the HMAC_DRBG context, that is extracts data from the entropy source.
void mbedtls_hmac_drbg_init(mbedtls_hmac_drbg_context *ctx)
HMAC_DRBG context initialization.
void mbedtls_hmac_drbg_set_reseed_interval(mbedtls_hmac_drbg_context *ctx, int interval)
Set the reseed interval.
void mbedtls_hmac_drbg_update(mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t add_len)
This function updates the state of the HMAC_DRBG context.
void mbedtls_hmac_drbg_free(mbedtls_hmac_drbg_context *ctx)
This function resets HMAC_DRBG context to the state immediately after initial call of mbedtls_hmac_dr...
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).
void mbedtls_hmac_drbg_set_entropy_len(mbedtls_hmac_drbg_context *ctx, size_t len)
This function sets the amount of entropy grabbed on each seed or reseed.
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)
This function updates an HMAC_DRBG instance with additional data and uses it to generate random data.
int mbedtls_hmac_drbg_random(void *p_rng, unsigned char *output, size_t out_len)
This function uses HMAC_DRBG to generate random data.
int mbedtls_hmac_drbg_update_ret(mbedtls_hmac_drbg_context *ctx, const unsigned char *additional, size_t add_len)
This function updates the state of the HMAC_DRBG context.
This file contains the generic message-digest wrapper.
int(* f_entropy)(void *, unsigned char *, size_t)
mbedtls_md_context_t md_ctx
int prediction_resistance
unsigned char V[MBEDTLS_MD_MAX_SIZE]
The generic message-digest context.
Message digest information.
Threading abstraction layer.