Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp743781imm; Fri, 29 Jun 2018 05:48:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdjSnUsIa7Me1dkhHUunUhUYFblenjmoOh7VOeXzzAVK9uS9ms8m4AcVLaB969TrUPWbtnN X-Received: by 2002:a62:904c:: with SMTP id a73-v6mr14419545pfe.145.1530276518491; Fri, 29 Jun 2018 05:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530276518; cv=none; d=google.com; s=arc-20160816; b=iGIacGWgL7WzHqupckJxVOcRw6AsSryMI/DcVlKzsvdPs85y55a7RL34hQRjqKz4Od 3Zr+7y5CY4uC2qcODSI79VE7sfK7D3TtiJeKTmoZsJ10mu/d/wocrIt3Q+eRj3b3Etpy bOO5cdDZgVZKLd5DBD3uGrSi0VwlqzeWqm83qevBF/YoRBWY10lzute1og3iwNeXbj7d IkXUw5n++Zr46M0imSaiWXAIItTJxQ24JdIW7xTVSkSg7GX+xrDQBMGbQvHzrgwFSUH+ XATlQIpDTIPZUxE2Ek9QX43bmmbfb3M6KIcyak35SidWCKG2MnA2q4fzbMmpQSiY853l 8eMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=yN7zrrtyP+lOBDmKThewktu/sVXsQSsf6XR8OUfrg7w=; b=AtQgbYPFjU3TqlcPlgS0ZQvHEAQKV+J0ZZsP/04MXkrNl6x6Z+0Fes0Yms+eyXSJIv X4zkY/rtkxGZpFQmGFFO1UJrEZNEuGUCUqaznPu6/hB0EbjQ7trVTDfDADzH+XG0+4aP GggtxaY9mfyj8y6cUd6VU6o1eZj4CRDIzkGJOPF/fHrwu+N4u093dl50oCKLkbYiJIlz gKmDB1hPQZjlejgfwFSIrrTNgtWYvxFQeiB3Ii/24uaEvg23GxLC0irzM5vXj/tiElZw wJzb4cia4LzRS3deJ25gdeGUtWALotSyVrFdPEX0OFnLR8H4Pe8CbPKbJA/SCNAkuTlL 4kxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yPq7mQyy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15-v6si8943962plq.180.2018.06.29.05.48.24; Fri, 29 Jun 2018 05:48:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yPq7mQyy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965296AbeF2Iht (ORCPT + 99 others); Fri, 29 Jun 2018 04:37:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:50468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965245AbeF2Ihq (ORCPT ); Fri, 29 Jun 2018 04:37:46 -0400 Received: from localhost (unknown [122.167.66.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5322122451; Fri, 29 Jun 2018 08:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530261466; bh=lktdXRbnjeE+COp7Q8uWvwlE3wLVf0XHUYlu6i5q460=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yPq7mQyy21BjPSYXQ25HsmK5wsLrGllRCq7nRimxRbsTvUBowbwFxwI/osfelvq46 PR3apEffv77w4Y+9tb8geyFO7uZLaHbaZmKE5ykeRQmM3aqR14JWDvrlsK2tIW5bdt nInE2TVMQqFLaS2PxSTAQ86XsWigSn/knKONNltg= Date: Fri, 29 Jun 2018 14:07:32 +0530 From: Vinod To: Timur Tabi , Herbert Xu Cc: Stanimir Varbanov , linux-crypto@vger.kernel.org, lkml , Matt Mackall , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 3/3] hwrng: msm - Add support for prng v2 Message-ID: <20180629083732.GB22377@vkoul-mobl> References: <20180618141259.23141-1-vkoul@kernel.org> <20180618141259.23141-4-vkoul@kernel.org> <20180619142853.wgi5easw4zv6ttrb@gondor.apana.org.au> <966e9cd4-70a3-8d54-df0f-16df3df45fb5@linaro.org> <20180621101506.rnklbtapvfdev4xb@gondor.apana.org.au> <20180621115312.rfmbitrhqi44wu5w@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28-06-18, 17:04, Timur Tabi wrote: > On Thu, Jun 21, 2018 at 6:53 AM, Herbert Xu wrote: > > On Thu, Jun 21, 2018 at 02:27:10PM +0300, Stanimir Varbanov wrote: > > > So does it generate one bit of output for each bit of hardware- > > generated entropy like /dev/random? Or does it use a hardware- > > generated seed to power a PRNG? > > I have some information to answer this question, although I'm not sure > I can give a strict "yes/no" answer. > > There are a couple relevant documents: > > https://www.qualcomm.com/news/onq/2014/11/07/cryptographic-module-snapdragon-805-fips-140-2-certified > https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2944.pdf > > I also got response from a Qualcomm employee: > > "The Qualcomm random number generator used in Snapdragon chips > consists of an entropy source coupled with the HASH-DRBG deterministic > random bit generator from NIST Special Publication 800-90A, using > SHA-256 as the hash function. > > The entropy source is based on sampled ring oscillators. Four ring > oscillators are used to provide high assurance of adequate entropy. > The entropy from the ring oscillators is conditioned using the > 'derivation function' specified by NIST Special Publication 800-90A. > The conditioned entropy is essentially perfect fully entropic data. > It is used both to seed and to periodically reseed the DRGB." > > My understanding is that the PRNG is a real entropy source with some > logic used to normalize the values. To quote: "No RNG uses data > directly from the entropy source; bits in the output are likely > correlated and unlikely to occur with 50% probability. The entropy > post-processing is designed to turn dirty data in clean data." > > Based on the above, it seems to me that the Qualcomm PRNG qualifies as > a real hardware RNG and porting to algif_rng is not the correct path. I think Stan did bring this point earlier that PRNG is compliant to FIPS-140-2. So it can be used by rng clients for various purposes but should not be fed to dev/random as the hw_random does. Herbert, can you please confirm.. -- ~Vinod