Skip to contentSkip to conversation

vTPM/TPM2: Bind group keys and sectors data on disk

PATCH Superseded Quan Xu 2 participants 3 messages Dec 14, 2014 – Dec 16, 2014

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Quan Xu

author
#0 lore raw

PATCH 11/12 vTPM/TPM2: Bind group keys and sectors data on disk

---
 stubdom/vtpmmgr/disk_write.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)
stubdom/vtpmmgr/disk_write.c +20 -9
index 4c825c5..73018ef 100644
@@ -83,12 +83,18 @@ static void generate_group_seals(struct mem_group *src, const struct mem_tpm_mgr
 	if (src->nr_seals > NR_SEALS_PER_GROUP)
 		abort();
 
-	for(i=0; i < src->nr_seals; i++) {
+	for (i=0; i < src->nr_seals; i++) {
 		struct disk_seal_entry *dst = &src->seal_bits.entry[i];
-		dst->pcr_selection = src->seals[i].pcr_selection;
-		memcpy(&dst->digest_release, &src->seals[i].digest_release, 20);
-		TPM_pcr_digest(&dst->digest_at_seal, dst->pcr_selection);
-		TPM_disk_seal(dst, &sblob, sizeof(sblob));
+
+        /*TPM 2.0 bind | TPM 1.x seal*/
+        if (hw_is_tpm2()) {
+            TPM2_disk_bind(dst, &sblob, sizeof(sblob));
+        } else {
+            dst->pcr_selection = src->seals[i].pcr_selection;
+            memcpy(&dst->digest_release, &src->seals[i].digest_release, 20);
+            TPM_pcr_digest(&dst->digest_at_seal, dst->pcr_selection);
+            TPM_disk_seal(dst, &sblob, sizeof(sblob));
+        }
 	}
 	src->seal_bits.nr_cfgs = native_be32(src->nr_seals);
 
@@ -246,11 +252,16 @@ static void disk_write_seal_list(struct mem_tpm_mgr *mgr, struct mem_group *grou
 	for(i=0; i < group->nr_seals; i++) {
 		struct mem_seal *src = &group->seals[i];
 		struct disk_seal_entry *dst = &seal->entry[i];
-		dst->pcr_selection = src->pcr_selection;
-		memcpy(&dst->digest_release, &src->digest_release, 20);
-		TPM_pcr_digest(&dst->digest_at_seal, dst->pcr_selection);
 
-		TPM_disk_seal(dst, &sblob, sizeof(sblob));
+        /*TPM 2.0 bind / TPM 1.x seal*/
+        if (hw_is_tpm2()) {
+            TPM2_disk_bind(dst, &sblob, sizeof(sblob));
+        } else {
+            dst->pcr_selection = src->pcr_selection;
+            memcpy(&dst->digest_release, &src->digest_release, 20);
+            TPM_pcr_digest(&dst->digest_at_seal, dst->pcr_selection);
+            TPM_disk_seal(dst, &sblob, sizeof(sblob));
+        }
 	}
 
 	memcpy(seal->hdr.magic, TPM_MGR_MAGIC, 12);
Signature · 1 line
1.8.3.2
#1 lore raw

On 12/14/2014 07:09 AM, Quan Xu wrote:
[...]

stubdom/vtpmmgr/disk_write.c static void generate_group_seals(struct mem_group *src, const struct mem_tpm_mgr · line 97

Quoted 9 lines
stubdom/vtpmmgr/disk_write.c +9 -0
+        /*TPM 2.0 bind | TPM 1.x seal*/
+        if (hw_is_tpm2()) {
+            TPM2_disk_bind(dst, &sblob, sizeof(sblob));
+        } else {
+            dst->pcr_selection = src->seals[i].pcr_selection;
+            memcpy(&dst->digest_release, &src->seals[i].digest_release, 20);
+            TPM_pcr_digest(&dst->digest_at_seal, dst->pcr_selection);
+            TPM_disk_seal(dst, &sblob, sizeof(sblob));
+        }

It appears that the secrets for the vTPMs are only being bound to the presence of the physical TPM and not the measurements of the hypervisor and other TCB components. This does not provide as much security as it did for TPM 1.2: an attacker with access to the boot disk can boot into a compromised environment and extract the vTPM keys and disk images.

The TPM2_Create/TPM2_Unseal operations should be capable of performing the same functionality. If only SHA1 PCRs are used, they should be able to be drop-in replacements, but supporting other hash algorithms may be a feature that users who have a TPM2 will want.

Signature · 2 lines
Daniel De Graaf
National Security Agency
author
#2 lore raw
Quoted 23 lines

-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Monday, December 15, 2014 11:56 PM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 11/12] vTPM/TPM2: Bind group keys and sectors data on disk

On 12/14/2014 07:09 AM, Quan Xu wrote:
[...]

stubdom/vtpmmgr/disk_write.c static void generate_group_seals(struct mem_group *src, const struct mem_tpm_mgr

Quoted 6 lines
stubdom/vtpmmgr/disk_write.c +6 -0
+        /*TPM 2.0 bind | TPM 1.x seal*/
+        if (hw_is_tpm2()) {
+            TPM2_disk_bind(dst, &sblob, sizeof(sblob));
+        } else {
+            dst->pcr_selection = src->seals[i].pcr_selection;
+            memcpy(&dst->digest_release, &src->seals[i].digest_release,

20);

stubdom/vtpmmgr/disk_write.c static void generate_group_seals(struct mem_group *src, const struct mem_tpm_mgr · line 97

Quoted 3 lines
stubdom/vtpmmgr/disk_write.c +3 -0
+            TPM_pcr_digest(&dst->digest_at_seal, dst->pcr_selection);
+            TPM_disk_seal(dst, &sblob, sizeof(sblob));
+        }
Quoted 6 lines

It appears that the secrets for the vTPMs are only being bound to the presence of the physical TPM and not the measurements of the hypervisor and other TCB components. This does not provide as much security as it did for TPM 1.2: an attacker with access to the boot disk can boot into a compromised environment and extract the vTPM keys and disk images.

Agree with it.
I will bind more information, such as measurements of the hypervisor and other TCB components In next version.

Quoted 5 lines

The TPM2_Create/TPM2_Unseal operations should be capable of performing the same functionality. If only SHA1 PCRs are used, they should be able to be drop-in replacements, but supporting other hash algorithms may be a feature that users who have a TPM2 will want.

Interesting:)..
I will continue to develop and maintain vTPM on TPM 2.0. Make it stable and robust.

Quoted 3 lines

--
Daniel De Graaf
National Security Agency

Intel
Quan Xu