All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-25 16:29 Roberts, William C
  0 siblings, 0 replies; 10+ messages in thread
From: Roberts, William C @ 2018-04-25 16:29 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 2605 bytes --]

I have heard of this bug before but never encountered it. I looked at the PR:
https://github.com/tpm2-software/tpm2-tools/pull/1002

I heard as well that setting the buffer to something smaller than MAX size and that 512 bytes is recommended.
Someone actually polled the vendors to find out what buffer size is always a safe bet, and 512 was it.

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org] On Behalf Of Ian Oliver
> Sent: Tuesday, April 24, 2018 7:48 AM
> To: Duncan.Palmer(a)data61.csiro.au
> Cc: tpm2(a)lists.01.org
> Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> 
> Thanks,
> 
> 
> We are seeing the same issue on the TPMs in our Intel NUCs .. Infineon 9655s ?
> Need to check tomorrow
> 
> 
> t.
> 
> 
> Ian
> 
> 
> On 24 April 2018 at 15:51, <Duncan.Palmer(a)data61.csiro.au
> <mailto:Duncan.Palmer(a)data61.csiro.au> > wrote:
> 
> 
> 	Done. I hadn't submitted a pull request before as I was unsure whether
> this issue was related to the TPM I'm using (which doesn't seem commonly
> used), or more generally applicable.
> 
> 	Duncan Palmer
> 	Senior Software Engineer | Autonomous Systems
> 	Data61 | CSIRO
> 	E duncan.palmer(a)csiro.au
> 	Queensland Centre for Advanced Technologies (QCAT),
> 	1 Technology Court, Pullenvale QLD, 4069
> 	www.data61.csiro.au <http://www.data61.csiro.au>
> 
> 	CSIRO’s Digital Productivity business unit and NICTA have joined forces to
> create digital powerhouse Data61
> 
> 	________________________________________
> 	From: Tadeusz Struk <tadeusz.struk(a)intel.com
> <mailto:tadeusz.struk(a)intel.com> >
> 	Sent: 19 April 2018 04:17
> 	To: Palmer, Duncan (Data61, Pullenvale); ian.justin.oliver(a)gmail.com
> <mailto:ian.justin.oliver(a)gmail.com> ; tpm2(a)lists.01.org
> <mailto:tpm2(a)lists.01.org>
> 	Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> 
> 
> 	On 04/17/2018 03:24 PM, Duncan.Palmer(a)data61.csiro.au
> <mailto:Duncan.Palmer(a)data61.csiro.au>  wrote:
> 	> We see the same behaviour on an Intel NUC5i7. I haven't looked at the
> capabilities reported by the TPM device on that platform. The attached patch
> (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is
> reported as 0), sorts the problem out.
> 	>
> 
> 	Hi Duncan,
> 	Could you please send a Pull Request with your fix to the tools repo.
> 
> 	Thanks,
> 	--
> 	Tadeusz
> 
> 
> 
> 
> 
> 
> --
> 
> Dr. Ian Oliver
> ===============================
> 
> Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
> Twitter: @i_j_oliver

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-30 18:12 Roberts, William C
  0 siblings, 0 replies; 10+ messages in thread
From: Roberts, William C @ 2018-04-30 18:12 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 6173 bytes --]

Theirs really two values when dealing with NV space that are of concern:

The maximum size of an nv area, given by fixed-property capability:
TPM_PT_NV_INDEX_MAX

The maximum amount of data that can be transferred at a time:
TPM2_PT_NV_BUFFER_MAX

The maximum transfer size (TPM2_PT_NV_BUFFER_MAX) is also bounded by
TPM2_MAX_NV_BUFFER_SIZE which is 2048.

TO clarify, if a TPM reports 0 for TPM2_PT_NV_BUFFER_MAX (ie transfer size)
we should assume some value, however TPM2_MAX_NV_BUFFER_SIZE
might not be the best option. Something smaller, like 512, is probably a
safer bet, and this 512 on 0 logic has been merged into 3.X (on 3.0.4 release) and on
current master.


