openssl RAND_add() 文档参考 RFC1750。 RFC1750 对此事保持沉默
openssl RAND_add() documentation refers to RFC1750. RFC1750 is silent on the matter
openssl 库的 RAND_add
函数的文档中有关于熵参数的说明:
The entropy argument is (the lower bound of) an estimate of how much randomness is contained in buf, measured in bytes. Details about sources of randomness and how to estimate their entropy can be found in the literature, e.g. RFC 1750.
来源:http://linux.die.net/man/3/rand_add
可在此处找到 RFC 1750:https://www.rfc-editor.org/rfc/rfc1750.html
...但当然它对“熵”这个主题完全保持沉默(文本搜索显示该词在文档中出现次数为零)。
所以这是我的问题:
- 熵参数具体应该测量什么?
- 值的有效范围是多少(参数是double类型)?
非常感谢。
可能不用这个词,但是整个RFC都是关于熵的。它使用单词 'unpredictability' 代替。
What specifically is the entropy argument supposed to be a measurement of?
输入对于攻击者来说是多么不可预测。
What is the valid range of values (the argument is of type double)
该值应该是您预期攻击者需要猜测输入内容的猜测次数除以 8 的自然对数。这与输入包含的熵字节数基本相同。
根据您引用的“手册”页面:
http://linux.die.net/man/3/rand_add
RAND_seed() is equivalent to RAND_add() when num == entropy.
这里是关于“熵”论证的讨论:
https://www.mail-archive.com/openssl-dev@openssl.org/msg09806.html
Lutz Jaenicke wrote:
The entropy parameter should tell, how much "uncertainty" is in the
data provided.
If we choose a value of 0, we mean that there may be entropy in it, but
maybe an attacker can predict the value, so we use it but do not count
it as a really unpredictable input.
所以,如果我们知道每个字符(字节)的熵,那么正确的是什么
计算熵参数正确值的公式?
若熵为10%(压缩比1:10),则参数为“number
字节数 * 10%".
请再次注意,压缩比只是压缩比
消息中的信息量。如果我们不知道消息,它
或多或少相当于其中的熵(不可预测性)。如果
消息是已知的,熵(从加密点
视图)为零!因此,这是一个艰难的决定,最终
用压缩后的大小估计来自源的熵
是一种上限。
换句话说,如果您的缓冲区是“完全随机的”,则熵 == bufsize。
最后,rand_add() 手册页中引用的 RFC RFC 1750 已被 RFC 4086 取代:
openssl 库的 RAND_add
函数的文档中有关于熵参数的说明:
The entropy argument is (the lower bound of) an estimate of how much randomness is contained in buf, measured in bytes. Details about sources of randomness and how to estimate their entropy can be found in the literature, e.g. RFC 1750.
来源:http://linux.die.net/man/3/rand_add
可在此处找到 RFC 1750:https://www.rfc-editor.org/rfc/rfc1750.html
...但当然它对“熵”这个主题完全保持沉默(文本搜索显示该词在文档中出现次数为零)。
所以这是我的问题:
- 熵参数具体应该测量什么?
- 值的有效范围是多少(参数是double类型)?
非常感谢。
可能不用这个词,但是整个RFC都是关于熵的。它使用单词 'unpredictability' 代替。
What specifically is the entropy argument supposed to be a measurement of?
输入对于攻击者来说是多么不可预测。
What is the valid range of values (the argument is of type double)
该值应该是您预期攻击者需要猜测输入内容的猜测次数除以 8 的自然对数。这与输入包含的熵字节数基本相同。
根据您引用的“手册”页面:
http://linux.die.net/man/3/rand_add
RAND_seed() is equivalent to RAND_add() when num == entropy.
这里是关于“熵”论证的讨论:
https://www.mail-archive.com/openssl-dev@openssl.org/msg09806.html
Lutz Jaenicke wrote:
The entropy parameter should tell, how much "uncertainty" is in the data provided.
If we choose a value of 0, we mean that there may be entropy in it, but maybe an attacker can predict the value, so we use it but do not count it as a really unpredictable input.
所以,如果我们知道每个字符(字节)的熵,那么正确的是什么 计算熵参数正确值的公式?
若熵为10%(压缩比1:10),则参数为“number 字节数 * 10%".
请再次注意,压缩比只是压缩比 消息中的信息量。如果我们不知道消息,它 或多或少相当于其中的熵(不可预测性)。如果 消息是已知的,熵(从加密点 视图)为零!因此,这是一个艰难的决定,最终 用压缩后的大小估计来自源的熵 是一种上限。
换句话说,如果您的缓冲区是“完全随机的”,则熵 == bufsize。
最后,rand_add() 手册页中引用的 RFC RFC 1750 已被 RFC 4086 取代: