Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565321

Re: [tpmdd-devel] [PATCH RFC v4 1/5] tpm: validate TPM 2.0 commands

From Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [tpmdd-devel] [PATCH RFC v4 1/5] tpm: validate TPM 2.0 commands
Date 2017-01-23 22:50 +0100
Message-ID <t2UEV-3oh-7@gated-at.bofh.it> (permalink)
References <t2A3v-7kk-3@gated-at.bofh.it> <t2A3v-7kk-9@gated-at.bofh.it> <t2CeZ-mq-3@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


On Sun, Jan 22, 2017 at 09:02:17PM -0500, Stefan Berger wrote:
> On 01/22/2017 06:44 PM, Jarkko Sakkinen wrote:
> > @@ -1025,8 +1029,60 @@ int tpm2_auto_startup(struct tpm_chip *chip)
> >   		}
> >   	}
> > 
> > +	rc = tpm2_get_tpm_pt(chip, TPM_PT_TOTAL_COMMANDS, &nr_commands, NULL);
> > +	if (rc)
> > +		goto out;
> > +
> > +	/* sanity check */
> > +	if (nr_commands > INT_MAX) {
> > +		rc = -E2BIG;
> > +		goto out;
> > +	}
> > +
> > +	chip->cc_attrs_tbl = devm_kzalloc(&chip->dev, 4 * nr_commands,
> > +					  GFP_KERNEL);
> > +
> > +	rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_CAPABILITY);
> > +	if (rc)
> > +		goto out;
> > +
> > +	tpm_buf_append_u32(&buf, TPM2_CAP_COMMANDS);
> > +	tpm_buf_append_u32(&buf, TPM2_CC_FIRST);
> > +	tpm_buf_append_u32(&buf, nr_commands);
> > +
> > +	rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, 0, 0, NULL);
> 
> You should probably pass the min_rsp_body_size as 5 + 4 + nr_commands * 4

Thanks. I'll put 9 + 4 * nr_commands as the expected size.

/Jarkko

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH RFC v4 1/5] tpm: validate TPM 2.0 commands Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-23 00:50 +0100
  Re: [tpmdd-devel] [PATCH RFC v4 1/5] tpm: validate TPM 2.0 commands Stefan Berger <stefanb@linux.vnet.ibm.com> - 2017-01-23 03:10 +0100
    Re: [tpmdd-devel] [PATCH RFC v4 1/5] tpm: validate TPM 2.0 commands Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-23 22:50 +0100

csiph-web