Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1283899ybg; Fri, 18 Oct 2019 15:12:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2fPSNmC5RVJDttFFzoz0z4oW0O10JmzL7FRJPVPojgX8OEZ974bzJYNb0XBiu5eGImR1/ X-Received: by 2002:a05:6402:70c:: with SMTP id w12mr12120542edx.177.1571436728186; Fri, 18 Oct 2019 15:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571436728; cv=none; d=google.com; s=arc-20160816; b=cZffIxiLpaOKQE3I1f3RwfKELm0EZVj5CPzKf+2/dAsBJ2FTvWftD7DSlttfAeFy3Y qSehp3fYIqp9k+C3oI4SViHQyOyTKJCYrHxx0iBgr4Wh65HdmxjwNyByyPom3YB8qbVr Rm3JMc4XE8jwICvJSOnT9dz8JzqlMEc5T7CRxykzRJxa1mODtEH7sQjFQo2alyVt3XsZ N2+KjxQGw4sC19UacqGwD5bOxmIh/2nP3hUMOKZh/+LOoM/duyPsohGjdlbGWiFj0Jl7 t841327ymNaSXBy5EEC01kY/e6jFDWBWlEKdrioJ1CynQCvvjYv2mA5hfLLuqjtrr3R0 Tv/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yXR9xn3QpBBAYAQXSZ2AaqgaDvOndRIkY74eH8onHM4=; b=kkdaMGQBzxvy/Ciy+ttIG38wAdZPK9z0l6kXXjKxv+7x7K7qfrbG5pGa6QK8dyEOGB MU7TjNELkL8xKEQCetSsxQSfy87SJA/ubF1rw397BaN4wE0SAdj5cF8y8Z+C6wH0KZ9G OS9sw76ARe+KJNn6Lens0Zwns7GltUTzsWtswGxqQ9SO5okrMdKycjF4tW2hJY0nP4Sv Q6xX+g0LJmAkVzLYQg3XjTYBzx4rCUpJVBQQ+jfvRqbQl7t5bFi/V33OtoDjG1MJJ2XQ COnhMoeXGYaXHi+tkHbpXT3GedYVh5YU+cVp2MXp/EtooA1eObdqpBjaf3zOasxR8kPA dURA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si4572633edy.284.2019.10.18.15.11.37; Fri, 18 Oct 2019 15:12:08 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438203AbfJQSEr (ORCPT + 99 others); Thu, 17 Oct 2019 14:04:47 -0400 Received: from mga03.intel.com ([134.134.136.65]:44892 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437870AbfJQSEq (ORCPT ); Thu, 17 Oct 2019 14:04:46 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2019 11:04:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,308,1566889200"; d="scan'208";a="221467301" Received: from eshoguli-mobl1.ccr.corp.intel.com (HELO localhost) ([10.252.19.56]) by fmsmga004.fm.intel.com with ESMTP; 17 Oct 2019 11:04:40 -0700 Date: Thu, 17 Oct 2019 21:04:40 +0300 From: Jarkko Sakkinen To: James Bottomley Cc: "Safford, David (GE Global Research, US)" , Ken Goldman , Mimi Zohar , "linux-integrity@vger.kernel.org" , "stable@vger.kernel.org" , "open list:ASYMMETRIC KEYS" , "open list:CRYPTO API" , open list Subject: Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes() Message-ID: <20191017180440.GG6667@linux.intel.com> References: <59b88042-9c56-c891-f75e-7c0719eb5ff9@linux.ibm.com> <20191008234935.GA13926@linux.intel.com> <20191008235339.GB13926@linux.intel.com> <20191014190033.GA15552@linux.intel.com> <1571081397.3728.9.camel@HansenPartnership.com> <20191016110031.GE10184@linux.intel.com> <1571229252.3477.7.camel@HansenPartnership.com> <20191016162543.GB6279@linux.intel.com> <1571253029.17520.5.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1571253029.17520.5.camel@HansenPartnership.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Oct 16, 2019 at 03:10:29PM -0400, James Bottomley wrote: > On Wed, 2019-10-16 at 19:25 +0300, Jarkko Sakkinen wrote: > > On Wed, Oct 16, 2019 at 08:34:12AM -0400, James Bottomley wrote: > > > reversible ciphers are generally frowned upon in random number > > > generation, that's why the krng uses chacha20. In general I think > > > we shouldn't try to code our own mixing and instead should get the > > > krng to do it for us using whatever the algorithm du jour that the > > > crypto guys have blessed is. That's why I proposed adding the TPM > > > output to the krng as entropy input and then taking the output of > > > the krng. > > > > It is already registered as hwrng. What else? > > It only contributes entropy once at start of OS. Ok. > > Was the issue that it is only used as seed when the rng is init'd > > first? I haven't at this point gone to the internals of krng. > > Basically it was similar to your xor patch except I got the kernel rng > to do the mixing, so it would use the chacha20 cipher at the moment > until they decide that's unsafe and change it to something else: > > https://lore.kernel.org/linux-crypto/1570227068.17537.4.camel@HansenPartnership.com/ > > It uses add_hwgenerator_randomness() to do the mixing. It also has an > unmixed source so that read of the TPM hwrng device works as expected. Thinking that could this potentially racy? I.e. between the calls something else could eat the entropy added? /Jarkko