匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“Hardware random overview”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
Hardware random overview
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
==Article Purpose== This article gives information about the hardware random (HWRNG) framework. ==Framework purpose== The Hardware random framework is integrated in the kernel. It provides access to RNG peripherals and focuses on supporting the hardware number generator. ==System overview== The HW random framework allows retrieving random numbers in userland. [[File:hwrngapi.png|thumb|center|766px|link=|alt=Alternate text|Hw Random]] ===Component description=== * '''HW random core''' (Kernel space) <br> Generic interface in kernel space. This layer is in charge of creating the character device (char device) and sysfs to access hw_random. * '''RNG''' (Kernel space) Hardware random Linux<sup>®</sup> drivers handling the HW blocks. * '''RNG''' (Hardware) HW blocks handling the RNG peripheral. ===API description=== The Hardware random framework uses char device API<ref>https://bootlin.com/doc/legacy/accessing-hardware/accessing-hardware.pdf</ref> ioctl operations. For additional information, refer to: * sysfs interface. * Kernel Documentation directory<ref>{{CodeSource | Linux kernel | Documentation/hw_random.txt}}</ref> ==Configuration== ===Kernel configuration=== The Hardware random support is activated by default in ST deliveries. No specific configuration is required apart from enabling or disabling peripheral support using Linux<sup>®</sup> Menuconfig tool. Refer to [[Menuconfig or how to configure kernel | Menuconfig or how to configure kernel ]] and select: <pre> [*] Device Drivers ---> [*] Character devices ---> [*] Hardware Random Number Generator Core support ---> [*] STMicroelectronics STM32 random number generator </pre> ===Device tree configuration=== DT configuration can be done thanks to the [[STM32CubeMX]]. A detailed device tree configuration is described in [[RNG device tree configuration]]. == How to use the framework == The framework provides external interfaces from userland : [[How_to_control_a_RNG_in_userspace|How to control RNG]]. === How to use from char device === The community tool for using Hardware random framework is rng_tools<ref name=rngtools>[https://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git/ Rng_tools source code]</ref> which provides a complete set of utilities related to random number generators: * '''rngd''': runs a background daemon that opens /dev/hwrng file (default) to connect and retrieve random numbers. * '''rngtest''': runs different tests that check the entropy and verify the compliance regarding FIPS 140-2 standard. === How to use from sysfs === Available devices compatible with Hardware framework can be listed using sysfs commands: {{Board$}} cat /sys/class/misc/hw_random/rng_available '''stm32-rng''' The selected device is shown here: {{Board$}} cat /sys/class/misc/hw_random/rng_current '''stm32-rng''' To select a different device: {{Board$}} echo "stm32-rng"> /sys/class/misc/hw_random/rng_current ==How to trace and debug the framework== Light information on the framework can be accessed by using [[#How_to_use_from_sysfs|sysfs]]. By default, the framework does not provide any specific debug output or dynamic debugging tool. ==Source code location== Hardware random drivers and framework are available here<ref>{{CodeSource | Linux kernel | drivers/char/hw_random}}, Hw_random sources</ref>. ==To go further== Code examples are directly available from rng-tools<ref name=rngtools/> github. ==References== <references /> <noinclude> {{ArticleBasedOnModel | Framework overview article model}} {{PublicationRequestId | 9410 | 2018-10-24 | AnneJ}} [[Category:Security]] </noinclude>
该页面使用的模板:
模板:ArticleBasedOnModel
(
查看源代码
)
模板:Board$
(
查看源代码
)
模板:CodeSource
(
查看源代码
)
模板:PublicationRequestId
(
查看源代码
)
返回至
Hardware random overview
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志