26 #if defined(ASCON_TRNG_STM32_ENABLED)
28 extern RNG_HandleTypeDef ASCON_TRNG_STM32;
34 while (outlen >=
sizeof(x)) {
35 if (HAL_RNG_GenerateRandomNumber(&ASCON_TRNG_STM32, &x) != HAL_OK) {
39 memcpy(out, &x,
sizeof(x));
44 if (HAL_RNG_GenerateRandomNumber(&ASCON_TRNG_STM32, &x) != HAL_OK) {
48 memcpy(out, &x, outlen);
57 return HAL_RNG_GenerateRandomNumber(&ASCON_TRNG_STM32, &x) == HAL_OK;
69 if (HAL_RNG_GenerateRandomNumber(&ASCON_TRNG_STM32, &x) == HAL_OK)
uint32_t ascon_trng_generate_32(ascon_trng_state_t *state)
Generates a 32-bit random value for masking operations.
uint64_t ascon_trng_generate_64(ascon_trng_state_t *state)
Generates a 64-bit random value for masking operations.
int ascon_trng_init(ascon_trng_state_t *state)
Initializes the random number source for generating a sequence of masking material at high speed.
int ascon_trng_reseed(ascon_trng_state_t *state)
Reseeds the random number source.
void ascon_trng_free(ascon_trng_state_t *state)
Frees the random number source and destroys any sensitive material.
int ascon_trng_generate(unsigned char *out, size_t outlen)
Generates a buffer of bytes from the system TRNG source.
Access to the system's random number source.
ascon_state_t state
[snippet_key]
State of the random number source.