> -----Original Message-----
> From: Duncan.Palmer(a)data61.csiro.au [mailto:Duncan.Palmer(a)data61.csiro.au]
> Sent: Thursday, April 26, 2018 3:16 PM
> To: ian.justin.oliver(a)gmail.com; Roberts, William C
> <william.c.roberts(a)intel.com>
> Cc: tpm2(a)lists.01.org
> Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> 
> Thanks for updating the patch with a default size William. Sorry, I hadn't the time
> to do it yet...
> 
> 
> 
> 
> Duncan Palmer
> Senior Software Engineer | Autonomous Systems
> Data61 | CSIRO
> 
> 
> E duncan.palmer(a)csiro.au
> 
> Queensland Centre for Advanced Technologies (QCAT),
> 
> 1 Technology Court, Pullenvale QLD, 4069
> 
> 
> www.data61.csiro.au <http://my.csiro.au/Business-
> Units/Operations/Communication/CSIRO-Branding/Data61-
> Branding/www.data61.csiro.au>
> 
> 
> 
> 
> 
> CSIRO's Digital Productivity business unit and NICTA have joined forces to create
> digital powerhouse Data61
> 
> ________________________________
> 
> From: Ian Oliver <ian.justin.oliver(a)gmail.com>
> Sent: 26 April 2018 03:02
> To: Roberts, William C
> Cc: Palmer, Duncan (Data61, Pullenvale); tpm2(a)lists.01.org
> Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> 
> Actually some TPMs aren't reporting this value as part of the properties
> (tpm2_getcap -c properties-fixed IIRC) so it gets interpreted as 0.
> 
> 
> Can you also confirm the maximum size of an NV_RAM area, or is it always
> bounded by MAX_NV_BUFFER_SIZE  ?
> 
> 
> t.
> 
> 
> Ian
> 
> 
> On 25 April 2018 at 19:29, Roberts, William C <william.c.roberts(a)intel.com
> <mailto:william.c.roberts(a)intel.com> > wrote:
> 
> 
> 	I have heard of this bug before but never encountered it. I looked at the
> PR:
> 	https://github.com/tpm2-software/tpm2-tools/pull/1002
> <https://github.com/tpm2-software/tpm2-tools/pull/1002>
> 
> 	I heard as well that setting the buffer to something smaller than MAX size
> and that 512 bytes is recommended.
> 	Someone actually polled the vendors to find out what buffer size is
> always a safe bet, and 512 was it.
> 
> 	> -----Original Message-----
> 	> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org <mailto:tpm2-
> bounces(a)lists.01.org> ] On Behalf Of Ian Oliver
> 	> Sent: Tuesday, April 24, 2018 7:48 AM
> 	> To: Duncan.Palmer(a)data61.csiro.au
> <mailto:Duncan.Palmer(a)data61.csiro.au>
> 	> Cc: tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org>
> 	> Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> 	>
> 	> Thanks,
> 	>
> 	>
> 	> We are seeing the same issue on the TPMs in our Intel NUCs .. Infineon
> 9655s ?
> 	> Need to check tomorrow
> 	>
> 	>
> 	> t.
> 	>
> 	>
> 	> Ian
> 	>
> 	>
> 	> On 24 April 2018 at 15:51, <Duncan.Palmer(a)data61.csiro.au
> <mailto:Duncan.Palmer(a)data61.csiro.au>
> 	> <mailto:Duncan.Palmer(a)data61.csiro.au
> <mailto:Duncan.Palmer(a)data61.csiro.au> > > wrote:
> 	>
> 	>
> 	>       Done. I hadn't submitted a pull request before as I was unsure
> whether
> 	> this issue was related to the TPM I'm using (which doesn't seem
> commonly
> 	> used), or more generally applicable.
> 	>
> 	>       Duncan Palmer
> 	>       Senior Software Engineer | Autonomous Systems
> 	>       Data61 | CSIRO
> 	>       E duncan.palmer(a)csiro.au
> 	>       Queensland Centre for Advanced Technologies (QCAT),
> 	>       1 Technology Court, Pullenvale QLD, 4069
> 	>       www.data61.csiro.au <http://www.data61.csiro.au>
> <http://www.data61.csiro.au>
> 	>
> 	>       CSIRO's Digital Productivity business unit and NICTA have joined
> forces to
> 	> create digital powerhouse Data61
> 	>
> 	>       ________________________________________
> 	>       From: Tadeusz Struk <tadeusz.struk(a)intel.com
> <mailto:tadeusz.struk(a)intel.com>
> 	> <mailto:tadeusz.struk(a)intel.com <mailto:tadeusz.struk(a)intel.com> >
> >
> 	>       Sent: 19 April 2018 04:17
> 	>       To: Palmer, Duncan (Data61, Pullenvale); ian.justin.oliver(a)gmail.com
> <mailto:ian.justin.oliver(a)gmail.com>
> 	> <mailto:ian.justin.oliver(a)gmail.com
> <mailto:ian.justin.oliver(a)gmail.com> > ; tpm2(a)lists.01.org
> <mailto:tpm2(a)lists.01.org>
> 	> <mailto:tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org> >
> 	>       Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> 	>
> 	>
> 	>       On 04/17/2018 03:24 PM, Duncan.Palmer(a)data61.csiro.au
> <mailto:Duncan.Palmer(a)data61.csiro.au>
> 	> <mailto:Duncan.Palmer(a)data61.csiro.au
> <mailto:Duncan.Palmer(a)data61.csiro.au> >  wrote:
> 	>       > We see the same behaviour on an Intel NUC5i7. I haven't looked at
> the
> 	> capabilities reported by the TPM device on that platform. The attached
> patch
> 	> (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size
> is
> 	> reported as 0), sorts the problem out.
> 	>       >
> 	>
> 	>       Hi Duncan,
> 	>       Could you please send a Pull Request with your fix to the tools repo.
> 	>
> 	>       Thanks,
> 	>       --
> 	>       Tadeusz
> 	>
> 	>
> 	>
> 	>
> 	>
> 	>
> 	> --
> 	>
> 	> Dr. Ian Oliver
> 	> ===============================
> 	>
> 	> Privacy Engineering:  via Amazon
> <http://www.amazon.co.uk/dp/1497569710
> <http://www.amazon.co.uk/dp/1497569710> >
> 	> Twitter: @i_j_oliver
> 
> 
> 
> 
> 
> --
> 
> Dr. Ian Oliver
> ===============================
> 
> Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
> Twitter: @i_j_oliver

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-26 22:15 Duncan.Palmer
  0 siblings, 0 replies; 10+ messages in thread
