46 #include <ti/drivers/TRNG.h> 47 #include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintext.h> 53 trng_rand(uint8_t *entropy_buf,
size_t entropy_len, uint32_t timeout_us)
55 TRNG_Params trng_params;
56 TRNG_Handle trng_handle;
57 CryptoKey entropy_key;
60 TRNG_Params_init(&trng_params);
61 trng_params.returnBehavior = TRNG_RETURN_BEHAVIOR_BLOCKING;
62 if(timeout_us != TRNG_WAIT_FOREVER) {
63 trng_params.timeout = timeout_us;
66 trng_handle = TRNG_open(Board_TRNG0, &trng_params);
71 CryptoKeyPlaintext_initBlankKey(&entropy_key, entropy_buf, entropy_len);
73 result = TRNG_generateEntropy(trng_handle, &entropy_key);
75 TRNG_close(trng_handle);
77 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.