24 #ifndef POLARSSL_HMAC_DRBG_H
25 #define POLARSSL_HMAC_DRBG_H
32 #define POLARSSL_ERR_HMAC_DRBG_REQUEST_TOO_BIG -0x0003
33 #define POLARSSL_ERR_HMAC_DRBG_INPUT_TOO_BIG -0x0005
34 #define POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR -0x0007
35 #define POLARSSL_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED -0x0009
45 #if !defined(POLARSSL_HMAC_DRBG_RESEED_INTERVAL)
46 #define POLARSSL_HMAC_DRBG_RESEED_INTERVAL 10000
49 #if !defined(POLARSSL_HMAC_DRBG_MAX_INPUT)
50 #define POLARSSL_HMAC_DRBG_MAX_INPUT 256
53 #if !defined(POLARSSL_HMAC_DRBG_MAX_REQUEST)
54 #define POLARSSL_HMAC_DRBG_MAX_REQUEST 1024
57 #if !defined(POLARSSL_HMAC_DRBG_MAX_SEED_INPUT)
58 #define POLARSSL_HMAC_DRBG_MAX_SEED_INPUT 384
63 #define POLARSSL_HMAC_DRBG_PR_OFF 0
64 #define POLARSSL_HMAC_DRBG_PR_ON 1
88 int (*f_entropy)(
void *,
unsigned char *, size_t);
117 int (*f_entropy)(
void *,
unsigned char *,
size_t),
119 const unsigned char *custom,
137 const unsigned char *data,
size_t data_len );
183 const unsigned char *additional,
size_t add_len );
196 const unsigned char *additional,
size_t len );
215 unsigned char *output,
size_t output_len,
216 const unsigned char *additional,
241 #if defined(POLARSSL_FS_IO)
268 #if defined(POLARSSL_SELF_TEST)
274 int hmac_drbg_self_test(
int verbose );
void hmac_drbg_set_entropy_len(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 hmac_drbg_init() )
int hmac_drbg_random(void *p_rng, unsigned char *output, size_t out_len)
HMAC_DRBG generate random.
void hmac_drbg_set_reseed_interval(hmac_drbg_context *ctx, int interval)
Set the reseed interval (Default: POLARSSL_HMAC_DRBG_RESEED_INTERVAL)
int hmac_drbg_reseed(hmac_drbg_context *ctx, const unsigned char *additional, size_t len)
HMAC_DRBG reseeding (extracts data from entropy source)
void hmac_drbg_free(hmac_drbg_context *ctx)
Free an HMAC_DRBG context.
void hmac_drbg_set_prediction_resistance(hmac_drbg_context *ctx, int resistance)
Enable / disable prediction resistance (Default: Off)
Generic message digest wrapper.
int hmac_drbg_init(hmac_drbg_context *ctx, const 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 initialisation.
#define POLARSSL_MD_MAX_SIZE
int 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 hmac_drbg_init_buf(hmac_drbg_context *ctx, const md_info_t *md_info, const unsigned char *data, size_t data_len)
Initilisation of simpified HMAC_DRBG (never reseeds).
int prediction_resistance
void hmac_drbg_update(hmac_drbg_context *ctx, const unsigned char *additional, size_t add_len)
HMAC_DRBG update state.
Message digest information.
Generic message digest context.