27 #ifndef POLARSSL_HMAC_DRBG_H
28 #define POLARSSL_HMAC_DRBG_H
35 #define POLARSSL_ERR_HMAC_DRBG_REQUEST_TOO_BIG -0x0003
36 #define POLARSSL_ERR_HMAC_DRBG_INPUT_TOO_BIG -0x0005
37 #define POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR -0x0007
38 #define POLARSSL_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED -0x0009
48 #if !defined(POLARSSL_HMAC_DRBG_RESEED_INTERVAL)
49 #define POLARSSL_HMAC_DRBG_RESEED_INTERVAL 10000
52 #if !defined(POLARSSL_HMAC_DRBG_MAX_INPUT)
53 #define POLARSSL_HMAC_DRBG_MAX_INPUT 256
56 #if !defined(POLARSSL_HMAC_DRBG_MAX_REQUEST)
57 #define POLARSSL_HMAC_DRBG_MAX_REQUEST 1024
60 #if !defined(POLARSSL_HMAC_DRBG_MAX_SEED_INPUT)
61 #define POLARSSL_HMAC_DRBG_MAX_SEED_INPUT 384
66 #define POLARSSL_HMAC_DRBG_PR_OFF 0
67 #define POLARSSL_HMAC_DRBG_PR_ON 1
91 int (*f_entropy)(
void *,
unsigned char *, size_t);
120 int (*f_entropy)(
void *,
unsigned char *,
size_t),
122 const unsigned char *custom,
140 const unsigned char *data,
size_t data_len );
186 const unsigned char *additional,
size_t add_len );
199 const unsigned char *additional,
size_t len );
218 unsigned char *output,
size_t output_len,
219 const unsigned char *additional,
244 #if defined(POLARSSL_FS_IO)
271 #if defined(POLARSSL_SELF_TEST)
277 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.