mbed TLS v2.2.0
trng.h
Go to the documentation of this file.
1 
21 #ifndef MBEDTLS_TRNG_H
22 #define MBEDTLS_TRNG_H
23 
24 #if !defined(MBEDTLS_CONFIG_FILE)
25 #include "mbedtls/config.h"
26 #else
27 #include MBEDTLS_CONFIG_FILE
28 #endif
29 
30 #if defined(MBEDTLS_TRNG_C)
31 
32 /***************************************************************************/
37 /***************************************************************************/
72 #include "em_device.h"
73 #include "mbedtls_ecode.h"
74 #include <stddef.h>
75 
76 /* TRNG specific error codes: */
77 
79 #define MBEDTLS_ERR_TRNG_CONDITIONING_TEST_FAILED ((int)MBEDTLS_ERR_TRNG_BASE | 0x00000001)
80 
82 #define MBEDTLS_ERR_TRNG_NO_DATA ((int)MBEDTLS_ERR_TRNG_BASE | 0x00000002)
83 
90 #define MBEDTLS_ERR_TRNG_REPETITION_COUNT_TEST_FAILED ((int)MBEDTLS_ERR_TRNG_BASE | 0x00000003)
91 
103 #define MBEDTLS_ERR_TRNG_ADAPTIVE_PROPORTION_TEST_64_FAILED ((int)MBEDTLS_ERR_TRNG_BASE | 0x00000004)
104 
116 #define MBEDTLS_ERR_TRNG_ADAPTIVE_PROPORTION_TEST_4096_FAILED ((int)MBEDTLS_ERR_TRNG_BASE | 0x00000005)
117 
128 #define MBEDTLS_ERR_TRNG_NOISE_ALARM ((int)MBEDTLS_ERR_TRNG_BASE | 0x00000006)
129 
140 #define MBEDTLS_ERR_TRNG_PRELIMINARY_NOISE_ALARM ((int)MBEDTLS_ERR_TRNG_BASE | 0x00000007)
141 
145 typedef struct
146 {
147  TRNG_TypeDef *trng;
148 }
150 
173 
189 
199 int mbedtls_trng_set_key( mbedtls_trng_context *ctx, const unsigned char *key );
200 
210 
220 
257  unsigned char *output, size_t len, size_t *olen );
258 
269 
270 #endif /* MBEDTLS_TRNG_C */
271 
275 #endif /* MBEDTLS_TRNG_H */
TRNG context structure.
Definition: trng.h:145
int mbedtls_trng_check_conditioning(mbedtls_trng_context *ctx)
Check the TRNG conditioning function.
Compatibility names (set of defines)
int mbedtls_trng_set_key(mbedtls_trng_context *ctx, const unsigned char *key)
Check the TRNG conditioning function.
int mbedtls_trng_poll(mbedtls_trng_context *ctx, unsigned char *output, size_t len, size_t *olen)
Poll for entropy data.
void mbedtls_trng_soft_reset(mbedtls_trng_context *ctx)
Execute TRNG soft reset.
Silicon Labs specific mbedtls error code definitions.
void mbedtls_trng_init(mbedtls_trng_context *ctx)
Initialize TRNG context.
void mbedtls_trng_free(mbedtls_trng_context *ctx)
Free TRNG context.
int mbedtls_trng_check_entropy(mbedtls_trng_context *ctx)
Check the TRNG entropy source is producing random data.
TRNG_TypeDef * trng
Definition: trng.h:147