zephyr/subsys/random
Didrik Rokhaug 89f6e24590 rand: xoroshiro128: fix buffer overflow
If rand32_xoroshiro128::z_impl_sys_rand_get is called with outlen
not divisible by 4, it will overflow the dst buffer. This happens
because blocksize is not changed from 4 to the difference between
outlen and len. If outlen is < 4, z_impl_sys_rand_get will be stuck
in an infinite loop that keeps writing random bytes outside the buffer.
If outlen is > 4, z_impl_sys_rand_get returns after the correct number
of loops, but it writes every byte to the buffer, not just outlen number
of bytes. This causes the buffer to be overflowed with up to and
including 3 bytes.

Signed-off-by: Didrik Rokhaug <didrik.rokhaug@gmail.com>
2020-11-11 15:02:04 -06:00
..
CMakeLists.txt random: Warning when using test config 2020-10-02 11:30:03 +02:00
Kconfig kconfig: Random number generator 2020-08-24 10:24:30 +02:00
rand32_ctr_drbg.c random: rand32_ctr_drbg: Fix missed device constify change 2020-09-08 14:03:01 +02:00
rand32_entropy_device.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
rand32_handlers.c random: Add syscalls for random subsystem 2020-07-08 21:05:36 -04:00
rand32_timer.c code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
rand32_xoroshiro128.c rand: xoroshiro128: fix buffer overflow 2020-11-11 15:02:04 -06:00