1# SPDX-License-Identifier: Apache-2.0
2
3if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR
4    CONFIG_TIMER_RANDOM_GENERATOR OR
5    CONFIG_XOSHIRO_RANDOM_GENERATOR)
6zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/random/random.h)
7zephyr_library()
8zephyr_library_sources_ifdef(CONFIG_USERSPACE           random_handlers.c)
9endif()
10
11if (CONFIG_TIMER_RANDOM_GENERATOR OR CONFIG_TEST_CSPRNG_GENERATOR)
12  message(WARNING "
13    Warning: CONFIG_TIMER_RANDOM_GENERATOR and CONFIG_TEST_CSPRNG_GENERATOR are
14    not truly random generators. This capability is not secure and it is
15    provided for testing purposes only. Use it carefully.")
16endif()
17
18zephyr_library_sources_ifdef(CONFIG_TIMER_RANDOM_GENERATOR          random_timer.c)
19zephyr_library_sources_ifdef(CONFIG_XOSHIRO_RANDOM_GENERATOR        random_xoshiro128.c)
20zephyr_library_sources_ifdef(CONFIG_CTR_DRBG_CSPRNG_GENERATOR       random_ctr_drbg.c)
21zephyr_library_sources_ifdef(CONFIG_TEST_CSPRNG_GENERATOR           random_test_csprng.c)
22
23if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR CONFIG_HARDWARE_DEVICE_CS_GENERATOR)
24zephyr_library_sources(random_entropy_device.c)
25endif()
26
27if (CONFIG_CTR_DRBG_CSPRNG_GENERATOR)
28zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)
29endif()
30