High level interface to the True Random Number Generator (TRNG).
This block uses dedicated hardware to efficiently generate true random numbers.
Features
- Number generated is statistically random
- Based on physical processes exhibiting random variation
- Generated sequences of numbers cannot be duplicated by running the process again
- Uses polynomial generators with fixed and programmable polynomials
- Note
- This driver is not intended to be used directly as a security library, but can be used in a security context. If a full security library is needed something like Mbed TLS should be used instead.
Quick Start
See Simple TRNG number generation example.
Simple TRNG number generation example
The following snippet initializes a TRNG and generates a true random number.
uint32_t rnd_num;
#if defined(CY_IP_MXCRYPTO)
#endif
cy_en_crypto_status_t Cy_Crypto_Core_Enable(CRYPTO_Type *base)
The function to enable the Crypto hardware.
Definition: cy_crypto_core_hw.c:459
CRYPTO_Type * base
Base address of CRYPTO IP instance.
Definition: mtb_hal_hw_types_trng_crypto.h:53
RNG object.
Definition: mtb_hal_hw_types_trng_crypto.h:52
void * mtb_hal_trng_configurator_t
TRNG configurator struct.
Definition: mtb_hal_hw_types_trng.h:54
__STATIC_INLINE cy_rslt_t mtb_hal_trng_setup(mtb_hal_trng_t *obj, const mtb_hal_trng_configurator_t *config)
Sets up a HAL instance to use the specified hardware resource.
Definition: mtb_hal_trng_impl.h:63
cy_rslt_t mtb_hal_trng_get_uint32(const mtb_hal_trng_t *obj, uint32_t *value)
Get a random uint32_t number.
uint32_t cy_rslt_t
Provides the result of an operation as a structured bitfield.
Definition: cy_result.h:459
◆ mtb_hal_trng_get_uint32()
Get a random uint32_t number.
- Parameters
-
| [in] | obj | The TRNG object |
| [out] | value | Location to store the random number |
- Returns
- Status of number generation request
See Simple TRNG number generation example