Part 1
요약·해설
Hardware RNG가 없으면 CTR-DRBG를 사용하고 충분한 entropy와 personalization을 공급해야 합니다.
Timer · Xoshiro
Hardware RNG · CTR-DRBG
Entropy required
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
4C431BA435DD2CE35B4CE85D8F10C577075D648BCB760E6E9964A6993612F75A
.. _random_api:
Random Number Generation
########################
The random API subsystem provides random number generation APIs in both
cryptographically and non-cryptographically secure instances. Which
random API to use is based on the cryptographic requirements of the
random number. The non-cryptographic APIs will return random values
much faster if non-cryptographic values are needed.
The cryptographically secure random functions shall be compliant to the
FIPS 140-2 [NIST02]_ recommended algorithms. Hardware based random-number
generators (RNG) can be used on platforms with appropriate hardware support.
Platforms without hardware RNG support shall use the `CTR-DRBG algorithm
<https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf>`_.
The algorithm can be provided by `TinyCrypt <https://01.org/tinycrypt>`_
or `mbedTLS <https://tls.mbed.org/ctr-drbg-source-code>`_ depending on
your application performance and resource requirements.
.. note::
The CTR-DRBG generator needs an entropy source to establish and
maintain the cryptographic security of the PRNG.
.. _random_kconfig:
Kconfig Options
***************
These options can be found in the following path :zephyr_file:`subsys/random/Kconfig`.
:kconfig:option:`CONFIG_TEST_RANDOM_GENERATOR`
For testing, this option allows a non-random number generator to be used and
permits random number APIs to return values that are not truly random.
The random number generator choice group allows selection of the RNG
source function for the system via the RNG_GENERATOR_CHOICE choice group.
An override of the default value can be specified in the SOC or board
.defconfig file by using:
.. code-block:: none
choice RNG_GENERATOR_CHOICE
default XOSHIRO_RANDOM_GENERATOR
endchoice
The random number generators available include:
:kconfig:option:`CONFIG_TIMER_RANDOM_GENERATOR`
enables number generator based on system timer clock. This number
generator is not random and used for testing only.
:kconfig:option:`CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR`
enables a random number generator that uses the enabled hardware
entropy gathering driver to generate random numbers.
:kconfig:option:`CONFIG_XOSHIRO_RANDOM_GENERATOR`
enables the Xoshiro128++ pseudo-random number generator, that uses the
entropy driver as a seed source.
The CSPRNG_GENERATOR_CHOICE choice group provides selection of the
cryptographically secure random number generator source function. An
override of the default value can be specified in the SOC or board
.defconfig file by using:
.. code-block:: none
choice CSPRNG_GENERATOR_CHOICE
default CTR_DRBG_CSPRNG_GENERATOR
endchoice
The cryptographically secure random number generators available include:
:kconfig:option:`CONFIG_HARDWARE_DEVICE_CS_GENERATOR`
enables a cryptographically secure random number generator using the
hardware random generator driver
:kconfig:option:`CONFIG_CTR_DRBG_CSPRNG_GENERATOR`
enables the CTR-DRBG pseudo-random number generator. The CTR-DRBG is
a FIPS140-2 recommended cryptographically secure random number generator.
Personalization data can be provided in addition to the entropy source
to make the initialization of the CTR-DRBG as unique as possible.
:kconfig:option:`CONFIG_CS_CTR_DRBG_PERSONALIZATION`
CTR-DRBG Initialization Personalization string
API Reference
*************
.. doxygengroup:: random_api
Part 3
한국어 전문 번역
Random API subsystem은 cryptographically secure한 API와 secure하지 않은 API를 모두 제공합니다. 어떤 API를 쓸지는 random number의 cryptographic requirement에 따라 결정합니다. Cryptographic security가 필요 없다면 non-cryptographic API가 훨씬 빠르게 값을 반환합니다.
Cryptographically secure random function은 FIPS 140-2 권고 algorithm을 준수해야 합니다. 알맞은 hardware가 있는 platform은 hardware RNG를 사용할 수 있습니다. Hardware RNG가 없는 platform은 CTR-DRBG algorithm을 사용해야 합니다. Application performance와 resource requirement에 따라 TinyCrypt 또는 mbedTLS가 algorithm을 제공할 수 있습니다.
Kconfig option
이 option은 subsys/random/Kconfig에서 찾을 수 있습니다.
CONFIG_TEST_RANDOM_GENERATOR- Test를 위해 non-random generator를 사용하고 random API가 실제로 random하지 않은 값을 반환하도록 허용합니다.
RNG_GENERATOR_CHOICE choice group으로 system의 일반 RNG source function을 선택합니다. SoC나 board .defconfig에서 다음처럼 default를 override할 수 있습니다.
choice RNG_GENERATOR_CHOICE
default XOSHIRO_RANDOM_GENERATOR
endchoice
사용 가능한 일반 random number generator는 다음과 같습니다.
CONFIG_TIMER_RANDOM_GENERATOR- System timer clock 기반 generator를 enable합니다. 실제 random generator가 아니며 test 전용입니다.
CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR- Enable된 hardware entropy-gathering driver로 random number를 생성합니다.
CONFIG_XOSHIRO_RANDOM_GENERATOR- Entropy driver를 seed source로 사용하는 Xoshiro128++ pseudo-random number generator를 enable합니다.
CSPRNG_GENERATOR_CHOICE choice group은 cryptographically secure random number generator source function을 선택합니다. SoC나 board .defconfig에서 다음처럼 default를 override할 수 있습니다.
choice CSPRNG_GENERATOR_CHOICE
default CTR_DRBG_CSPRNG_GENERATOR
endchoice
사용 가능한 cryptographically secure generator는 다음과 같습니다.
CONFIG_HARDWARE_DEVICE_CS_GENERATOR- Hardware random generator driver를 사용하는 CSPRNG를 enable합니다.
CONFIG_CTR_DRBG_CSPRNG_GENERATOR- CTR-DRBG pseudo-random number generator를 enable합니다. CTR-DRBG는 FIPS 140-2가 권고하는 cryptographically secure random number generator입니다.
CTR-DRBG initialization을 가능한 한 고유하게 만들기 위해 entropy source 외에 personalization data를 제공할 수 있습니다.
CONFIG_CS_CTR_DRBG_PERSONALIZATION- CTR-DRBG initialization personalization string입니다.
API Reference
원문의 Doxygen group random_api에는 일반 random byte와 cryptographically secure random byte를 얻는 공개 API가 수록됩니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.