Re: [tpmdd-devel] [PATCH] tpm_tis: override reported C and D timeouts for Atmel 3203

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 10:37:31PM +0100, Maciej S. Szmigiero wrote: > On 12.01.2017 21:20, Jarkko Sakkinen wrote: > > On Thu, Jan 12, 2017 at 09:09:33PM +0100, Maciej S. Szmigiero wrote: > >> Hi Jason, > >> > >> On 12.01.2017 19:42, Jason Gunthorpe wrote: > (..) > >>> Can you also add a check for

Re: [tpmdd-devel] [PATCH] tpm_tis: rename TPM_TIS_ITPM_POSSIBLE to TPM_TIS_ITPM_WORKAROUND

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 11:04:11PM +0100, Maciej S. Szmigiero wrote: > Rename TPM_TIS_ITPM_POSSIBLE to TPM_TIS_ITPM_WORKAROUND since it gives a > better idea what this flag actually does. > > Suggested-by: Jason Gunthorpe > Signed-off-by: Maciej S. Szmigiero Reviewed-by: Jarkko Sakkinen /Jark

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 12:38:52PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > +static int tpm2_map_response(struct tpm_chip *chip, u32 cc, u8 *rsp, > > size_t len) > > +{ > > + struct tpm_space *space = &chip->work_space; > > + u32 phan

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct device > > *pdev, > > chip->cdev.owner = THIS_MODULE; > > chip->cdev.kobj.parent = &chip->dev.kobj; >

Re: [tpmdd-devel] [PATCH v4] tpm: Check size of response before accessing data

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 08:19:11PM -0500, Stefan Berger wrote: > Make sure that we have not received less bytes than what is indicated > in the header of the TPM response. Also, check the number of bytes in > the response before accessing its data. > > Signed-off-by: Stefan Berger Thanks. Revie

Re: [tpmdd-devel] [PATCH v3 2/2] tpm: enhance TPM 2.0 PCR extend to support multiple banks

2017-01-13 Thread Jarkko Sakkinen
On Fri, Jan 13, 2017 at 12:44:15PM +0530, Nayna wrote: > > > On 01/12/2017 11:50 PM, Jarkko Sakkinen wrote: > > On Thu, Jan 12, 2017 at 11:58:10AM -0500, Nayna Jain wrote: > > > The current TPM 2.0 device driver extends only the SHA1 PCR bank > > > but the TCG Specification[1] recommends extendin

Re: [tpmdd-devel] [PATCH v3 1/2] tpm: implement TPM 2.0 capability to get active PCR banks

2017-01-13 Thread Jarkko Sakkinen
On Fri, Jan 13, 2017 at 12:54:12PM +0530, Nayna wrote: > > > On 01/12/2017 11:55 PM, Jarkko Sakkinen wrote: > > On Thu, Jan 12, 2017 at 11:58:09AM -0500, Nayna Jain wrote: > > > This patch implements the TPM 2.0 capability TPM_CAP_PCRS to > > > retrieve the active PCR banks from the TPM. This is

Re: [tpmdd-devel] [PATCH v4] tpm: Check size of response before accessing data

2017-01-13 Thread Jason Gunthorpe
On Thu, Jan 12, 2017 at 08:19:11PM -0500, Stefan Berger wrote: > Make sure that we have not received less bytes than what is indicated > in the header of the TPM response. Also, check the number of bytes in > the response before accessing its data. > > Signed-off-by: Stefan Berger Reviewed-by: J

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread Jason Gunthorpe
On Thu, Jan 12, 2017 at 10:56:28PM +0200, Jarkko Sakkinen wrote: > > dev_t tpm_devt; > > But they should have different major device numbers. major/minors don't really matter these days since they are dynamic Jason --

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread James Bottomley
On Fri, 2017-01-13 at 10:25 -0700, Jason Gunthorpe wrote: > On Thu, Jan 12, 2017 at 10:56:28PM +0200, Jarkko Sakkinen wrote: > > > > dev_t tpm_devt; > > > > But they should have different major device numbers. > > major/minors don't really matter these days since they are dynamic Right, althou

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread Jason Gunthorpe
On Fri, Jan 13, 2017 at 09:40:08AM -0800, James Bottomley wrote: > On Fri, 2017-01-13 at 10:25 -0700, Jason Gunthorpe wrote: > > On Thu, Jan 12, 2017 at 10:56:28PM +0200, Jarkko Sakkinen wrote: > > > > > > dev_t tpm_devt; > > > > > > But they should have different major device numbers. > > > >

Re: [tpmdd-devel] [PATCH v8 2/2] tpm: add securityfs support for TPM 2.0 firmware event log

2017-01-13 Thread Stefan Berger
On 01/11/2017 02:54 AM, Nayna Jain wrote: > Unlike the device driver support for TPM 1.2, the TPM 2.0 does > not support the securityfs pseudo files for displaying the > firmware event log. > > This patch enables support for providing the TPM 2.0 event log in > binary form. TPM 2.0 event log suppor

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread James Bottomley
On Fri, 2017-01-13 at 11:01 -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 09:40:08AM -0800, James Bottomley wrote: > > On Fri, 2017-01-13 at 10:25 -0700, Jason Gunthorpe wrote: > > > On Thu, Jan 12, 2017 at 10:56:28PM +0200, Jarkko Sakkinen wrote: > > > > > > > > dev_t tpm_devt; > > > >

Re: [tpmdd-devel] [PATCH RFC v2 4/5] tpm: split out tpm-dev.c into tpm-dev.c and tpm-common-dev.c

2017-01-13 Thread James Bottomley
This version has a bug in that it doesn't do a clear_bit(0, &chip ->is_open) on release. so fixed that James --- >From c006f181988dd2fd54e5a84f3e4a6dc0157c96f5 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 10 Jan 2017 19:08:53 -0800 Subject: [PATCH 4/5] tpm: split out tpm-dev.c into

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread James Bottomley
On Thu, 2017-01-12 at 11:39 -0700, Jason Gunthorpe wrote: > On Thu, Jan 12, 2017 at 07:46:08PM +0200, Jarkko Sakkinen wrote: > > > struct tpm_chip { > > - struct device dev; > > - struct cdev cdev; > > + struct device dev, devrm; > > Hum.. devrm adds a new kref but doesn't do anything with

[tpmdd-devel] [PATCH] tpm: add session handles to the save and restore of the tpm2 space manager

2017-01-13 Thread James Bottomley
Session handles are slightly more difficult to manage because any TPM only has a finite number of allowed handles, even if the session has been saved; so when you context save a session, you must not flush it because that would destroy the ability to context load it (you only flush sessions when yo

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread Jason Gunthorpe
On Fri, Jan 13, 2017 at 11:20:47AM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 11:39 -0700, Jason Gunthorpe wrote: > > On Thu, Jan 12, 2017 at 07:46:08PM +0200, Jarkko Sakkinen wrote: > > > > > struct tpm_chip { > > > - struct device dev; > > > - struct cdev cdev; > > > + struct device

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread James Bottomley
On Fri, 2017-01-13 at 12:47 -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 11:20:47AM -0800, James Bottomley wrote: > > On Thu, 2017-01-12 at 11:39 -0700, Jason Gunthorpe wrote: > > > On Thu, Jan 12, 2017 at 07:46:08PM +0200, Jarkko Sakkinen wrote: > > > > > > > struct tpm_chip { > > > >

Re: [tpmdd-devel] [PATCH v3 2/2] tpm: enhance TPM 2.0 PCR extend to support multiple banks

2017-01-13 Thread Ken Goldman
On 1/13/2017 11:43 AM, Jarkko Sakkinen wrote: +struct tpml_digest_values { + u32 count; + struct tpmt_ha digests[TPM2_ACTIVE_PCR_BANKS]; +} __packed; >>> >>> Please remove this structure. >> >> Sorry Jarkko, I didn't understand this comment. >> Why do we want to remove this s

Re: [tpmdd-devel] [PATCH v8 2/2] tpm: add securityfs support for TPM 2.0 firmware event log

2017-01-13 Thread Stefan Berger
On 01/13/2017 01:09 PM, Stefan Berger wrote: > On 01/11/2017 02:54 AM, Nayna Jain wrote: >> Unlike the device driver support for TPM 1.2, the TPM 2.0 does >> not support the securityfs pseudo files for displaying the >> firmware event log. >> >> This patch enables support for providing the TPM 2.0

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread Jason Gunthorpe
On Fri, Jan 13, 2017 at 12:02:36PM -0800, James Bottomley wrote: > > > Actually, no, the devrm is a completely lifetime managed device as > > > part > > > of the chip structure. once you've done a device_del on it, it can > > > be > > > kfreed because it's no longer visible to anything else. > >

[tpmdd-devel] [PATCH] tpm_tis: use default timeout value if chip reports it as zero

2017-01-13 Thread Maciej S. Szmigiero
Since commit 1107d065fdf1 ("tpm_tis: Introduce intermediate layer for TPM access") Atmel 3203 TPM on ThinkPad X61S (TPM firmware version 13.9) no longer works. The initialization proceeds fine until we get and start using chip-reported timeouts - and the chip reports C and D timeouts of zero. It t

[tpmdd-devel] [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-13 Thread Andrey Pronin
Resetting TPM while processing a command may lead to issues on the next boot. Ensure that we don't have any ongoing commands, and that no further commands can be sent to the chip by unregistering the device in the shutdown handler. tpm_chip_unregister() waits for the completion of an ongoing comman

Re: [tpmdd-devel] [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-13 Thread Jason Gunthorpe
On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote: > Resetting TPM while processing a command may lead to issues > on the next boot. Ensure that we don't have any ongoing > commands, and that no further commands can be sent to the chip > by unregistering the device in the shutdown handl

Re: [tpmdd-devel] [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-13 Thread Andrey Pronin
On Fri, Jan 13, 2017 at 05:28:57PM -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote: > > Resetting TPM while processing a command may lead to issues > > on the next boot. Ensure that we don't have any ongoing > > commands, and that no further commands ca

Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms

2017-01-13 Thread James Bottomley
On Fri, 2017-01-13 at 14:23 -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 12:02:36PM -0800, James Bottomley wrote: > > > > Actually, no, the devrm is a completely lifetime managed device > > > > as part of the chip structure. once you've done a device_del > > > > on it, it can be kfree

Re: [tpmdd-devel] [PATCH v4] tpm: Check size of response before accessing data

2017-01-13 Thread Stefan Berger
On 01/12/2017 08:19 PM, Stefan Berger wrote: > Make sure that we have not received less bytes than what is indicated > in the header of the TPM response. Also, check the number of bytes in > the response before accessing its data. Please do not apply. There's a bug here where tpm_getcap has to be

[tpmdd-devel] [PATCH v5] tpm: Check size of response before accessing data

2017-01-13 Thread Stefan Berger
Make sure that we have not received less bytes than what is indicated in the header of the TPM response. Also, check the number of bytes in the response before accessing its data. Signed-off-by: Stefan Berger --- v5: - Fixed a bug related to tpm_getcap() having to allow to return only a hea