From: Duncan.Palmer @ 2018-04-26 22:15 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 4534 bytes --]

Thanks for updating the patch with a default size William. Sorry, I hadn't the time to do it yet...


Duncan Palmer
Senior Software Engineer | Autonomous Systems
Data61 | CSIRO

E duncan.palmer(a)csiro.au

Queensland Centre for Advanced Technologies (QCAT),

1 Technology Court, Pullenvale QLD, 4069

www.data61.csiro.au<http://my.csiro.au/Business-Units/Operations/Communication/CSIRO-Branding/Data61-Branding/www.data61.csiro.au>


CSIRO's Digital Productivity business unit and NICTA have joined forces to create digital powerhouse Data61

________________________________
From: Ian Oliver <ian.justin.oliver(a)gmail.com>
Sent: 26 April 2018 03:02
To: Roberts, William C
Cc: Palmer, Duncan (Data61, Pullenvale); tpm2(a)lists.01.org
Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0

Actually some TPMs aren't reporting this value as part of the properties (tpm2_getcap -c properties-fixed IIRC) so it gets interpreted as 0.

Can you also confirm the maximum size of an NV_RAM area, or is it always bounded by MAX_NV_BUFFER_SIZE  ?

t.

Ian

On 25 April 2018 at 19:29, Roberts, William C <william.c.roberts(a)intel.com<mailto:william.c.roberts(a)intel.com>> wrote:
I have heard of this bug before but never encountered it. I looked at the PR:
https://github.com/tpm2-software/tpm2-tools/pull/1002

