Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp322128ybn; Tue, 1 Oct 2019 21:48:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOM03P0jAqhI1EGWfC0z4qeVhZe12amCnrkS0GeVfCOTkAU+QdAvLFvKyA9eh42GLYp2ax X-Received: by 2002:a17:906:8308:: with SMTP id j8mr1356002ejx.142.1569991700721; Tue, 01 Oct 2019 21:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569991700; cv=none; d=google.com; s=arc-20160816; b=coqWnKu4tQRJjnecE8hTHd8QzyrPRepnqKdD88Yn72IR7gHGn0zw/T69rW8uP+AOG/ knQGy2bnGzRLRHxQtAJVZsqg7s32Gq3Q9uYEC58o6veCnDIEJMQeM7VW/CUmapkqP9or RpL7zatspkYl9+eyIRRROzwNY+1pIfbAz39gKocXJka0KJ9jkZi7uA1UAd2fhVGgzNT6 gZgu5zK5HzgOx88n4d+cv6Lv7qy3giNCn3j4OFro4O1preyoymsOcrut9q9oDaPerNAP pCKDdIqh+M++/p6W40jatjnZ7C/iKT46ig1XowXZnfCsXKPNf1xRCmxKCTg32DTTshbZ +LRw== 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:to :from:date; bh=ufpVeWBEspX9XclY9FuOupIA73bKPL5XnbH+JocZGxU=; b=FwivlYJD3wmocoW8Qi2WGwKT/38zoEfD2KUNVMUmEMRQitLTPB2oldtqrK2Q4ow5rX 53u/jibAsVuVJimKDjxrxbNDAXSZKFyOVT1XvLb93AKqnSAtR6v8BFpRu+9ln+1yVXxH ww2imBmFES6v0sQlR+s2oxqBRSKKsXeCUr+1RHFeyVLJd7P11NCYofXdM23ArnhO73e8 kVSIfiAVy6Sot/BRzxH0YRNxq6s0jdW+OUCH9DZ2/UL6b0xoCG7LoRc4nCacWluwBjHi W2jIz3kzkjdDnZexVCwlwyUmDi6ylzZsSQeyRdfnrTTwiYzmgkP6JKiJHxh4Bh8/PXNr Zp2Q== 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 g37si10798241edg.59.2019.10.01.21.47.44; Tue, 01 Oct 2019 21:48:20 -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 S1726166AbfJAUyv (ORCPT + 99 others); Tue, 1 Oct 2019 16:54:51 -0400 Received: from mga17.intel.com ([192.55.52.151]:14871 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726195AbfJAUyv (ORCPT ); Tue, 1 Oct 2019 16:54:51 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Oct 2019 13:54:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,571,1559545200"; d="scan'208";a="275119848" Received: from nbaca1-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.37.57]) by orsmga001.jf.intel.com with ESMTP; 01 Oct 2019 13:54:46 -0700 Date: Tue, 1 Oct 2019 23:54:45 +0300 From: Jarkko Sakkinen To: linux-integrity@vger.kernel.org, stable@vger.kernel.org, David Howells , Herbert Xu , "David S. Miller" , "open list:ASYMMETRIC KEYS" , "open list:CRYPTO API" , open list Subject: Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes() Message-ID: <20191001205445.GC26709@linux.intel.com> References: <20190926171601.30404-1-jarkko.sakkinen@linux.intel.com> <20190928180559.jivt5zlisr43fnva@cantor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190928180559.jivt5zlisr43fnva@cantor> 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 Sat, Sep 28, 2019 at 11:05:59AM -0700, Jerry Snitselaar wrote: > On Thu Sep 26 19, Jarkko Sakkinen wrote: > > Only the kernel random pool should be used for generating random numbers. > > TPM contributes to that pool among the other sources of entropy. In here it > > is not, agreed, absolutely critical because TPM is what is trusted anyway > > but in order to remove tpm_get_random() we need to first remove all the > > call sites. > > > > Cc: stable@vger.kernel.org > > Fixes: 0c36264aa1d5 ("KEYS: asym_tpm: Add loadkey2 and flushspecific [ver #2]") > > Signed-off-by: Jarkko Sakkinen > > --- > > crypto/asymmetric_keys/asym_tpm.c | 7 ++----- > > 1 file changed, 2 insertions(+), 5 deletions(-) > > > > diff --git a/crypto/asymmetric_keys/asym_tpm.c b/crypto/asymmetric_keys/asym_tpm.c > > index 76d2ce3a1b5b..c14b8d186e93 100644 > > --- a/crypto/asymmetric_keys/asym_tpm.c > > +++ b/crypto/asymmetric_keys/asym_tpm.c > > @@ -6,6 +6,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -54,11 +55,7 @@ static int tpm_loadkey2(struct tpm_buf *tb, > > } > > > > /* generate odd nonce */ > > - ret = tpm_get_random(NULL, nonceodd, TPM_NONCE_SIZE); > > - if (ret < 0) { > > - pr_info("tpm_get_random failed (%d)\n", ret); > > - return ret; > > - } > > + get_random_bytes(nonceodd, TPM_NONCE_SIZE); > > > > /* calculate authorization HMAC value */ > > ret = TSS_authhmac(authdata, keyauth, SHA1_DIGEST_SIZE, enonce, > > -- > > 2.20.1 > > > > Should tpm_unbind and tpm_sign in asym_tpm.c be switched as well then? Without doubt. Thanks. I'll send an update soon. /Jarkko