mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 09:04:17 +00:00
fix(st-crypto): do not read RNG data if it's not ready
Having RNG_SR_DRDY bit in RNG_SR register does not mean that there are 4 RNG words ready to be read. Add a check on RNG_SR_DRDY between each word reading. Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Change-Id: I46af7ca6c0ddbe19540b248365a5016b15b9a707
This commit is contained in:
parent
4593e7cbe8
commit
53092a7780
1 changed files with 4 additions and 0 deletions
|
@ -187,6 +187,10 @@ int stm32_rng_read(uint8_t *out, uint32_t size)
|
|||
|
||||
count = 4U;
|
||||
while (len != 0U) {
|
||||
if ((mmio_read_32(stm32_rng.base + RNG_SR) & RNG_SR_DRDY) == 0U) {
|
||||
break;
|
||||
}
|
||||
|
||||
data32 = mmio_read_32(stm32_rng.base + RNG_DR);
|
||||
count--;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue