2019-04-06 09:08:09 -04:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2019-07-23 14:16:24 -05:00
|
|
|
if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR
|
2022-12-02 11:41:10 -06:00
|
|
|
CONFIG_RANDOM_TEST_GENERATOR OR
|
2021-07-25 17:45:10 +10:00
|
|
|
CONFIG_XOSHIRO_RANDOM_GENERATOR)
|
2019-07-23 14:16:24 -05:00
|
|
|
zephyr_library()
|
2020-06-04 11:00:45 -07:00
|
|
|
zephyr_library_sources_ifdef(CONFIG_USERSPACE rand32_handlers.c)
|
2019-07-23 14:16:24 -05:00
|
|
|
endif()
|
|
|
|
|
2022-12-14 05:30:26 +09:00
|
|
|
if (CONFIG_TIMER_RANDOM_GENERATOR)
|
2020-09-18 22:34:06 -07:00
|
|
|
message(WARNING "
|
2022-12-14 05:30:26 +09:00
|
|
|
Warning: CONFIG_TIMER_RANDOM_GENERATOR is not a truly random generator.
|
2020-09-18 22:34:06 -07:00
|
|
|
This capability is not secure and it is provided for testing purposes only.
|
|
|
|
Use it carefully.")
|
|
|
|
endif()
|
|
|
|
|
2021-07-25 19:00:50 +10: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.
|
|
|
|
zephyr_library_sources_ifdef(CONFIG_XOROSHIRO_RANDOM_GENERATOR rand32_xoshiro128.c)
|
2021-07-25 17:45:10 +10: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)
|
2022-12-02 11:41:10 -06:00
|
|
|
zephyr_library_sources_ifdef(CONFIG_RANDOM_TEST_GENERATOR rand32_test.c)
|
2019-07-23 14:16:24 -05: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()
|