I heard as well that setting the buffer to something smaller than MAX size and that 512 bytes is recommended.
Someone actually polled the vendors to find out what buffer size is always a safe bet, and 512 was it.

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org<mailto:tpm2-bounces(a)lists.01.org>] On Behalf Of Ian Oliver
> Sent: Tuesday, April 24, 2018 7:48 AM
> To: Duncan.Palmer(a)data61.csiro.au<mailto:Duncan.Palmer(a)data61.csiro.au>
> Cc: tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>
> Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
>
> Thanks,
>
>
> We are seeing the same issue on the TPMs in our Intel NUCs .. Infineon 9655s ?
> Need to check tomorrow
>
>
> t.
>
>
> Ian
>
>
> On 24 April 2018 at 15:51, <Duncan.Palmer(a)data61.csiro.au<mailto:Duncan.Palmer(a)data61.csiro.au>
> <mailto:Duncan.Palmer(a)data61.csiro.au<mailto:Duncan.Palmer(a)data61.csiro.au>> > wrote:
>
>
>       Done. I hadn't submitted a pull request before as I was unsure whether
> this issue was related to the TPM I'm using (which doesn't seem commonly
> used), or more generally applicable.
>
>       Duncan Palmer
>       Senior Software Engineer | Autonomous Systems
>       Data61 | CSIRO
>       E duncan.palmer(a)csiro.au
>       Queensland Centre for Advanced Technologies (QCAT),
>       1 Technology Court, Pullenvale QLD, 4069
>       www.data61.csiro.au<http://www.data61.csiro.au> <http://www.data61.csiro.au>
>
>       CSIRO's Digital Productivity business unit and NICTA have joined forces to
> create digital powerhouse Data61
>
>       ________________________________________
>       From: Tadeusz Struk <tadeusz.struk(a)intel.com<mailto:tadeusz.struk(a)intel.com>
> <mailto:tadeusz.struk(a)intel.com<mailto:tadeusz.struk(a)intel.com>> >
>       Sent: 19 April 2018 04:17
>       To: Palmer, Duncan (Data61, Pullenvale); ian.justin.oliver(a)gmail.com<mailto:ian.justin.oliver(a)gmail.com>
> <mailto:ian.justin.oliver(a)gmail.com<mailto:ian.justin.oliver(a)gmail.com>> ; tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>
> <mailto:tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>>
>       Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
>
>
>       On 04/17/2018 03:24 PM, Duncan.Palmer(a)data61.csiro.au<mailto:Duncan.Palmer(a)data61.csiro.au>
> <mailto:Duncan.Palmer(a)data61.csiro.au<mailto:Duncan.Palmer(a)data61.csiro.au>>  wrote:
>       > We see the same behaviour on an Intel NUC5i7. I haven't looked at the
> capabilities reported by the TPM device on that platform. The attached patch
> (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is
> reported as 0), sorts the problem out.
>       >
>
>       Hi Duncan,
>       Could you please send a Pull Request with your fix to the tools repo.
>
>       Thanks,
>       --
>       Tadeusz
>
>
>
>
>
>
> --
>
> Dr. Ian Oliver
> ===============================
>
> Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
> Twitter: @i_j_oliver



--
Dr. Ian Oliver
===============================
Privacy Engineering:  via Amazon<http://www.amazon.co.uk/dp/1497569710>
Twitter: @i_j_oliver

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 8773 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-25 17:02 Ian Oliver
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Oliver @ 2018-04-25 17:02 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 3401 bytes --]

Actually some TPMs aren't reporting this value as part of the properties
(tpm2_getcap -c properties-fixed IIRC) so it gets interpreted as 0.

Can you also confirm the maximum size of an NV_RAM area, or is it always
bounded by MAX_NV_BUFFER_SIZE  ?

t.

Ian

On 25 April 2018 at 19:29, Roberts, William C <william.c.roberts(a)intel.com>
wrote:

