2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2019-07-24 03:16:24 +08:00
|
|
|
if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR
|
|
|
|
CONFIG_TIMER_RANDOM_GENERATOR OR
|
2021-07-25 15:45:10 +08:00
|
|
|
CONFIG_XOSHIRO_RANDOM_GENERATOR)
|
2019-07-24 03:16:24 +08:00
|
|
|
zephyr_library()
|
2020-06-05 02:00:45 +08:00
|
|
|
zephyr_library_sources_ifdef(CONFIG_USERSPACE rand32_handlers.c)
|
2019-07-24 03:16:24 +08:00
|
|
|
endif()
|
|
|
|
|
2020-09-19 13:34:06 +08:00
|
|
|
if (CONFIG_TEST_RANDOM_GENERATOR)
|
|
|
|
message(WARNING "
|
|
|
|
Warning: CONFIG_TEST_RANDOM_GENERATOR is not a truly random generator.
|
|
|
|
This capability is not secure and it is provided for testing purposes only.
|
|
|
|
Use it carefully.")
|
|
|
|
endif()
|
|
|
|
|
2021-07-25 17:00:50 +08:00
|
|
|
# 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.
|
2019-07-24 03:16:24 +08:00
|
|
|
zephyr_library_sources_ifdef(CONFIG_TIMER_RANDOM_GENERATOR rand32_timer.c)
|
2021-07-25 17:00:50 +08:00
|
|
|
zephyr_library_sources_ifdef(CONFIG_XOROSHIRO_RANDOM_GENERATOR rand32_xoshiro128.c)
|
2021-07-25 15:45:10 +08:00
|
|
|
zephyr_library_sources_ifdef(CONFIG_XOSHIRO_RANDOM_GENERATOR rand32_xoshiro128.c)
|
|
|
|
zephyr_library_sources_ifdef(CONFIG_CTR_DRBG_CSPRNG_GENERATOR rand32_ctr_drbg.c)
|
2019-07-24 03:16:24 +08:00
|
|
|
|
|
|
|
if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR CONFIG_HARDWARE_DEVICE_CS_GENERATOR)
|
|
|
|
zephyr_library_sources(rand32_entropy_device.c)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (CONFIG_CTR_DRBG_CSPRNG_GENERATOR)
|
|
|
|
zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)
|
|
|
|
endif()
|