Skip to content

Commit 57ebf79

Browse files
HoZHelcfriedt
authored andcommitted
drivers: entropy: Modify the recover_seed_error function for WB0x
Exclude the WB0x series from discarding data 12 times from the RNG data register. Add a comment to the recover_seed_error function explaining the reason for reading and discarding data from the RNG data register 12 times. Signed-off-by: Ali Hozhabri <[email protected]>
1 parent d7074f2 commit 57ebf79

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/entropy/entropy_stm32.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,14 @@ static int recover_seed_error(RNG_TypeDef *rng)
328328
{
329329
ll_rng_clear_seis(rng);
330330

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

335340
if (ll_rng_is_active_seis(rng) != 0) {
336341
return -EIO;
@@ -446,7 +451,7 @@ static uint16_t generate_from_isr(uint8_t *buf, uint16_t len)
446451
ret = random_sample_get(&rnd_sample);
447452
#if !IRQLESS_TRNG
448453
NVIC_ClearPendingIRQ(IRQN);
449-
#endif /* IRQLESS_TRNG */
454+
#endif /* !IRQLESS_TRNG */
450455

451456
if (ret < 0) {
452457
continue;

0 commit comments

Comments
 (0)