> I have heard of this bug before but never encountered it. I looked at the
> PR:
> https://github.com/tpm2-software/tpm2-tools/pull/1002
>
> I heard as well that setting the buffer to something smaller than MAX size
> and that 512 bytes is recommended.
> Someone actually polled the vendors to find out what buffer size is always
> a safe bet, and 512 was it.
>
> > -----Original Message-----
> > From: tpm2 [mailto:tpm2-bounces(a)lists.01.org] On Behalf Of Ian Oliver
> > Sent: Tuesday, April 24, 2018 7:48 AM
> > To: Duncan.Palmer(a)data61.csiro.au
> > Cc: tpm2(a)lists.01.org
> > Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> >
> > Thanks,
> >
> >
> > We are seeing the same issue on the TPMs in our Intel NUCs .. Infineon
> 9655s ?
> > Need to check tomorrow
> >
> >
> > t.
> >
> >
> > Ian
> >
> >
> > On 24 April 2018 at 15:51, <Duncan.Palmer(a)data61.csiro.au
> > <mailto:Duncan.Palmer(a)data61.csiro.au> > wrote:
> >
> >
> >       Done. I hadn't submitted a pull request before as I was unsure
> whether
> > this issue was related to the TPM I'm using (which doesn't seem commonly
> > used), or more generally applicable.
> >
> >       Duncan Palmer
> >       Senior Software Engineer | Autonomous Systems
> >       Data61 | CSIRO
> >       E duncan.palmer(a)csiro.au
> >       Queensland Centre for Advanced Technologies (QCAT),
> >       1 Technology Court, Pullenvale QLD, 4069
> >       www.data61.csiro.au <http://www.data61.csiro.au>
> >
> >       CSIRO’s Digital Productivity business unit and NICTA have joined
> forces to
> > create digital powerhouse Data61
> >
> >       ________________________________________
> >       From: Tadeusz Struk <tadeusz.struk(a)intel.com
> > <mailto:tadeusz.struk(a)intel.com> >
> >       Sent: 19 April 2018 04:17
> >       To: Palmer, Duncan (Data61, Pullenvale);
> ian.justin.oliver(a)gmail.com
> > <mailto:ian.justin.oliver(a)gmail.com> ; tpm2(a)lists.01.org
> > <mailto:tpm2(a)lists.01.org>
> >       Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
> >
> >
> >       On 04/17/2018 03:24 PM, Duncan.Palmer(a)data61.csiro.au
> > <mailto:Duncan.Palmer(a)data61.csiro.au>  wrote:
> >       > We see the same behaviour on an Intel NUC5i7. I haven't looked
> at the
> > capabilities reported by the TPM device on that platform. The attached
> patch
> > (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is
> > reported as 0), sorts the problem out.
> >       >
> >
> >       Hi Duncan,
> >       Could you please send a Pull Request with your fix to the tools
> repo.
> >
> >       Thanks,
> >       --
> >       Tadeusz
> >
> >
> >
> >
> >
> >
> > --
> >
> > Dr. Ian Oliver
> > ===============================
> >
> > Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
> > Twitter: @i_j_oliver
>



-- 
*Dr. Ian Oliver*
===============================
Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
*Twitter: @i_j_oliver*

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 5833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-24 14:47 Ian Oliver
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Oliver @ 2018-04-24 14:47 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]

Thanks,

We are seeing the same issue on the TPMs in our Intel NUCs .. Infineon
9655s ?  Need to check tomorrow

t.

Ian

On 24 April 2018 at 15:51, <Duncan.Palmer(a)data61.csiro.au> wrote:

> Done. I hadn't submitted a pull request before as I was unsure whether
> this issue was related to the TPM I'm using (which doesn't seem commonly
> used), or more generally applicable.
>
> Duncan Palmer
> Senior Software Engineer | Autonomous Systems
> Data61 | CSIRO
> E duncan.palmer(a)csiro.au
> Queensland Centre for Advanced Technologies (QCAT),
> 1 Technology Court, Pullenvale QLD, 4069
> www.data61.csiro.au
>
> CSIRO’s Digital Productivity business unit and NICTA have joined forces to
> create digital powerhouse Data61
>
> ________________________________________
> From: Tadeusz Struk <tadeusz.struk(a)intel.com>
> Sent: 19 April 2018 04:17
> To: Palmer, Duncan (Data61, Pullenvale); ian.justin.oliver(a)gmail.com;
> tpm2(a)lists.01.org
> Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
>
> On 04/17/2018 03:24 PM, Duncan.Palmer(a)data61.csiro.au wrote:
> > We see the same behaviour on an Intel NUC5i7. I haven't looked at the
> capabilities reported by the TPM device on that platform. The attached
> patch (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is
> reported as 0), sorts the problem out.
> >
>
> Hi Duncan,
> Could you please send a Pull Request with your fix to the tools repo.
>
> Thanks,
> --
> Tadeusz
>
>


-- 
*Dr. Ian Oliver*
===============================
Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
*Twitter: @i_j_oliver*

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 2825 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-24 12:51 Duncan.Palmer
  0 siblings, 0 replies; 10+ messages in thread
