Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1781980imu; Fri, 14 Dec 2018 00:00:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vvc8Y4zZTzIdIe+2U8qFAVT72T94inpUnc7ae6fPXE7Ze99zJCSMkezqGL42D/CLI4RBVM X-Received: by 2002:a62:14d1:: with SMTP id 200mr1913764pfu.103.1544774408885; Fri, 14 Dec 2018 00:00:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544774408; cv=none; d=google.com; s=arc-20160816; b=tKOelrjZSjgNtuQzTqE0PiZ4sqHskIkIA5cFrI1Oy2HEHqsN8Wxbo9qb5uGPutCU9Y 24d63kKxONaQM0kWFv5W3UVw6aOrLBZkzPN4Wv8sGN5pBx2izOo5ibTwwVrMrAdrguUw ith7/uEBj1df/ofzQGA/z39WxmqPFaPqboeDgE8EeJ8tjG1Usus2mcyN1RltEyrWVlOJ fmxpVat3Br+dDq4yyVTrCKqOB7hDjcwrfIf5E6812AMiUqvTLW63adqdxZbjXw74bjkA g+h+Qq9PdU9AV4S+soEIYnj1V88hg7jdI7Dw/lbIvOgOmdeph1B8gnyHM0NeAxP8SsvH +dtQ== 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=ujdlG/JkPPM9rnBYYbqAZH9Vi67Dka+uMkD9coeNT/g=; b=RPWI7B3TJP0DsPfu0yi7nD/eHkVo0UNJyuRNkS0i6Ge5oH7MwJm55yzL2SNHWPuVys WjjmVx02jjUczE+fMTp3QpQclkuc+YVD8gOf2fczCwLvvafEcMv410SHfp/yzY9ZtGke SG1+E0h1S4xVi6OvRD7E0Y0EgJPBMaDBndx+kY7zWiKu62qNWDXaT9tsnvYOd1m/uMsb Gvr6Bm+ZMXHqmLPEdhqKCkaRP7fhrNI20OjrIdjBNOdjgK1NC5qwcsmxxqoPhcZgFMkU YozFqOrf8UaL0Xf0ZyOJ+RCXk631TasndHsR+p+ytyh/nN4ONVMrjAJfG4g23KONqP11 9zUg== 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 m20si3573797pgk.323.2018.12.13.23.59.53; Fri, 14 Dec 2018 00:00:08 -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 S1727229AbeLNH7C (ORCPT + 99 others); Fri, 14 Dec 2018 02:59:02 -0500 Received: from mga18.intel.com ([134.134.136.126]:52359 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726494AbeLNH7B (ORCPT ); Fri, 14 Dec 2018 02:59:01 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2018 23:59:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,352,1539673200"; d="scan'208";a="118296825" Received: from hekner-mobl.ger.corp.intel.com (HELO localhost) ([10.249.254.170]) by orsmga002.jf.intel.com with ESMTP; 13 Dec 2018 23:58:57 -0800 Date: Fri, 14 Dec 2018 09:58:52 +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: <20181214075852.GB1721@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> <20181212182734.GH6333@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 13, 2018 at 08:57:17AM +0100, Roberto Sassu wrote: > > 1. The function does not fail if alg_id is not found. This will go > > silent. > > It is intentional. If alg_id is not found, the PCR is extended with the > first digest passed by the caller of tpm_pcr_extend(). If no digest was > provided, the PCR is extended with 0s. This is done to prevent that > PCRs in unused banks are extended later with fake measurements. > > > > 2. The function does not fail if there is a mismatch with the digest > > sizes. > > The data passed by the caller of tpm_pcr_extend() is copied to > dummy_hash, which has the maximum length. Then, tpm2_pcr_extend() takes > from dummy_hash as many bytes as needed, depending on the current > algorithm. I would suggest to document these corner cases to the function long description to make it easy and obvious to understand. /Jarkko