c – 使用RNDADDENTROPY将熵添加到/ dev / random
我有一个设备会产生一些噪音,我想将它添加到嵌入式
Linux系统中/ dev / random设备的熵池中.
我正在阅读man page on /dev/random并且我不太了解您传递给RNDADDENTROPY ioctl调用的结构. RNDADDENTROPY Add some additional entropy to the input pool,incrementing the entropy count. This differs from writing to /dev/random or /dev/urandom,which only adds some data but does not increment the entropy count. The following structure is used: struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; }; Here entropy_count is the value added to (or subtracted from) the entropy count,and buf is the buffer of size buf_size which gets added to the entropy pool. 这个结构中的entropy_count是我添加的位数吗?为什么这不总是buf_size * 8(假设buf_size是以字节为单位)? 另外为什么buf是零大小的数组?我该如何为它分配一个值? 感谢您的帮助! 解决方法
我正在使用硬件RNG来存储我的熵池.我的结构是静态大小
看起来像这样(我的内核有一个稍微不同的random.h;只是复制什么 你找到你的,并将数组大小增加到你想要的任何东西): #define BUFSIZE 256 /* WARNING - this struct must match random.h's struct rand_pool_info */ typedef struct { int bit_count; /* number of bits of entropy in data */ int byte_count; /* number of bytes of data in array */ unsigned char buf[BUFSIZ]; } entropy_t; 无论你在buf中传递什么都将被哈希并将搅动熵池. bit_count的作用是推动/ dev / random将阻塞的点 您可以根据熵源的“质量”进行猜测.如果它很低,就像人类输入的字符一样,你可以将它设置为1或2每字节.如果它很高,就像从专用硬件RNG读取的值,您可以将其设置为每字节8位. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 根据硬件配置后mapred-site.xml和yarn-site.xml
- c# – 检查服务器是否可通过IPv6访问?
- flex 把datagrid的内容导出到Excel
- ruby-on-rails – Rails 3.2.11中带有模型子目录的单表继承
- iphone – 如何在以后删除孩子? (cocos2d的)
- Qt模块化笔记之core——QXmlStreamWriter写XML
- ruby-on-rails – twitter-bootstrap-rails gem工作流程
- C++ cout格式化输出(输出格式)完全攻略
- .net – XML省略号/其他语法 – 它叫什么?
- Symfony2.x EasyUI Ajax 异步加载DataGrid 分页