Skip to content

Commit

Permalink
drivers: stm32_rng: use default PRNG init if RNG is disabled in the DT
Browse files Browse the repository at this point in the history
In case RNG peripheral is not enabled in device tree, fallback to the
default RNG initialization implementation.

Signed-off-by: Thomas Bourgoin <[email protected]>
Acked-by: Jens Wiklander <[email protected]>
Acked-by: Jerome Forissier <[email protected]>
Reviewed-by: Etienne Carriere <[email protected]>
  • Loading branch information
tbourgoi authored and jforissier committed Sep 23, 2024
1 parent dcb51b2 commit f2fe4f0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/drivers/stm32_rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,17 @@ static TEE_Result stm32_rng_read(uint8_t *out, size_t size)
}

#ifdef CFG_WITH_SOFTWARE_PRNG
/* Override weak plat_rng_init with platform handler to seed PRNG */
/* Override weak plat_rng_init with platform handler to attempt to seed PRNG */
void plat_rng_init(void)
{
uint8_t seed[RNG_FIFO_BYTE_DEPTH] = { };

if (!stm32_rng) {
__plat_rng_init();
DMSG("PRNG seeded without RNG");
return;
}

if (stm32_rng_read(seed, sizeof(seed)))
panic();

Expand Down

0 comments on commit f2fe4f0

Please sign in to comment.