Skip to contentSkip to conversation

TPM resource manager - persistent objects should be global

DISCUSSION Ken Goldman 3 participants 5 messages Mar 28, 2017 – Mar 31, 2017 3 messages not in the archive TPM device driver

lore
Share & tools
lore
#0 lore raw

I have a persistent object at 81000001.

getcapability through /dev/tpm0 shows it. The same command through /dev/tpmrm0 does not. This causes further problems in the application.

While transient objects are per connection, IMHO persistent objects should be global.

~~

Warning: I think I'm using the latest TPM device driver from

git://git.infradead.org/users/jjs/linux-tpmdd.git

but I'm new to both git and kernel building, so I could be wrong. If you think the above should work, it could be my error.

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

A message that is not in the archive (sent off-list or not yet received): e89db1e1-7996-3106-c034-e6d4c2c5f887-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#2 lore raw
Quoted 9 lines · Ken Goldman

I have a persistent object at 81000001.

getcapability through /dev/tpm0 shows it. The same command through /dev/tpmrm0 does not. This causes further problems in the application.

While transient objects are per connection, IMHO persistent objects should be global.

Quoted 8 lines

~~

Warning: I think I'm using the latest TPM device driver from

git://git.infradead.org/users/jjs/linux-tpmdd.git

but I'm new to both git and kernel building, so I could be wrong. If you think the above should work, it could be my error.

It should work. It turns out the body mapping code is overzealous and errors out when it should just pass through. The same thing happens with the PCRs as well.

This should fix it for both.

James

---

drivers/char/tpm/tpm2-space.c +2 -6
index 009934269514..e2e059d8ffec 100644
@@ -429,15 +429,11 @@ static int tpm2_map_response_body(struct tpm_chip *chip, u32 cc, u8 *rsp,
 			data->handles[j] = cpu_to_be32(vhandle);
 			j++;
 			break;
-		case TPM2_HT_HMAC_SESSION:
-		case TPM2_HT_POLICY_SESSION:
+
+		default:
 			data->handles[j] = cpu_to_be32(phandle);
 			j++;
 			break;
-		default:
-			dev_err(&chip->dev, "%s: unknown handle 0x%08X\n",
-				__func__, phandle);
-			break;
 		}
 
 	}

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

A message that is not in the archive (sent off-list or not yet received): 1490812802.5647.4.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#4 lore raw

Ken, James, thank you. I'll squash this before PR.

/Jarkko

Quoted 54 lines · James Bottomley
Quoted 9 lines · Ken Goldman

I have a persistent object at 81000001.

getcapability through /dev/tpm0 shows it. The same command through /dev/tpmrm0 does not. This causes further problems in the application.

While transient objects are per connection, IMHO persistent objects should be global.

Quoted 8 lines

~~

Warning: I think I'm using the latest TPM device driver from

git://git.infradead.org/users/jjs/linux-tpmdd.git

but I'm new to both git and kernel building, so I could be wrong. If you think the above should work, it could be my error.

It should work. It turns out the body mapping code is overzealous and errors out when it should just pass through. The same thing happens with the PCRs as well.

This should fix it for both.

James

---

drivers/char/tpm/tpm2-space.c +2 -7
index 009934269514..e2e059d8ffec 100644
@@ -429,15 +429,11 @@ static int tpm2_map_response_body(struct tpm_chip *chip, u32 cc, u8 *rsp,
 			data->handles[j] = cpu_to_be32(vhandle);
 			j++;
 			break;
-		case TPM2_HT_HMAC_SESSION:
-		case TPM2_HT_POLICY_SESSION:
+
+		default:
 			data->handles[j] = cpu_to_be32(phandle);
 			j++;
 			break;
-		default:
-			dev_err(&chip->dev, "%s: unknown handle 0x%08X\n",
-				__func__, phandle);
-			break;
 		}
 
 	}
 
 
------------------------------------------------------------------------------
Quoted 6 lines

Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

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

#5 lore raw
In reply to a message not in the archive

This patch worked. Can you merge it with Jarkko's latest?

I can report that my attestation client works unmodified with the resource manager. I just had to point it to /dev/tpmrm0. It's a Nuvoton TPM, I2C bus, POWER architecture.

