mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-04 22:16:16 +00:00
The random number generator from ESP32 uses noise from Wi-Fi and Bluetooth radios. If these are off, a pseudo-random number is generated instead; this is currently the case, but even though it's a black box, it's arguably better than returning a timestamp as a pseudo-random number generator. According to the ESP32 Technical Reference manual, the RNG passed the Dieharder Random Number Test suite (version 3.31.1)[1], but nothing has been said about the quality of the PRNG. The RNG register is read directly; no effort is made to use its contents to feed an entropy pool in a way that's similar to /dev/random on POSIX systems, as no such subsystem exists on Zephyr at the moment. [1] http://webhome.phy.duke.edu/~rgb/General/dieharder.php Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
83 lines
2.2 KiB
Plaintext
83 lines
2.2 KiB
Plaintext
# Kconfig - random generator driver configuration options
|
|
|
|
#
|
|
# Copyright (c) 2014-2015 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
menuconfig RANDOM_GENERATOR
|
|
bool
|
|
prompt "Random Drivers"
|
|
default n
|
|
help
|
|
Include RANDOM drivers in system config.
|
|
|
|
if RANDOM_GENERATOR
|
|
|
|
source "drivers/random/Kconfig.mcux"
|
|
source "drivers/random/Kconfig.stm32"
|
|
|
|
source "drivers/random/Kconfig.esp32"
|
|
|
|
config RANDOM_HAS_DRIVER
|
|
bool
|
|
default n
|
|
help
|
|
This is an option to be enabled by individual random driver
|
|
to signal that there is a true random driver.
|
|
|
|
config RANDOM_NAME
|
|
string "Random Device Name"
|
|
depends on RANDOM_GENERATOR
|
|
default "RANDOM_0"
|
|
help
|
|
Specify the device name to be used for the RANDOM driver.
|
|
|
|
config SYS_LOG_RANDOM_LEVEL
|
|
int "Random Log level"
|
|
depends on SYS_LOG && RANDOM_GENERATOR
|
|
default 0
|
|
range 0 4
|
|
help
|
|
Sets log level for random driver.
|
|
Levels are:
|
|
- 0 OFF: do not write
|
|
- 1 ERROR: only write SYS_LOG_ERR
|
|
- 2 WARNING: write SYS_LOG_WRN in addition to previous level
|
|
- 3 INFO: write SYS_LOG_INF in addition to previous levels
|
|
- 4 DEBUG: write SYS_LOG_DBG in addition to previous levels
|
|
|
|
config TEST_RANDOM_GENERATOR
|
|
bool
|
|
prompt "Non-random number generator"
|
|
depends on RANDOM_GENERATOR && ! RANDOM_HAS_DRIVER
|
|
default n
|
|
help
|
|
This option signifies that the kernel's random number APIs are
|
|
permitted to return values that are not truly random.
|
|
This capability is provided for testing purposes, when a truly random
|
|
number generator is not available. The non-random number generator
|
|
should not be used in a production environment.
|
|
|
|
config X86_TSC_RANDOM_GENERATOR
|
|
bool
|
|
prompt "x86 timestamp counter based number generator"
|
|
depends on TEST_RANDOM_GENERATOR && X86
|
|
default y
|
|
help
|
|
This options enables number generator based on timestamp counter
|
|
of x86 boards, obtained with rdtsc instruction.
|
|
|
|
config TIMER_RANDOM_GENERATOR
|
|
bool
|
|
prompt "System timer clock based number generator"
|
|
depends on TEST_RANDOM_GENERATOR && !X86_TSC_RANDOM_GENERATOR
|
|
default y
|
|
help
|
|
This options enables number generator based on system timer
|
|
clock. This number generator is not random and used for
|
|
testing only.
|
|
|
|
endif
|