Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2160478imu; Wed, 12 Dec 2018 10:30:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uy7yBydlGJ4TiN3SqA+3PD/M52k6hCwRWfkCbLDQLqJnC6bMXicj9k+CcTojSYbi7BkFFC X-Received: by 2002:a62:435a:: with SMTP id q87mr20801976pfa.109.1544639406779; Wed, 12 Dec 2018 10:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544639406; cv=none; d=google.com; s=arc-20160816; b=ir91TZlJPqGTzn/GlLHSxP83rxvKHpzeK+D1l3/tCO8GKSi996W0HDcj15MV7UliKR QAbiaZY+egHRI0MLPabtlFo6ffWC4aUGQ/Y2kUg3KO3Eko8VJ+vRhQH/QYRSXlnfGMdB IcmbahwNNi3C5dhMTPxYUW1uZVftESWooluF3HXWJcUDgKG+5VEhNgRNRrXAzx6JM3M0 KQTZPR3tNZBB73DFukjHhygl91zn8B9tNV0O0JS8SSYVfj8Hl1zWEX4jEEN7HVMvAXMQ vB/5bzHgEevjUkLndPsOajjfEoGkHfXq2IVdazGtGKnuKZOK6MZTqDlZ6Eabb1j83o9U Ql3A== 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=4z6dId/RD1PiwmiUAPM/Tqw9kymgtKSjwITY3SlK/SY=; b=q2HX6alhFYvhYcoqkFltq3na3VZUrknlRJoxGKzrMLryVhwBOWNxMqYTOuPj0d0R9q HkcriKh6tAfVz8sY4qQog5XpzWIHKZQxm62xFnQzDJTlOgEo9KY11vLGEA4Y3FGB4eYC SOPcKIhrKahCvYDWV1pWQlnYw4soYgxoim3pWVjYBSQOMKT716a5c7MugFVuEyCQN/ud xn5HkxDGs0ni5rW3mwHM3qqBzgY0cUQM87uQQNuIkXzEB+/+m8Ksq4RlK1+MTw+udGA9 XuYFFwk7Mot1hv6BHOH/p5gV2mL2zbin2h2OtVDdakfeMTO0IuBkOE3SQD9/HZ+RIzBQ Jmxw== ARC-Authentication-Results: i=1; mx.google.com; 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=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 n8si14982854plp.137.2018.12.12.10.29.51; Wed, 12 Dec 2018 10:30:06 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728185AbeLLS1l (ORCPT + 99 others); Wed, 12 Dec 2018 13:27:41 -0500 Received: from mga14.intel.com ([192.55.52.115]:35948 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728120AbeLLS1k (ORCPT ); Wed, 12 Dec 2018 13:27:40 -0500 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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2018 10:27:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,345,1539673200"; d="scan'208";a="127337662" Received: from hekner-mobl.ger.corp.intel.com (HELO localhost) ([10.249.254.170]) by fmsmga004.fm.intel.com with ESMTP; 12 Dec 2018 10:27:35 -0800 Date: Wed, 12 Dec 2018 20:27:34 +0200 From: Jarkko Sakkinen To: Roberto Sassu Cc: zohar@linux.ibm.com, david.safford@ge.com, monty.wiseman@ge.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, silviu.vlasceanu@huawei.com Subject: Re: [PATCH v6 7/7] tpm: pass an array of tpm_bank_list structures to tpm_pcr_extend() Message-ID: <20181212182734.GH6333@linux.intel.com> References: <20181204082138.24600-1-roberto.sassu@huawei.com> <20181204082138.24600-8-roberto.sassu@huawei.com> <20181205001417.GF1233@linux.intel.com> <9d6e47d9-3b88-86f6-1b60-6652dfe8dc00@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d6e47d9-3b88-86f6-1b60-6652dfe8dc00@huawei.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 06, 2018 at 07:38:30PM +0100, Roberto Sassu wrote: > On 12/5/2018 1:14 AM, Jarkko Sakkinen wrote: > > On Tue, Dec 04, 2018 at 09:21:38AM +0100, Roberto Sassu wrote: > > > The new tpm_bank_list structure has been preferred to the tpm_digest > > > structure, to let the caller specify the size of the digest (which may be > > > unknown to the TPM driver). > > > > Why is that? Didn't previous commit query these? > > Since the TPM driver pads/truncates the first digest passed by the > caller to extend PCRs for which no digest was provided, it must know > which amount of data it can use. It is possible that the algorithm of > the first digest is unknown for the TPM driver, if the caller of > tpm_pcr_extend() didn't check chip->allocated_banks. > > By requiring that the caller passes also the digest size, this problem > does not arise. It seems reasonable to me to pass this information, as > the caller calculated the digest and it should know the digest size. OK. I noticed something other things that look to alarming: 1. The function does not fail if alg_id is not found. This will go silent. 2. The function does not fail if there is a mismatch with the digest sizes. /Jarkko