44 #include <ti/drivers/TRNG.h> 45 #include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintext.h> 52 #include <ti/devices/DeviceFamily.h> 53 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) 54 #include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintextCC26XX.c> 61 trng_rand(uint8_t *entropy_buf,
size_t entropy_len, uint32_t timeout_us)
63 TRNG_Params trng_params;
64 TRNG_Handle trng_handle;
65 CryptoKey entropy_key;
68 TRNG_Params_init(&trng_params);
69 trng_params.returnBehavior = TRNG_RETURN_BEHAVIOR_BLOCKING;
70 if(timeout_us != TRNG_WAIT_FOREVER) {
71 trng_params.timeout = timeout_us;
74 trng_handle = TRNG_open(0, &trng_params);
79 CryptoKeyPlaintext_initBlankKey(&entropy_key, entropy_buf, entropy_len);
81 result = TRNG_generateEntropy(trng_handle, &entropy_key);
83 TRNG_close(trng_handle);
85 return result == TRNG_STATUS_SUCCESS;
bool trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us)
Generates a stream of entropy from which you can create a true random number from.
Header file of True Random Number Generator for CC13xx/CC26xx.