Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4844361pxu; Tue, 13 Oct 2020 08:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUmGan998necIhOy38BfV11IHebzY98BEHBB62abPxhZWMSwiAmKRvy10mlQShYWomA2Pk X-Received: by 2002:aa7:c302:: with SMTP id l2mr72023edq.204.1602602692788; Tue, 13 Oct 2020 08:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602602692; cv=none; d=google.com; s=arc-20160816; b=YYk6bPwGNXsg5cv9YwFYgQD7spSS0B/sd7f9L2sL7l+ytnQfUefb9AcXNPSh1NAQz4 HQCJJdXuIQtbYPOEixFMd46BlwSTv/AfMEoi+B12/1Tut7n1IuCoj97aqmUMDE3P8tfu l1kNUjKC+LWV7srU9aQ62SdM3PPbWtMGFxkuHDUPzfT5hevovwXGxDiHXwbpisvzOZwM 5LOAi3a9JfYtUyG5ldsGy/g8GABmVEC/PglDqlZly19kDNe5pCLGZAC73Tsg72ppUJzJ NRdXcl5DnnB9Vh9bwNcAclR/TqDrjLCsgMULPLkoLM52czKKvpADpN8C8JWzR8aW0Amu Qx2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=WEE0QnwxwyVbpdigW/K/f9aBTsLiI6BwxDOxTqXnP68=; b=vFgiJSxPhC62UR34FUns+Enccp3/i0YVb6vsruRbfsrkHU1VAgggMQayPGrgk+QjGr WnwcWbrESpeInmK1nOJla+qirPPt6UIxR2sZguwlizbD+isUPYND/+9Cp+xJ6toM3qxV +eVoy7gd5ViUawyvqNSw/w5wtskRYZFAmkxalmXZ56sBRp+O/6XOthBPMvhvL/k3jrrf yaQcq1v0EsedwJ0r+vEPIwKAXlOXyxljHBmJg5Mj92J/l9iLxjQ/xCY79kmCoQNnFu5M 61uFw/154iAwitu6JBZqBvhpi2xavyG+X0zILDfl8hGqsanEbd6OuBAS3Vjw3sySxF6A 8FaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u3si33746ejg.130.2020.10.13.08.24.28; Tue, 13 Oct 2020 08:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727355AbgJMCr1 (ORCPT + 99 others); Mon, 12 Oct 2020 22:47:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:60336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbgJMCrW (ORCPT ); Mon, 12 Oct 2020 22:47:22 -0400 Received: from localhost (83-245-197-237.elisa-laajakaista.fi [83.245.197.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D04121582; Tue, 13 Oct 2020 02:39:29 +0000 (UTC) Date: Tue, 13 Oct 2020 05:39:27 +0300 From: Jarkko Sakkinen To: James Bottomley Cc: linux-integrity@vger.kernel.org, David Howells , Mimi Zohar , stable@vger.kernel.org, Sumit Garg , kernel test robot , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , James Morris , "Serge E. Hallyn" , Jerry Snitselaar , Alexey Klimov , open list , "open list:KEYS-TRUSTED" , "open list:SECURITY SUBSYSTEM" Subject: Re: [PATCH v3 3/3] KEYS: trusted: Reserve TPM for seal and unseal operations Message-ID: <20201013023927.GA71954@linux.intel.com> References: <20201013002815.40256-1-jarkko.sakkinen@linux.intel.com> <20201013002815.40256-4-jarkko.sakkinen@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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2020 at 05:58:04PM -0700, James Bottomley wrote: > On Tue, 2020-10-13 at 03:28 +0300, Jarkko Sakkinen wrote: > [...] > > diff --git a/include/linux/tpm.h b/include/linux/tpm.h > > index 8f4ff39f51e7..f0ebce14d2f8 100644 > > --- a/include/linux/tpm.h > > +++ b/include/linux/tpm.h > > @@ -397,6 +397,10 @@ static inline u32 tpm2_rc_value(u32 rc) > > #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) > > > > extern int tpm_is_tpm2(struct tpm_chip *chip); > > +extern __must_check int tpm_try_get_ops(struct tpm_chip *chip); > > +extern void tpm_put_ops(struct tpm_chip *chip); > > +extern ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct > > tpm_buf *buf, > > + size_t min_rsp_body_length, const char > > *desc); > > extern int tpm_pcr_read(struct tpm_chip *chip, u32 pcr_idx, > > struct tpm_digest *digest); > > extern int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, > > @@ -410,7 +414,18 @@ static inline int tpm_is_tpm2(struct tpm_chip > > *chip) > > { > > return -ENODEV; > > } > > - > > +static inline int tpm_try_get_ops(struct tpm_chip *chip) > > +{ > > + return -ENODEV; > > +} > > +static inline void tpm_put_ops(struct tpm_chip *chip) > > +{ > > +} > > +static inline ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct > > tpm_buf *buf, > > + size_t min_rsp_body_length, > > const char *desc) > > +{ > > + return -ENODEV; > > +} > > static inline int tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, > > I don't think we want this, do we? That's only for API access which > should be available when the TPM isn't selected. Given that get/put > are TPM critical operations, they should only appear when inside code > where the TPM has already been selected. If they appear outside TPM > selected code, I think we want the compile to fail, which is why we > don't want these backup definitions. > > James OK, I'll change it. Thanks. /Jarkko