Skip to contentSkip to conversation

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

PATCH Superseded Quan Xu 1 participant 2 messages Dec 17, 2014 – Dec 18, 2014

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Quan Xu

author
#0 lore raw

PATCH v2 13/14 vTPM/TPM2: Unind group keys and sectors data on disk

---
 stubdom/vtpmmgr/disk_read.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
stubdom/vtpmmgr/disk_read.c +14 -2
index 33aacdd..e147e90 100644
@@ -88,7 +88,13 @@ static int find_group_key(struct mem_group *dst,
 		TPM_pcr_digest(&buf, cfg->pcr_selection);
 		if (memcmp(&buf, &cfg->digest_release, 20))
 			continue;
-		rc = TPM_disk_unseal(&sealed, sizeof(sealed), cfg);
+
+        /*TPM 2.0 unbind | TPM 1.x unseal*/
+        if (hw_is_tpm2())
+            rc = TPM2_disk_unbind(&sealed, &olen, cfg);
+        else
+            rc = TPM_disk_unseal(&sealed, sizeof(sealed), cfg);
+
 		if (rc)
 			continue;
 		if (memcmp(&sealed.magic, DISK_GROUP_BOUND_MAGIC, 4))
@@ -112,9 +118,15 @@ static int find_group_key(struct mem_group *dst,
 static int parse_root_key(struct mem_tpm_mgr *dst, struct disk_seal_entry *src)
 {
 	int rc;
+    unsigned int olen;
 	struct disk_root_sealed_data sealed;
 
-	rc = TPM_disk_unseal(&sealed, sizeof(sealed), src);
+    /*TPM 2.0 unbind | TPM 1.x unseal*/
+    if (hw_is_tpm2())
+        rc = TPM2_disk_unbind(&sealed, &olen, src);
+    else
+        rc = TPM_disk_unseal(&sealed, sizeof(sealed), src);
+
 	if (rc)
 		return rc;
 
Signature · 1 line
1.8.3.2
author
#1 lore raw

stubdom/vtpmmgr/disk_read.c static int find_group_key(struct mem_group *dst,

Quoted 21 lines

-----Original Message-----
From: Xu, Quan
Sent: Wednesday, December 17, 2014 7:52 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Xu, Quan
Subject: [PATCH v2 13/14] vTPM/TPM2: Unind group keys and sectors data on disk

---
 stubdom/vtpmmgr/disk_read.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
stubdom/vtpmmgr/disk_read.c +0 -0
index 33aacdd..e147e90 100644
@@ -88,7 +88,13 @@ static int find_group_key(struct mem_group *dst,

Should define 'olen' parameter. Missing it when I split it into patch. :( , I will add it in v3 with your comments fix.

     int i, rc, rv = 1;
+    unsigned int olen;
     struct hash160 buf;
Quoted 33 lines
stubdom/vtpmmgr/disk_read.c +7 -2
 		TPM_pcr_digest(&buf, cfg->pcr_selection);
 		if (memcmp(&buf, &cfg->digest_release, 20))
 			continue;
-		rc = TPM_disk_unseal(&sealed, sizeof(sealed), cfg);
+
+        /*TPM 2.0 unbind | TPM 1.x unseal*/
+        if (hw_is_tpm2())
+            rc = TPM2_disk_unbind(&sealed, &olen, cfg);
+        else
+            rc = TPM_disk_unseal(&sealed, sizeof(sealed), cfg);
+
 		if (rc)
 			continue;
 		if (memcmp(&sealed.magic, DISK_GROUP_BOUND_MAGIC, 4)) @@
-112,9 +118,15 @@ static int find_group_key(struct mem_group *dst,

static int parse_root_key(struct mem_tpm_mgr *dst, struct disk_seal_entry *src) {

stubdom/vtpmmgr/disk_read.c +7 -2
 	int rc;
+    unsigned int olen;
 	struct disk_root_sealed_data sealed;
 
-	rc = TPM_disk_unseal(&sealed, sizeof(sealed), src);
+    /*TPM 2.0 unbind | TPM 1.x unseal*/
+    if (hw_is_tpm2())
+        rc = TPM2_disk_unbind(&sealed, &olen, src);
+    else
+        rc = TPM_disk_unseal(&sealed, sizeof(sealed), src);
+
 	if (rc)
 		return rc;
 
--

1.8.3.2