From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web12.4452.1573856372314220219 for ; Fri, 15 Nov 2019 14:19:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UE6NcitI; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573856371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OunMWZzqmDM2T0XGKc6w+SHU9BsbZ2xNUTKELTtO1dI=; b=UE6NcitIugo9qCiBH0FgsEbc+Akk4XsMtdAB8SUW+naABsAz81Migca2wiJgcP2RboD057 riXmOcBj5ZrOwGM1N6E/+BJ7/rq3CnUjxMoAnZBZbNAvc2zl9DizGh6Prj0NSDFD0dBL7b m96/ZavWrr8EFo5H0cl4sHvU0oelzJo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-nujFHZTcMpu8cz6KACmhFA-1; Fri, 15 Nov 2019 17:19:28 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91D69107ACC5; Fri, 15 Nov 2019 22:19:26 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-75.ams2.redhat.com [10.36.116.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 671DD608D2; Fri, 15 Nov 2019 22:19:24 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 05/11] SecurityPkg/RngLibRdSeed: add an instance of RngLib to make use rdseed To: devel@edk2.groups.io, ard.biesheuvel@linaro.org, Jian J Wang Cc: "Kinney, Michael D" , "Yao, Jiewen" , "Zhang, Chao B" , "Gao, Liming" , "Ni, Ray" References: <20191114021743.3876-1-jian.j.wang@intel.com> <20191114021743.3876-6-jian.j.wang@intel.com> From: "Laszlo Ersek" Message-ID: <8b91661f-35e5-5333-cf7e-6403b730b617@redhat.com> Date: Fri, 15 Nov 2019 23:19:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: nujFHZTcMpu8cz6KACmhFA-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/15/19 14:28, Ard Biesheuvel wrote: > On Thu, 14 Nov 2019 at 04:39, Wang, Jian J wrote: >> >> Mike, >> >> I figured that rdseed is only needed in cases demanding highest entropy, >> like seeding other pseudo-RNG. It's not for general purpose randomness. >> Then I put it in SecurityPkg. But I'm ok to put it into MdePkg. I have n= o >> strong opinion for this. >> >=20 > I think it is a bad idea to use the same library abstraction [RngLib] > for exposing > a) entropy sources used for seeding deterministic random number generator= s > b) deterministic random number generators themselves > c) low entropy pseudo-RNGs based on timestamp counters, etc >=20 > given that the use cases don't usually overlap. I.e., only a DRBG > implementation requires a), and exports RngLib itself based on that. > Use cases that can tolerate c) [like IV generators for block > encryption] are typically disjoint from ones that require b) [for key > generation]. The idea that you can use RngLib for all of them, and > plug arbitrary instantiations of it into each is misguided IMHO. Thank you for this awesome explanation! Laszlo