linux熵池添加,使用RNDADDENTROPY将熵添加到/ dev/random

我有一个设备会产生一些噪音,我想将它添加到嵌入式Linux系统中/ dev/random设备的熵池中.

我正在阅读/ 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零尺寸阵列?我该如何为它分配一个值?

感谢您的帮助!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值