Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp993560ybl; Tue, 28 Jan 2020 16:27:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwPMjNIHJ0ls0dJJYCYCbebuRPvZHEL1OHJLbDxUGeWFt/eeBQsHnmG37oCczsoaQPJTtYm X-Received: by 2002:a9d:5c1:: with SMTP id 59mr18710319otd.192.1580257631676; Tue, 28 Jan 2020 16:27:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580257631; cv=none; d=google.com; s=arc-20160816; b=wcE5v4Ka3lTb1LKZnq8N2NvQ6P7NG6TFGQ/K1s/J44PYJNE9bDWgq4+DapLfKQh3De zKCvyqqmeY2t9ckKaPR4hmNfY4MlRyWrON/WeU0jx4VM63gxCoDqHJ7aIj4sMP8fSe/o kaJsvcazqYGUYQqi4tO0Cu9jhd84+Qm1nHbYbKg4sDPT/UEh/+uRPcbOUaCWtIPY6VCo Gsbd/ygNqch+Pcj9dS3U5O1LwbBtLlnYqRqcfXaTB9APV6EqOe2r7KmW6SDBc5/xucsM Ja+oagzDhN3kLp4BbXmATKqpKRvAH2G6eLVZsFHuDkVrRHjnCrhQGiEtDhJYDnuSeUZb dvEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=w2C78p6Tp37fdKsluzt5pa6qj95UPC20o1A28ak7F9A=; b=l27qWxw6QHhZco/+uY6VbsxmqQRamX/IY/NNafGmwaTFHrilqinwrzdpMqlTftDWqY ktCVCSzXI4gFtf+dNrdAYNKCZuLabNfXAl+h1nKUb+Vh7U0EmOx/dohY1DwuAwlz6IhO wvFJycPbvMtGvWSc3/yYBGBD7nC0nZZc0Z0dOO0Yl9CGkpsVEYl152HqjnACIyP3lw+Q pcogwAhuk4wporjcLzexxv9Xr5MyyDIJckHpc7cF41WYMn6QuxlLAf6kaaI2cfTKkxJ0 xoTSkIt+RquMljb7QIxaigbwyQzYx28RDGqhtnk0UYYtFXjzEl2phsj2ZWHUQH23Ar4h xi9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@neuralgames.com header.s=default header.b=vshDoo2M; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l21si224699otd.1.2020.01.28.16.26.41; Tue, 28 Jan 2020 16:27:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=@neuralgames.com header.s=default header.b=vshDoo2M; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726340AbgA2A0h (ORCPT + 99 others); Tue, 28 Jan 2020 19:26:37 -0500 Received: from kross.rwserver.com ([69.13.37.146]:38592 "EHLO kross2019.rwserver.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726293AbgA2A0h (ORCPT ); Tue, 28 Jan 2020 19:26:37 -0500 Received: from localhost (localhost [127.0.0.1]) by kross2019.rwserver.com (Postfix) with ESMTP id 2BC1BB436A; Tue, 28 Jan 2020 18:26:36 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=neuralgames.com; h=user-agent:message-id:references:in-reply-to:subject:subject :from:from:date:date:content-transfer-encoding:content-type :content-type:mime-version; s=default; t=1580257595; x= 1582071996; bh=NcEq+8O19pWFogVE4XEPDEfmjtWbyS6YyD31VnkTQO8=; b=v shDoo2M3zBT1my+yjm4Pau0sd8OAbNDbgpfch12tec7ZmYgDa+4cTiX6/hLX8hNU CPEkkcDDCTmI1Orqsua+BVx0Et2Kq8zoIbzZIS41ZA4b33FciyBIay2Q99V/MMG5 GeybSomHbdtlGmEsh0YdnOyhGxoQdbdW2BMiWqUGGo= X-Virus-Scanned: Debian amavisd-new at kross2019.rwserver.com Received: from kross2019.rwserver.com ([127.0.0.1]) by localhost (kross2019.rwserver.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yl3H-oaJq5TK; Tue, 28 Jan 2020 18:26:35 -0600 (CST) Received: from rwserver.com (localhost [IPv6:::1]) (Authenticated sender: linux@neuralgames.com) by kross2019.rwserver.com (Postfix) with ESMTPA id 79B3BB4365; Tue, 28 Jan 2020 18:26:35 -0600 (CST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 28 Jan 2020 18:26:35 -0600 From: linux@neuralgames.com To: Andrew Jeffery Cc: Joel Stanley , Matt Mackall , Herbert Xu , Rob Herring , Mark Rutland , Linux Crypto Mailing List , devicetree , Linux ARM , linux-aspeed , Linux Kernel Mailing List Subject: Re: [PATCH 1/2] hwrng: Add support for ASPEED RNG In-Reply-To: References: <20200120150113.2565-1-linux@neuralgames.com> <4446ffb694c7742ca9492c7360856789@neuralgames.com> <575811fd-24ca-409c-8d33-c2152ee401d7@www.fastmail.com> <136bbab84d13d8d56a5ac297e415975e@neuralgames.com> Message-ID: <27c5505acd8d09f70ec9cd12982b2e3e@neuralgames.com> X-Sender: linux@neuralgames.com User-Agent: Roundcube Webmail/1.3.8 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2020-01-27 18:53, Andrew Jeffery wrote: > On Sat, 25 Jan 2020, at 11:40, linux@neuralgames.com wrote: >> On 2020-01-22 19:53, Andrew Jeffery wrote: >> >> Thanks for reviewing the patch. >> >> >> >> The RNG on Aspeed hardware allows eight different modes for combining >> >> its four internal Ring Oscillators that together generate a stream of >> >> random bits. However, the timeriomem-rng driver does not allow for >> >> mode >> >> selection so, the Aspeed RNG with this generic driver runs always on >> >> mode 'seven' (The default value for mode according to the AspeedTech >> >> datasheets). >> >> >> >> I've performed some testings on this Aspeed RNG using the NIST >> >> Statistical Test Suite (NIST 800-22r1a) and, the results I got show >> >> that >> >> the default mode 'seven' isn't producing the best entropy and linear >> >> rank when compared against the other modes available on these SOCs. >> >> On >> >> the other hand, the driver that I'm proposing here allows for mode >> >> selection which would help improve the random output for those looking >> >> to get the best out of this Aspeed RNG. >> > >> > Have you published the data and results of this study somewhere? This >> > really should be mentioned in the commit message as justification for >> > not using timeriomem-rng. >> > >> > Andrew >> >> Hi Andrew, >> >> I have uploaded the results of my tests to my GitHub, along with all >> the >> binaries >> containing the random bits that I collected from this Aspeed RNG using >> all 8 modes. >> You can also find in this repository a patch for the hw_random core >> driver that >> I've been using to collect this data. Here is the link: >> https://github.com/operezmuena/aspeed-rng-testing >> >> You can see in the reports that when using large enough samples (40Mb >> in >> size) >> this Aspeed RNG consistently fails the linear rank and entropy tests, >> no >> matter >> what RNG mode is selected. However, modes 2, 4 and 6 produce better >> entropy than >> the rest. >> I'm now collecting rng data from 2 other AST2520 SOCs that I have in >> order to >> compare results. > > Nice work. Eyeballing the summaries, it seems mode 6 or mode 4 may be > improvements over 7? What's your analysis? It would be nice to have the > data from your other two SoCs to corroborate. Again, going forward, > please > point to your measurements in your commit message. > Hi Andrew, I pushed to my GitHub repository the RNG dumps and NIST reports from the other 2 SOCs. The results are similar to the first SOC. None of the modes passed the NIST test for linear rank and approximate entropy. Also, these SOCs show that mode 6 produces better results than mode 7. However, having only a sample of 3 SOCs isn't going to give us statistical significance about which mode would be the best one on these SOCs but, it is hinting us that perhaps allowing the selection of other RNG modes would be a good feature to have in a driver. Now, I must say that this is the first RO-based RNG that I have tested and I'm a bit concerned about the results I've been getting. I'm now wondering how RNGs from other SOC vendors would perform with this same test suite. > Not that I've looked, but is it feasible to augment timeriomem-rng with > the ability to configure the RNG rather than implement a new driver? > Why > didn't you go that route? > > Andrew I decided to wrote the Aspeed-RNG driver because was under the impression that the community would prefer dedicated drivers over generic ones for these SOCs. However, enhancing timeriomem-rng module is not hard at all. As I matter of fact, I'm currently testing changes to timeriomem-rng and so far so good. If you would like to have a quick look to my changes, I just pushed patches to the same repo a couple of hours ago: https://github.com/operezmuena/aspeed-rng-testing/tree/master/patches Thanks Oscar