From: Duncan.Palmer @ 2018-04-24 12:51 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

Done. I hadn't submitted a pull request before as I was unsure whether this issue was related to the TPM I'm using (which doesn't seem commonly used), or more generally applicable.

Duncan Palmer
Senior Software Engineer | Autonomous Systems
Data61 | CSIRO
E duncan.palmer(a)csiro.au
Queensland Centre for Advanced Technologies (QCAT),
1 Technology Court, Pullenvale QLD, 4069
www.data61.csiro.au

CSIRO’s Digital Productivity business unit and NICTA have joined forces to create digital powerhouse Data61

________________________________________
From: Tadeusz Struk <tadeusz.struk(a)intel.com>
Sent: 19 April 2018 04:17
To: Palmer, Duncan (Data61, Pullenvale); ian.justin.oliver(a)gmail.com; tpm2(a)lists.01.org
Subject: Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0

On 04/17/2018 03:24 PM, Duncan.Palmer(a)data61.csiro.au wrote:
> We see the same behaviour on an Intel NUC5i7. I haven't looked at the capabilities reported by the TPM device on that platform. The attached patch (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is reported as 0), sorts the problem out.
>

Hi Duncan,
Could you please send a Pull Request with your fix to the tools repo.

Thanks,
--
Tadeusz


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-18 18:17 Tadeusz Struk
  0 siblings, 0 replies; 10+ messages in thread
From: Tadeusz Struk @ 2018-04-18 18:17 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

On 04/17/2018 03:24 PM, Duncan.Palmer(a)data61.csiro.au wrote:
> We see the same behaviour on an Intel NUC5i7. I haven't looked at the capabilities reported by the TPM device on that platform. The attached patch (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is reported as 0), sorts the problem out.
> 

Hi Duncan,
Could you please send a Pull Request with your fix to the tools repo.

Thanks,
-- 
Tadeusz

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-18  8:07 Ian Oliver
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Oliver @ 2018-04-18  8:07 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 3727 bytes --]

Thank you!

This works perfectly.  For reference the Infineon SLB9670 TPM 2.0 does
correctly report TPM_PT_NV_BUFFER_MAX while the 9665 does not

Is this a committed patch to the master tools branch already?

t.

Ian

On 18 April 2018 at 01:24, <Duncan.Palmer(a)data61.csiro.au> wrote:

> We see the same behaviour on an Intel NUC5i7. I haven't looked at the
> capabilities reported by the TPM device on that platform. The attached
> patch (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is
> reported as 0), sorts the problem out.
>
>
> Dunk
>
>
> *Duncan Palmer*
> Senior Software Engineer | Autonomous Systems
> *Data61 | CSIRO*
>
> *E* duncan.palmer(a)csiro.au
>
> Queensland Centre for Advanced Technologies (QCAT),
>
> 1 Technology Court, Pullenvale QLD, 4069
> www.data61.csiro.au
> <http://my.csiro.au/Business-Units/Operations/Communication/CSIRO-Branding/Data61-Branding/www.data61.csiro.au>
>
>
> *CSIRO’s Digital Productivity business unit and NICTA have joined forces
> to create digital powerhouse Data61*
> ------------------------------
> *From:* tpm2 <tpm2-bounces(a)lists.01.org> on behalf of Ian Oliver <
> ian.justin.oliver(a)gmail.com>
> *Sent:* 17 April 2018 21:10
> *To:* tpm2(a)lists.01.org
> *Subject:* [tpm2] NVRAM_write, BUFFER_SIZE is 0
>
> Hi,
>
> we're having problems writing to NV_RAM with tpm2_nvwrite. We can define
> areas but not write
>
>
> *$ tpm2_nvlist*
> 0x1800005:
>   hash algorithm:
>     friendly: sha256
>     value: 0xB
>   attributes:
>     friendly: ownerwrite|policywrite|ownerread|written
>     value: 0xA000220
>   size: 32
>
>
>
>
> *$ echo -n "hello" | tpm2_nvwrite -x 0x1800005 -a 0x40000001 -V*
> INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to
> be written:
> INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
> area at index 0x1800005 (25165829) offset 0x0.
> INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to
> be written:
> INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
> area at index 0x1800005 (25165829) offset 0x0.
> INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to
> be written:
> INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
> area at index 0x1800005 (25165829) offset 0x0.
> INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to
> be written:
> INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
> area at index 0x1800005 (25165829) offset 0x0.
> INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to
> be written:
> INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
> area at index 0x1800005 (25165829) offset 0x0.
> …
> Which loops infinitely
>
>
> Relevant parts of the tpm2-tools and tpm2-tss code:
> *file: tpm2_nvwrite.c*
> 113     res = tpm2_util_nv_max_buffer_size(sapi_context, &max_data_size);
> The call to tpm2_nv_read_public should get the *TPM_PT_NV_BUFFER_MAX *capability
> but and store it to *max_data_size*.
> In that part of the code max_data_size gets set to 0 and that causes the
> loop above.
>
>
> The TPM_PT_NV_BUFFER_MAX seems not to be defined in the capabilities for
> this device: Infineon TPM 2.0 9665  as reported by tpm2_cap.
>
> t.
>
> Ian
>
>
> --
> *Dr. Ian Oliver*
> ===============================
> Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
> * Twitter: @i_j_oliver*
>



