Skip to contentSkip to conversation

tpm: Fix expected number of response bytes of TPM1.2 PCR Extend

PATCH In review Stefan Berger 4 participants 6 messages Feb 15, 2017 – Feb 17, 2017 1 message not in the archive TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: Fix expected number of response bytes of TPM1.2 PCR Extend

The TPM1.2 PCR Extend operation only returns 20 bytes in the body, which is the size of the PCR state.

This fixes a problem where IMA gets errors with every PCR Extend.

Fixes c659af78eb7b ("tpm: Check size of response before accessing data")
---
 drivers/char/tpm/tpm-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm-interface.c +1 -1
index 6e368ee..bd2128e 100644
@@ -767,7 +767,7 @@ EXPORT_SYMBOL_GPL(tpm_pcr_read);
 
 #define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
 #define EXTEND_PCR_RESULT_SIZE 34
-#define EXTEND_PCR_RESULT_BODY_SIZE 24
+#define EXTEND_PCR_RESULT_BODY_SIZE 20
 static const struct tpm_input_header pcrextend_header = {
 	.tag = TPM_TAG_RQU_COMMAND,
 	.length = cpu_to_be32(34),
Signature · 1 line
2.4.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Stefan Berger

The TPM1.2 PCR Extend operation only returns 20 bytes in the body, which is the size of the PCR state.

This fixes a problem where IMA gets errors with every PCR Extend.

Fixes c659af78eb7b ("tpm: Check size of response before accessing data")

/Jarkko

Quoted 20 lines
---
 drivers/char/tpm/tpm-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm-interface.c +1 -1
index 6e368ee..bd2128e 100644
@@ -767,7 +767,7 @@ EXPORT_SYMBOL_GPL(tpm_pcr_read);
 
 #define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
 #define EXTEND_PCR_RESULT_SIZE 34
-#define EXTEND_PCR_RESULT_BODY_SIZE 24
+#define EXTEND_PCR_RESULT_BODY_SIZE 20
 static const struct tpm_input_header pcrextend_header = {
 	.tag = TPM_TAG_RQU_COMMAND,
 	.length = cpu_to_be32(34),
Signature · 1 line
2.4.3

A message that is not in the archive (sent off-list or not yet received): 20170215180903.3simazptqnlhbqi6-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#3 lore raw
Quoted 17 lines · Jarkko Sakkinen
Quoted 8 lines · Stefan Berger

The TPM1.2 PCR Extend operation only returns 20 bytes in the body, which is the size of the PCR state.

This fixes a problem where IMA gets errors with every PCR Extend.

Fixes c659af78eb7b ("tpm: Check size of response before accessing data")

/Jarkko

Quoted 4 lines
---
  drivers/char/tpm/tpm-interface.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines

drivers/char/tpm/tpm-interface.c EXPORT_SYMBOL_GPL(tpm_pcr_read); · line 769

Quoted 8 lines
drivers/char/tpm/tpm-interface.c +0 -0
index 6e368ee..bd2128e 100644
@@ -767,7 +767,7 @@ EXPORT_SYMBOL_GPL(tpm_pcr_read);
 
  #define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
  #define EXTEND_PCR_RESULT_SIZE 34

We should probably rename the above to EXTEND_PCR_BUFFER_SIZE. It's the input buffer that's size 34, the output is 30 bytes.

Stefan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

#4 lore raw
In reply to Jarkko Sakkinen

Hi James,

Quoted 11 lines · Jarkko Sakkinen
Quoted 8 lines · Stefan Berger

The TPM1.2 PCR Extend operation only returns 20 bytes in the body, which is the size of the PCR state.

This fixes a problem where IMA gets errors with every PCR Extend.

Fixes c659af78eb7b ("tpm: Check size of response before accessing data")

This patch needs to be included with the rest of the patches being
upstreamed in the next open window. Should Jarkko or I send you a pull
request for it?

thanks,

Mimi

#5 lore raw
Quoted 15 lines · Mimi Zohar

Hi James,

Quoted 11 lines · Jarkko Sakkinen
Quoted 8 lines · Stefan Berger

The TPM1.2 PCR Extend operation only returns 20 bytes in the body, which is the size of the PCR state.

This fixes a problem where IMA gets errors with every PCR Extend.

Fixes c659af78eb7b ("tpm: Check size of response before accessing data")
Quoted 7 lines

This patch needs to be included with the rest of the patches being
upstreamed in the next open window. Should Jarkko or I send you a pull
request for it?

thanks,

Mimi

I'm sending a pull request after the weekend. It will contain only a few small scoped fixes so wouldn't it be easiest if I just include this to the pack?

/Jarkko

#6 lore raw
Quoted 16 lines · Jarkko Sakkinen
Quoted 15 lines · Mimi Zohar

Hi James,

Quoted 11 lines · Jarkko Sakkinen
Quoted 8 lines · Stefan Berger

The TPM1.2 PCR Extend operation only returns 20 bytes in the body, which is the size of the PCR state.

This fixes a problem where IMA gets errors with every PCR Extend.

Fixes c659af78eb7b ("tpm: Check size of response before accessing data")
Quoted 7 lines
Quoted 3 lines

This patch needs to be included with the rest of the patches being
upstreamed in the next open window. Should Jarkko or I send you a pull
request for it?

I'm sending a pull request after the weekend. It will contain only a few small scoped fixes so wouldn't it be easiest if I just include this to the pack?

As long as it makes it into the James' pull request to Linus, that's fine.

Mimi

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot