From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Date: Tue, 13 Oct 2020 02:39:27 +0000 Subject: Re: [PATCH v3 3/3] KEYS: trusted: Reserve TPM for seal and unseal operations Message-Id: <20201013023927.GA71954@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit List-Id: References: <20201013002815.40256-1-jarkko.sakkinen@linux.intel.com> <20201013002815.40256-4-jarkko.sakkinen@linux.intel.com> In-Reply-To: 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" 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