-- 
*Dr. Ian Oliver*
===============================
Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
*Twitter: @i_j_oliver*

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 10445 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-17 22:24 Duncan.Palmer
  0 siblings, 0 replies; 10+ messages in thread
From: Duncan.Palmer @ 2018-04-17 22:24 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 3045 bytes --]

We see the same behaviour on an Intel NUC5i7. I haven't looked at the capabilities reported by the TPM device on that platform. The attached patch (setting max_data_size = MAX_NV_BUFFER_SIZE when max_data_size is reported as 0), sorts the problem out.


Dunk


Duncan Palmer
Senior Software Engineer | Autonomous Systems
Data61 | CSIRO

E duncan.palmer(a)csiro.au

Queensland Centre for Advanced Technologies (QCAT),

1 Technology Court, Pullenvale QLD, 4069

www.data61.csiro.au<http://my.csiro.au/Business-Units/Operations/Communication/CSIRO-Branding/Data61-Branding/www.data61.csiro.au>


CSIRO's Digital Productivity business unit and NICTA have joined forces to create digital powerhouse Data61

________________________________
From: tpm2 <tpm2-bounces(a)lists.01.org> on behalf of Ian Oliver <ian.justin.oliver(a)gmail.com>
Sent: 17 April 2018 21:10
To: tpm2(a)lists.01.org
Subject: [tpm2] NVRAM_write, BUFFER_SIZE is 0

Hi,

we're having problems writing to NV_RAM with tpm2_nvwrite. We can define areas but not write


$ tpm2_nvlist
0x1800005:
  hash algorithm:
    friendly: sha256
    value: 0xB
  attributes:
    friendly: ownerwrite|policywrite|ownerread|written
    value: 0xA000220
  size: 32




$ echo -n "hello" | tpm2_nvwrite -x 0x1800005 -a 0x40000001 -V
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV area at index 0x1800005 (25165829) offset 0x0.
...
Which loops infinitely


Relevant parts of the tpm2-tools and tpm2-tss code:
file: tpm2_nvwrite.c
113     res = tpm2_util_nv_max_buffer_size(sapi_context, &max_data_size);
The call to tpm2_nv_read_public should get the TPM_PT_NV_BUFFER_MAX capability but and store it to max_data_size.
In that part of the code max_data_size gets set to 0 and that causes the loop above.


The TPM_PT_NV_BUFFER_MAX seems not to be defined in the capabilities for this device: Infineon TPM 2.0 9665  as reported by tpm2_cap.

t.

Ian


--
Dr. Ian Oliver
===============================
Privacy Engineering:  via Amazon<http://www.amazon.co.uk/dp/1497569710>
Twitter: @i_j_oliver

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 9270 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: max_data_size.patch --]
[-- Type: text/x-patch, Size: 1337 bytes --]

