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  **********************************************/
120  uint8_t * pOutput,
121  size_t outputLength
122  );
123 
124 #ifdef MCUXCL_FEATURE_ELS_RND_RAW
125 
142 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Rng_DrbgRequestRaw_Async)
143 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Rng_DrbgRequestRaw_Async(
144  uint8_t * pOutput
145  );
146 #endif /* MCUXCL_FEATURE_ELS_RND_RAW */
147 
168  uint8_t const * pEntropy
169  );
170 
203  uint8_t * pOutput,
204  size_t outputLength
205  );
206 
229  uint8_t const * pDataKey,
230  uint8_t * pOutput
231  );
232 
257  uint8_t const * pData,
258  size_t dataLength,
259  uint8_t const * pIvKey,
260  uint8_t * pOutput
261  );
262 
294  uint8_t const * pInput
295  );
296 
297 
329  uint8_t const * pInput,
330  uint8_t * pOutput
331  );
332 
333 #ifdef MCUXCL_FEATURE_ELS_PRND_INIT
334 
349 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Prng_Init_Async)
350 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Prng_Init_Async(void);
351 #endif /* MCUXCL_FEATURE_ELS_PRND_INIT */
352 
372  uint32_t * pWord
373  );
374 
395  uint8_t * pOutput,
396  size_t outputLength
397  );
398 
399 #ifdef MCUXCL_FEATURE_ELS_ITERATIVE_SEEDING
400 
418 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEls_Dtrng_IterativeReseeding_CheckAndReseed)
419 MCUXCLELS_API MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEls_Status_t) mcuxClEls_Dtrng_IterativeReseeding_CheckAndReseed(const uint8_t *pDtrngConfig);
420 #endif /* MCUXCL_FEATURE_ELS_ITERATIVE_SEEDING */
421  /* mcuxClEls_Rng_Functions */
425 
426  /* mcuxClEls_Rng */
430 
431 #ifdef __cplusplus
432 } /* extern "C" */
433 #endif
434 
435 #endif /* MCUXCLELS_RNG_H_ */
uint32_t mcuxClEls_Status_t
Type for ELS driver status codes.
Definition: mcuxClEls_Types.h:211
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Prng_GetRandom(uint8_t *pOutput, size_t outputLength)
Writes random data from the ELS PRNG to the given buffer.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Rng_DrbgTestExtract_Async(uint8_t *pOutput, size_t outputLength)
Performs a DRBG extraction.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Rng_DrbgRequest_Async(uint8_t *pOutput, size_t outputLength)
Writes random data from the ELS DRBG to the given buffer.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Prng_GetRandomWord(uint32_t *pWord)
Returns one random word from the ELS PRNG.
ELS header for common functionality.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Rng_Dtrng_ConfigEvaluate_Async(uint8_t const *pInput, uint8_t *pOutput)
Performs characterization of the ELS DTRNG.
#define MCUXCLELS_API
Marks a function as a public API function of the mcuxClEls component.
Definition: mcuxClEls_Common.h:47
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Rng_Dtrng_ConfigLoad_Async(uint8_t const *pInput)
Loads a configuration of the ELS DTRNG.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Rng_DrbgTestAesEcb_Async(uint8_t const *pDataKey, uint8_t *pOutput)
Encrypts data using the AES-ECB engine of the DRBG.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Rng_DrbgTestInstantiate_Async(uint8_t const *pEntropy)
Instantiates the DRBG in test mode.
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition: mcuxCsslFlowProtection.h:125
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition: mcuxCsslFlowProtection.h:81
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Rng_DrbgTestAesCtr_Async(uint8_t const *pData, size_t dataLength, uint8_t const *pIvKey, uint8_t *pOutput)
Encrypts data using the AES-CTR engine of the DRBG.