84#ifndef MBEDTLS_CTR_DRBG_H
85#define MBEDTLS_CTR_DRBG_H
87#if !defined(MBEDTLS_CONFIG_FILE)
90#include MBEDTLS_CONFIG_FILE
95#if defined(MBEDTLS_THREADING_C)
99#define MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034
100#define MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036
101#define MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038
102#define MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A
104#define MBEDTLS_CTR_DRBG_BLOCKSIZE 16
106#if defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY)
107#define MBEDTLS_CTR_DRBG_KEYSIZE 16
114#define MBEDTLS_CTR_DRBG_KEYSIZE 32
122#define MBEDTLS_CTR_DRBG_KEYBITS ( MBEDTLS_CTR_DRBG_KEYSIZE * 8 )
123#define MBEDTLS_CTR_DRBG_SEEDLEN ( MBEDTLS_CTR_DRBG_KEYSIZE + MBEDTLS_CTR_DRBG_BLOCKSIZE )
138#if !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN)
139#if defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256)
143#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48
151#if !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY)
156#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 32
160#if !defined(MBEDTLS_CTR_DRBG_RESEED_INTERVAL)
161#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000
165#if !defined(MBEDTLS_CTR_DRBG_MAX_INPUT)
166#define MBEDTLS_CTR_DRBG_MAX_INPUT 256
170#if !defined(MBEDTLS_CTR_DRBG_MAX_REQUEST)
171#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024
175#if !defined(MBEDTLS_CTR_DRBG_MAX_SEED_INPUT)
176#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384
182#define MBEDTLS_CTR_DRBG_PR_OFF 0
184#define MBEDTLS_CTR_DRBG_PR_ON 1
216#if defined(MBEDTLS_THREADING_C)
224 mbedtls_threading_mutex_t
mutex;
277#if MBEDTLS_CTR_DRBG_ENTROPY_LEN < MBEDTLS_CTR_DRBG_KEYSIZE * 3 / 2
287#if defined(MBEDTLS_THREADING_C)
325 int (*f_entropy)(
void *,
unsigned char *,
size_t),
327 const unsigned char *custom,
415 const unsigned char *additional,
size_t len );
438 const unsigned char *additional,
473 unsigned char *output,
size_t output_len,
474 const unsigned char *additional,
size_t add_len );
482#if defined(MBEDTLS_THREADING_C)
501 unsigned char *output,
size_t output_len );
504#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
505#if defined(MBEDTLS_DEPRECATED_WARNING)
506#define MBEDTLS_DEPRECATED __attribute__((deprecated))
508#define MBEDTLS_DEPRECATED
527 const unsigned char *additional,
529#undef MBEDTLS_DEPRECATED
532#if defined(MBEDTLS_FS_IO)
563#if defined(MBEDTLS_SELF_TEST)
571int mbedtls_ctr_drbg_self_test(
int verbose );
577 int (*)(
void *,
unsigned char *,
size_t),
void *,
578 const unsigned char *,
size_t,
size_t );
This file contains AES definitions and functions.
int mbedtls_ctr_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 a CTR_DRBG instance with additional data and uses it to generate random data.
int mbedtls_ctr_drbg_reseed(mbedtls_ctr_drbg_context *ctx, const unsigned char *additional, size_t len)
This function reseeds the CTR_DRBG context, that is extracts data from the entropy source.
MBEDTLS_DEPRECATED void mbedtls_ctr_drbg_update(mbedtls_ctr_drbg_context *ctx, const unsigned char *additional, size_t add_len)
This function updates the state of the CTR_DRBG context.
int mbedtls_ctr_drbg_seed_entropy_len(mbedtls_ctr_drbg_context *, int(*)(void *, unsigned char *, size_t), void *, const unsigned char *, size_t, size_t)
int mbedtls_ctr_drbg_update_ret(mbedtls_ctr_drbg_context *ctx, const unsigned char *additional, size_t add_len)
This function updates the state of the CTR_DRBG context.
#define MBEDTLS_DEPRECATED
void mbedtls_ctr_drbg_set_prediction_resistance(mbedtls_ctr_drbg_context *ctx, int resistance)
This function turns prediction resistance on or off. The default value is off.
void mbedtls_ctr_drbg_set_reseed_interval(mbedtls_ctr_drbg_context *ctx, int interval)
This function sets the reseed interval.
void mbedtls_ctr_drbg_set_entropy_len(mbedtls_ctr_drbg_context *ctx, size_t len)
This function sets the amount of entropy grabbed on each seed or reseed.
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
#define mbedtls_ctr_drbg_seed
#define mbedtls_ctr_drbg_random
#define mbedtls_ctr_drbg_init
#define mbedtls_ctr_drbg_free
The AES context-type definition.
The CTR_DRBG context structure.
int(* f_entropy)(void *, unsigned char *, size_t)
mbedtls_aes_context aes_ctx
int prediction_resistance
Threading abstraction layer.