Double makes sense.  Entropy is often estimated as a real value.

E.g. we have the aforementioned coin flipper feeding data serially.
Adding each bit sequentially means 0.125 bytes of entropy per call.

Not the best example....

Pauli
-- 
Oracle
Dr Paul Dale | Cryptographer | Network Security & Encryption 
Phone +61 7 3031 7217
Oracle Australia


-----Original Message-----
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Wednesday, 22 May 2019 12:15 AM
To: openssl-us...@openssl.org
Cc: Jian J Wang <jian.j.w...@intel.com>; edk2-devel-groups-io 
<devel@edk2.groups.io>; Lu, XiaoyuX <xiaoyux...@intel.com>; Ard Biesheuvel 
<ard.biesheu...@linaro.org>
Subject: why does RAND_add() take "randomness" as a "double"?

(resending, with my subscription to <openssl-us...@openssl.org> completed)

Hi OpenSSL Developers,

(cross-posting <openssl-us...@openssl.org> and <devel@edk2.groups.io>,)

OpenSSL commit [1] changed the representation of the "entropy amount" -- later 
renamed to "randomess" in [2] -- from "int" to "double". I've read the commit 
message:

commit 853f757ecea74a271a7c5cdee3f3b5fe0d3ae863
Author: Bodo Möller <b...@openssl.org>
Date:   Sat Feb 19 15:22:53 2000 +0000

    Allow for higher granularity of entropy estimates by using 'double'
    instead of 'unsigned' counters.
    Seed PRNG in MacOS/GetHTTPS.src/GetHTTPS.cpp.

    Partially submitted by Yoram Meroz <yo...@mail.idrive.com>.

and also checked "MacOS/GetHTTPS.src/GetHTTPS.cpp" at the same commit.
But, I'm none the wiser.

Can someone please explain what is gained by using a floating point type here?

Is it really a relevant use case that entropy is fed from an external source to 
OpenSSL such that truncating the amount to a whole number of bits would cause 
significant lossage? (Admittedly, it could be relevant if the individual 
randomness bit counts were in the (0, 1) interval, both boundaries exclusive.)

Using floating point for randomness representation is a problem for 
environments that prefer to avoid floating point altogether, such as
edk2 ("UEFI") firmware

Thanks,
Laszlo

[1] https://github.com/openssl/openssl/commit/853f757ecea7
[2] https://github.com/openssl/openssl/commit/f367ac2b2664

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41218): https://edk2.groups.io/g/devel/message/41218
Mute This Topic: https://groups.io/mt/31696120/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to