From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=utmO5u5B; spf=pass (domain: oracle.com, ip: 141.146.126.79, mailfrom: paul.dale@oracle.com) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by groups.io with SMTP; Tue, 21 May 2019 18:48:23 -0700 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4M1iF5L021556; Wed, 22 May 2019 01:48:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=1+8T1R6CnkHaeLeTYuck8Zv4ny7Paf/2SRDCRi2vi7c=; b=utmO5u5BLqyV+kLetbvWdAVLAqEkosRnajQBeMjSlhKtB88PM+n1a9iSEYZ6SdEPH6pO DNvtkuNfoGegr/gQ+KpKcMjz4i7ahSH0M7xf0NLOKd2HFwyYPAT6TsfpFBpcYGu3FrsY CsFfPnmgAbqpXa+9Vq0ZV3/5mZn7RsPmmjG3A9iajvmMm9olU/QcA1SCV6IRKIBARn4m pLYDMiqZMbiCRyOaJjwoUh6XBpvwgDc8rOToozuR8ESt9AIjgFAN8iWvSwnSut0qMrQc FMW6drFA/HHj41K+hITyY20Lo4DPdWXL1HmxpYjLapXS7EHonXfH9jPNOmtu5I8/9h5I /Q== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 2smsk58nfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 May 2019 01:48:22 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4M1lhRI090708; Wed, 22 May 2019 01:48:21 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2smsheafbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 May 2019 01:48:21 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x4M1mJT4018470; Wed, 22 May 2019 01:48:20 GMT MIME-Version: 1.0 Message-ID: <06ce80d4-02da-4323-af3b-0d0f8be3f6eb@default> Date: Wed, 22 May 2019 01:48:14 +0000 (UTC) From: Paul Dale Sender: Paul Dale To: Laszlo Ersek , openssl-users@openssl.org Cc: Jian J Wang , edk2-devel-groups-io , "Lu, XiaoyuX" , Ard Biesheuvel Subject: Re: why does RAND_add() take "randomness" as a "double"? References: <6c4a456a-3198-bfa2-6d89-433e4d3f3fd5@redhat.com> In-Reply-To: <6c4a456a-3198-bfa2-6d89-433e4d3f3fd5@redhat.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 15.0.5137.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9264 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905220010 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9264 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905220010 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 --=20 Oracle Dr Paul Dale | Cryptographer | Network Security & Encryption=20 Phone +61 7 3031 7217 Oracle Australia -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com]=20 Sent: Wednesday, 22 May 2019 12:15 AM To: openssl-users@openssl.org Cc: Jian J Wang ; edk2-devel-groups-io ; Lu, XiaoyuX ; Ard Biesheuvel Subject: why does RAND_add() take "randomness" as a "double"? (resending, with my subscription to completed) Hi OpenSSL Developers, (cross-posting and ,) OpenSSL commit [1] changed the representation of the "entropy amount" -- la= ter renamed to "randomess" in [2] -- from "int" to "double". I've read the = commit message: commit 853f757ecea74a271a7c5cdee3f3b5fe0d3ae863 Author: Bodo M=C3=B6ller 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 . 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 he= re? Is it really a relevant use case that entropy is fed from an external sourc= e to OpenSSL such that truncating the amount to a whole number of bits woul= d cause significant lossage? (Admittedly, it could be relevant if the indiv= idual randomness bit counts were in the (0, 1) interval, both boundaries ex= clusive.) Using floating point for randomness representation is a problem for environ= ments 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