Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion drivers/entropy/entropy_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,14 @@ static int recover_seed_error(RNG_TypeDef *rng)
{
ll_rng_clear_seis(rng);

#if !defined(CONFIG_SOC_SERIES_STM32WB0X)
/* After a noise source error is detected, 12 words must be read from the RNG_DR register
* and discarded to restart the entropy generation.
*/
for (int i = 0; i < 12; ++i) {
(void)ll_rng_read_rand_data(rng);
}
#endif /* !CONFIG_SOC_SERIES_STM32WB0X */

if (ll_rng_is_active_seis(rng) != 0) {
return -EIO;
Expand Down Expand Up @@ -419,7 +424,7 @@ static uint16_t generate_from_isr(uint8_t *buf, uint16_t len)
byte = random_byte_get();
#if !IRQLESS_TRNG
NVIC_ClearPendingIRQ(IRQN);
#endif /* IRQLESS_TRNG */
#endif /* !IRQLESS_TRNG */

if (byte < 0) {
continue;
Expand Down
1 change: 1 addition & 0 deletions drivers/entropy/entropy_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static inline void ll_rng_clear_seis(RNG_TypeDef *RNGx)
#if defined(CONFIG_SOC_SERIES_STM32WB0X)
# if defined(CONFIG_SOC_STM32WB09XX)
LL_RNG_SetResetHealthErrorFlags(RNGx, 1);
WRITE_REG(RNGx->IRQ_SR, RNG_IRQ_SR_ERROR_IRQ);
# else
LL_RNG_ClearFlag_FAULT(RNGx);
# endif
Expand Down
Loading