我有一个设备会产生一些噪音,我想将这些噪音添加到嵌入式 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
零大小的数组?我应该如何为它赋值?
感谢您在这里的任何帮助!