commit c60f3528a1d4d147f45cb73b3698f1395b67a647
Author: Duncan Palmer <duncan.palmer@csiro.au>
Date:   Fri Feb 9 10:01:36 2018 +1000

    tpm2_nv(read|write): use a default buffer size if TPM reports 0.
    
    On a NUC5i7RYH, the TPM reports it's max NV buffer size as 0, which
    means we can neither read nor write. In this case, default to
    MAX_NV_BUFFER_SIZE.

diff --git a/tools/tpm2_nvread.c b/tools/tpm2_nvread.c
index 9d71fd4..251eb5b 100644
--- a/tools/tpm2_nvread.c
+++ b/tools/tpm2_nvread.c
@@ -123,6 +123,9 @@ static bool nv_read(TSS2_SYS_CONTEXT *sapi_context, tpm2_option_flags flags) {
     if (max_data_size > MAX_NV_BUFFER_SIZE) {
         max_data_size = MAX_NV_BUFFER_SIZE;
     }
+    if (max_data_size == 0) {
+        max_data_size = MAX_NV_BUFFER_SIZE;
+    }
 
     UINT8 *data_buffer = malloc(data_size);
     if (!data_buffer) {
diff --git a/tools/tpm2_nvwrite.c b/tools/tpm2_nvwrite.c
index 278e733..14c0b0d 100644
--- a/tools/tpm2_nvwrite.c
+++ b/tools/tpm2_nvwrite.c
@@ -119,6 +119,9 @@ static bool nv_write(TSS2_SYS_CONTEXT *sapi_context) {
     if (max_data_size > MAX_NV_BUFFER_SIZE) {
         max_data_size = MAX_NV_BUFFER_SIZE;
     }
+    if (max_data_size == 0) {
+        max_data_size = MAX_NV_BUFFER_SIZE;
+    }
 
     UINT16 data_offset = 0;
     UINT16 bytes_left = ctx.nv_buffer.t.size;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [tpm2] NVRAM_write, BUFFER_SIZE is 0
@ 2018-04-17 11:10 Ian Oliver
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Oliver @ 2018-04-17 11:10 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 2120 bytes --]

Hi,

we're having problems writing to NV_RAM with tpm2_nvwrite. We can define
areas but not write


*$ tpm2_nvlist*
0x1800005:
  hash algorithm:
    friendly: sha256
    value: 0xB
  attributes:
    friendly: ownerwrite|policywrite|ownerread|written
    value: 0xA000220
  size: 32




*$ echo -n "hello" | tpm2_nvwrite -x 0x1800005 -a 0x40000001 -V*
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be
written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be
written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be
written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be
written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
area at index 0x1800005 (25165829) offset 0x0.
INFO on line: "135" in file: "tools/tpm2_nvwrite.c": The data(size=0) to be
written:
INFO on line: "149" in file: "tools/tpm2_nvwrite.c": Success to write NV
area at index 0x1800005 (25165829) offset 0x0.
…
Which loops infinitely


Relevant parts of the tpm2-tools and tpm2-tss code:
*file: tpm2_nvwrite.c*
113     res = tpm2_util_nv_max_buffer_size(sapi_context, &max_data_size);
The call to tpm2_nv_read_public should get the *TPM_PT_NV_BUFFER_MAX
*capability
but and store it to *max_data_size*.
In that part of the code max_data_size gets set to 0 and that causes the
loop above.


The TPM_PT_NV_BUFFER_MAX seems not to be defined in the capabilities for
this device: Infineon TPM 2.0 9665  as reported by tpm2_cap.

t.

Ian


-- 
*Dr. Ian Oliver*
===============================
Privacy Engineering:  via Amazon <http://www.amazon.co.uk/dp/1497569710>
*Twitter: @i_j_oliver*

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 6402 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-04-30 18:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25 16:29 [tpm2] NVRAM_write, BUFFER_SIZE is 0 Roberts, William C
  -- strict thread matches above, loose matches on Subject: below --
2018-04-30 18:12 Roberts, William C
2018-04-26 22:15 Duncan.Palmer
2018-04-25 17:02 Ian Oliver
2018-04-24 14:47 Ian Oliver
2018-04-24 12:51 Duncan.Palmer
2018-04-18 18:17 Tadeusz Struk
2018-04-18  8:07 Ian Oliver
2018-04-17 22:24 Duncan.Palmer
2018-04-17 11:10 Ian Oliver

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.