MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClEls_Rng.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2020-2023 NXP */
3 /* */
4 /* NXP Confidential. This software is owned or controlled by NXP and may */
5 /* only be used strictly in accordance with the applicable license terms. */
6 /* By expressly accepting such terms or by downloading, installing, */
7 /* activating and/or otherwise using the software, you are agreeing that */
8 /* you have read, and that you agree to comply with and are bound by, such */
9 /* license terms. If you do not agree to be bound by the applicable license */
10 /* terms, then you may not retain, install, activate or otherwise use the */
11 /* software. */
12 /*--------------------------------------------------------------------------*/
13 
20 #ifndef MCUXCLELS_RNG_H_
21 #define MCUXCLELS_RNG_H_
22 
23 #include <mcuxClConfig.h> // Exported features flags header
24 #include <mcuxClEls_Common.h> // Common functionality
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
38 /**********************************************
39  * CONSTANTS
40  **********************************************/
47 #define MCUXCLELS_RNG_DTRNG_CONFIG_SIZE ((uint8_t) 84)
48 #define MCUXCLELS_RNG_DTRNG_EVAL_CONFIG_SIZE ((uint8_t) 52)
49 #define MCUXCLELS_RNG_DTRNG_EVAL_RESULT_SIZE ((uint8_t) 188)
50 
51 #define MCUXCLELS_RNG_DRBG_TEST_EXTRACT_OUTPUT_MIN_SIZE 4U
52 #define MCUXCLELS_RNG_DRBG_TEST_EXTRACT_OUTPUT_MAX_SIZE ((uint32_t) 1U << 16U)
53 
54 #define MCUXCLELS_RNG_DRBG_TEST_MODE_INSTANTIATE ((uint32_t) 0U)
55 #define MCUXCLELS_RNG_DRBG_TEST_MODE_EXTRACT ((uint32_t) 1U)
56 #define MCUXCLELS_RNG_DRBG_TEST_MODE_AES_ECB ((uint32_t) 3U)
57 #define MCUXCLELS_RNG_DRBG_TEST_MODE_AES_CTR ((uint32_t) 2U)
58 
59 #ifdef MCUXCL_FEATURE_ELS_RND_RAW
60 #define MCUXCLELS_RNG_RND_REQ_RND_RAW ((uint32_t) 1U << 1)
61 #define MCUXCLELS_RNG_RAW_ENTROPY_SIZE ((uint32_t) 32U)
62 #endif /* MCUXCL_FEATURE_ELS_RND_RAW */
63 #ifdef MCUXCL_FEATURE_ELS_PRND_INIT
64 #define MCUXCLELS_RNG_RND_REQ_PRND_INIT ((uint32_t) 1U << 0)
65 #endif /* MCUXCL_FEATURE_ELS_PRND_INIT */
66 
71 /**********************************************
72  * FUNCTIONS
73  **********************************************/
118 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_DrbgRequest_Async)
119 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgRequest_Async(
120  uint8_t * pOutput,
121  size_t outputLength
122  );
123 
124 #ifdef MCUXCL_FEATURE_ELS_RND_RAW
125 
143 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_DrbgRequestRaw_Async)
144 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgRequestRaw_Async(
145  uint8_t * pOutput
146  );
147 #endif /* MCUXCL_FEATURE_ELS_RND_RAW */
148 
168 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_DrbgTestInstantiate_Async)
169 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgTestInstantiate_Async(
170  uint8_t const * pEntropy
171  );
172 
204 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_DrbgTestExtract_Async)
205 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgTestExtract_Async(
206  uint8_t * pOutput,
207  size_t outputLength
208  );
209 
231 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_DrbgTestAesEcb_Async)
232 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgTestAesEcb_Async(
233  uint8_t const * pDataKey,
234  uint8_t * pOutput
235  );
236 
260 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_DrbgTestAesCtr_Async)
261 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgTestAesCtr_Async(
262  uint8_t const * pData,
263  size_t dataLength,
264  uint8_t const * pIvKey,
265  uint8_t * pOutput
266  );
267 
297 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_Dtrng_ConfigLoad_Async)
298 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_Dtrng_ConfigLoad_Async(
299  uint8_t const * pInput
300  );
301 
302 
333 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_Dtrng_ConfigEvaluate_Async)
334 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_Dtrng_ConfigEvaluate_Async(
335  uint8_t const * pInput,
336  uint8_t * pOutput
337  );
338 
339 #ifdef MCUXCL_FEATURE_ELS_PRND_INIT
340 
355 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Prng_Init_Async)
356 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Prng_Init_Async(void);
357 #endif /* MCUXCL_FEATURE_ELS_PRND_INIT */
358 
376 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Prng_GetRandomWord)
377 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Prng_GetRandomWord(
378  uint32_t * pWord
379  );
380 
399 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Prng_GetRandom)
401  uint8_t * pOutput,
402  size_t outputLength
403  );
404 
405 #ifdef MCUXCL_FEATURE_ELS_ITERATIVE_SEEDING
406 
424 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Dtrng_IterativeReseeding_CheckAndReseed)
425 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Dtrng_IterativeReseeding_CheckAndReseed(const uint8_t *pDtrngConfig);
426 #endif /* MCUXCL_FEATURE_ELS_ITERATIVE_SEEDING */
427  /* mcuxClEls_Rng_Functions */
431 
432  /* mcuxClEls_Rng */
436 
437 #ifdef __cplusplus
438 } /* extern "C" */
439 #endif
440 
441 #endif /* MCUXCLELS_RNG_H_ */
MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgRequest_Async(uint8_t *pOutput
Writes random data from the ELS DRBG to the given buffer.
Definition: mcuxCsslFlowProtection_example.c:137
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition: mcuxCsslFlowProtection.h:125
MCUXCLELS_API mcuxClEls_KeyIndex_t uint8_t * pOutput
< [out] The memory address of the exported key
Definition: mcuxClEls_KeyManagement.h:295
ELS header for common functionality.
uint32_t mcuxClEls_Status_t
Type for ELS driver status codes.
Definition: mcuxClEls_Types.h:211
#define MCUXCLELS_API
Marks a function as a public API function of the mcuxClEls component.
Definition: mcuxClEls_Common.h:47