It does quite a bit - transient and persistent objects, getcapability, reading NV indexes, policy sessions. I did the RSA and ECC variants in parallel, so there should have been a bit of swapping.

Quoted 42 lines · James Bottomley
Quoted 9 lines · Ken Goldman

I have a persistent object at 81000001.

getcapability through /dev/tpm0 shows it. The same command through /dev/tpmrm0 does not. This causes further problems in the application.

While transient objects are per connection, IMHO persistent objects should be global.

Quoted 8 lines

~~

Warning: I think I'm using the latest TPM device driver from

git://git.infradead.org/users/jjs/linux-tpmdd.git

but I'm new to both git and kernel building, so I could be wrong. If you think the above should work, it could be my error.

It should work. It turns out the body mapping code is overzealous and errors out when it should just pass through. The same thing happens with the PCRs as well.

This should fix it for both.

James

---

drivers/char/tpm/tpm2-space.c +2 -2
index 009934269514..e2e059d8ffec 100644
@@ -429,15 +429,11 @@ static int tpm2_map_response_body(struct tpm_chip *chip, u32 cc, u8 *rsp,
 			data->handles[j] = cpu_to_be32(vhandle);
 			j++;
 			break;
-		case TPM2_HT_HMAC_SESSION:
-		case TPM2_HT_POLICY_SESSION:
+
+		default:

drivers/char/tpm/tpm2-space.c static int tpm2_map_response_body(struct tpm_chip *chip, u32 cc, u8 *rsp, · line 439

Quoted 10 lines
drivers/char/tpm/tpm2-space.c +0 -4
 			data->handles[j] = cpu_to_be32(phandle);
 			j++;
 			break;
-		default:
-			dev_err(&chip->dev, "%s: unknown handle 0x%08X\n",
-				__func__, phandle);
-			break;
 		}
 
 	}

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

A message that is not in the archive (sent off-list or not yet received): 0a9a4380-e7cc-8927-e594-bbf5d9fa60c8-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#7 lore raw

The late fixes (2) are pushed to my master branch.

/Jarkko

Quoted 61 lines · Ken Goldman

This patch worked. Can you merge it with Jarkko's latest?

I can report that my attestation client works unmodified with the resource manager. I just had to point it to /dev/tpmrm0. It's a Nuvoton TPM, I2C bus, POWER architecture.

It does quite a bit - transient and persistent objects, getcapability, reading NV indexes, policy sessions. I did the RSA and ECC variants in parallel, so there should have been a bit of swapping.

Quoted 50 lines · James Bottomley
Quoted 9 lines · Ken Goldman

I have a persistent object at 81000001.

getcapability through /dev/tpm0 shows it. The same command through /dev/tpmrm0 does not. This causes further problems in the application.

While transient objects are per connection, IMHO persistent objects should be global.

Quoted 8 lines

~~

Warning: I think I'm using the latest TPM device driver from

git://git.infradead.org/users/jjs/linux-tpmdd.git

but I'm new to both git and kernel building, so I could be wrong. If you think the above should work, it could be my error.

It should work. It turns out the body mapping code is overzealous and errors out when it should just pass through. The same thing happens with the PCRs as well.

This should fix it for both.

James

---

drivers/char/tpm/tpm2-space.c +2 -6
index 009934269514..e2e059d8ffec 100644
@@ -429,15 +429,11 @@ static int tpm2_map_response_body(struct tpm_chip *chip, u32 cc, u8 *rsp,
 			data->handles[j] = cpu_to_be32(vhandle);
 			j++;
 			break;
-		case TPM2_HT_HMAC_SESSION:
-		case TPM2_HT_POLICY_SESSION:
+
+		default:
 			data->handles[j] = cpu_to_be32(phandle);
 			j++;
 			break;
-		default:
-			dev_err(&chip->dev, "%s: unknown handle 0x%08X\n",
-				__func__, phandle);
-			break;
 		}
 
Quoted 11 lines

drivers/char/tpm/tpm2-space.c static int tpm2_map_response_body(struct tpm_chip *chip, u32 cc, u8 *rsp, · line 439

Quoted 2 lines
drivers/char/tpm/tpm2-space.c +0 -0
 	}

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

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