random: deprecate XOROSHIRO_RANDOM_GENERATOR
Deprecate the xoroshiro128+ PRNG algorithm in favour of xoshiro128++. xoshiro128++ is a drop-in replacement which is invisible from the user perspective. xoroshiro128+ is unsuitable because it is explicitly a floating-point PRNG, not a general-purpose PRNG. This means that the lower 4 bits of the output are actually linear, not random (from the designers, https://prng.di.unimi.it/). This means 1/8th of the generated data is not random. Additionally, xoroshiro128+ is not a 32bit algorithm, it operates on 64bit numbers. For the vast majority of Zephyr devices, this makes the PRNG slower than it needs to be. The replacement (xoshiro128++) is 32bit, with no loss in state space (still 128 bit). Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
3a204adf7b
commit
fdeaa9103e
9 changed files with 15 additions and 149 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR
|
||||
CONFIG_TIMER_RANDOM_GENERATOR OR
|
||||
CONFIG_XOROSHIRO_RANDOM_GENERATOR OR
|
||||
CONFIG_XOSHIRO_RANDOM_GENERATOR)
|
||||
zephyr_library()
|
||||
zephyr_library_sources_ifdef(CONFIG_USERSPACE rand32_handlers.c)
|
||||
|
@ -15,8 +14,11 @@ if (CONFIG_TEST_RANDOM_GENERATOR)
|
|||
Use it carefully.")
|
||||
endif()
|
||||
|
||||
# XOROSHIRO builds the XOSHIRO implementation because a Kconfig choice cannot
|
||||
# select another choice as a means of deprecating the symbol. Swapping out the
|
||||
# implementation lets out-of-tree users still build until the symbol is removed.
|
||||
zephyr_library_sources_ifdef(CONFIG_TIMER_RANDOM_GENERATOR rand32_timer.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_XOROSHIRO_RANDOM_GENERATOR rand32_xoroshiro128.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_XOROSHIRO_RANDOM_GENERATOR rand32_xoshiro128.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_XOSHIRO_RANDOM_GENERATOR rand32_xoshiro128.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CTR_DRBG_CSPRNG_GENERATOR rand32_ctr_drbg.c)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue