Skip to contentSkip to conversation

Build: Fix stubdom vtpm build failure

PATCH In review Quan Xu 3 participants 5 messages Mar 17, 2015 – Mar 18, 2015

lore
Share & tools
lore

Quan Xu

author
#0 lore raw

PATCH v2 1/1 Build: Fix stubdom vtpm build failure

Typedefs are duplicated in stubdom/vtpmmgr/tcg.h and supported compilers do not cope with current staging branch.

---
 stubdom/vtpmmgr/common_types.h |    9 +++++++++
 stubdom/vtpmmgr/tcg.h          |    7 +------
 stubdom/vtpmmgr/tpm2.c         |   10 +++++-----
 stubdom/vtpmmgr/tpm2.h         |    6 +++---
 stubdom/vtpmmgr/tpm2_types.h   |   43 +++++++++++++++-------------------------
 stubdom/vtpmmgr/vtpmmgr.h      |    4 ++--
 6 files changed, 36 insertions(+), 43 deletions(-)
 create mode 100644 stubdom/vtpmmgr/common_types.h
stubdom/vtpmmgr/common_types.h new file +9 -0
new file mode 100644
index 0000000..7321bb6
@@ -0,0 +1,9 @@
+#ifndef VTPM_COMMON_TYPES
+#define VTPM_COMMON_TYPES 1
+typedef unsigned char BYTE;
+typedef unsigned char BOOL;
+typedef unsigned char UINT8;
+typedef uint16_t UINT16;
+typedef uint32_t UINT32;
+typedef uint64_t UINT64;
+#endif
stubdom/vtpmmgr/tcg.h +1 -6
index 7321ec6..813ce57 100644
@@ -39,6 +39,7 @@
 
 #include <stdlib.h>
 #include <stdint.h>
+#include "common_types.h"
 
 // **************************** CONSTANTS *********************************
 
@@ -401,12 +402,6 @@
 
 
 // *************************** TYPEDEFS *********************************
-typedef unsigned char BYTE;
-typedef unsigned char BOOL;
-typedef uint16_t UINT16;
-typedef uint32_t UINT32;
-typedef uint64_t UINT64;
-
 typedef UINT32 TPM_RESULT;
 typedef UINT32 TPM_PCRINDEX;
 typedef UINT32 TPM_DIRINDEX;
stubdom/vtpmmgr/tpm2.c +5 -5
index 1903e27..c9f1016 100644
@@ -167,7 +167,7 @@ egress:
 TPM_RC TPM2_Load(TPMI_DH_OBJECT parentHandle,
                  TPM2B_PRIVATE *inPrivate, /* in */
                  TPM2B_PUBLIC *inPublic, /* in */
-                 TPM_HANDLE *objectHandle, /* out */
+                 TPM2_HANDLE *objectHandle, /* out */
                  TPM2B_NAME *name /* out */)
 {
     TPM_BEGIN(TPM_ST_SESSIONS, TPM_CC_Load);
@@ -185,7 +185,7 @@ TPM_RC TPM2_Load(TPMI_DH_OBJECT parentHandle,
     if (objectHandle != NULL) {
         ptr = unpack_TPM_HANDLE(ptr, objectHandle);
     } else {
-        TPM_HANDLE tmp;
+        TPM2_HANDLE tmp;
         ptr = unpack_TPM_HANDLE(ptr, &tmp);
     }
 
@@ -248,7 +248,7 @@ egress:
 
 TPM_RC TPM2_CreatePrimary(TPMI_RH_HIERARCHY primaryHandle,
                           TPM2_Create_Params_in *in,
-                          TPM_HANDLE *objHandle,
+                          TPM2_HANDLE *objHandle,
                           TPM2_Create_Params_out *out)
 {
     UINT32 param_size;
@@ -281,7 +281,7 @@ TPM_RC TPM2_CreatePrimary(TPMI_RH_HIERARCHY primaryHandle,
     if (objHandle != NULL)
         ptr = unpack_TPM_HANDLE(ptr, objHandle);
     else {
-        TPM_HANDLE handle;
+        TPM2_HANDLE handle;
         ptr = unpack_TPM_HANDLE(ptr, &handle);
     }
     ptr = unpack_UINT32(ptr, &param_size);
@@ -302,7 +302,7 @@ egress:
    return status;
 }
 
-TPM_RC TPM2_HierachyChangeAuth(TPMI_RH_HIERARCHY_AUTH authHandle, TPM2B_AUTH *newAuth)
+TPM_RC TPM2_HierachyChangeAuth(TPM2I_RH_HIERARCHY_AUTH authHandle, TPM2B_AUTH *newAuth)
 {
     TPM_BEGIN(TPM_ST_SESSIONS, TPM_CC_HierarchyChangeAuth);
     ptr = pack_UINT32(ptr, authHandle);
stubdom/vtpmmgr/tpm2.h +3 -3
index 9f597ee..9e01286 100644
@@ -57,7 +57,7 @@ TPM_RC TPM2_PCR_Read(TPML_PCR_SELECTION pcrSelectionIn,
 TPM_RC TPM2_Load(TPMI_DH_OBJECT parentHandle,
                  TPM2B_PRIVATE *inPrivate,
                  TPM2B_PUBLIC *inPublic,
-                 TPM_HANDLE *objectHandle,
+                 TPM2_HANDLE *objectHandle,
                  TPM2B_NAME *name);
 
 TPM_RC TPM2_Create(TPMI_DH_OBJECT parentHandle,
@@ -66,10 +66,10 @@ TPM_RC TPM2_Create(TPMI_DH_OBJECT parentHandle,
 
 TPM_RC TPM2_CreatePrimary(TPMI_RH_HIERARCHY primaryHandle,
                           TPM2_Create_Params_in *objHandle,
-                          TPM_HANDLE *in,
+                          TPM2_HANDLE *in,
                           TPM2_Create_Params_out *out);
 
-TPM_RC TPM2_HierachyChangeAuth(TPMI_RH_HIERARCHY_AUTH authHandle,
+TPM_RC TPM2_HierachyChangeAuth(TPM2I_RH_HIERARCHY_AUTH authHandle,
                                TPM2B_AUTH *newAuth);
 
 TPM_RC TPM2_RSA_ENCRYPT(TPMI_DH_OBJECT keyHandle,
stubdom/vtpmmgr/tpm2_types.h +16 -27

100 lines not on this page · raw message

stubdom/vtpmmgr/vtpmmgr.h +2 -2
index 46fd14f..2e6f8de 100644
@@ -76,8 +76,8 @@ struct vtpm_globals {
     /* TPM 2.0 */
     TPM_AuthArea       pw_auth;
     TPM_AuthArea       srk_auth_area;
-    TPM_HANDLE         srk_handle;
-    TPM_HANDLE         sk_handle;
+    TPM2_HANDLE        srk_handle;
+    TPM2_HANDLE        sk_handle;
     TPM2B_NAME         sk_name;
     TPM2_RSA_KEY       tpm2_storage_key;
 };
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 2 lines · Quan Xu

Typedefs are duplicated in stubdom/vtpmmgr/tcg.h and supported compilers do not cope with current staging branch.

This version finally compiles. Thanks!

Olaf

author
#2 lore raw

Olaf,
Thanks for your test.

Ian,
Could you help me check it again? Any comments, I will fix it soon.
If no any other comments, could you help me merge it? Thanks.

Quan

Quoted 16 lines

-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Tuesday, March 17, 2015 5:20 PM
To: Xu, Quan
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2] Build: Fix stubdom vtpm build failure

Quoted 2 lines · Quan Xu

Typedefs are duplicated in stubdom/vtpmmgr/tcg.h and supported compilers do not cope with current staging branch.

This version finally compiles. Thanks!

Olaf

#3 lore raw
In reply to Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Quan Xu

Typedefs are duplicated in stubdom/vtpmmgr/tcg.h and supported compilers do not cope with current staging branch.

This version finally compiles. Thanks!

Thanks. I translated this into a Tested-by and acked it myself, committed.

I made the subject "stubdom: fix vtpm build failure due to duplicated typedefs.", I hope that's ok.

Ian.

author
#4 lore raw

Thanks, ok.

Quan

Quoted 22 lines

-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Wednesday, March 18, 2015 8:02 PM
To: Olaf Hering
Cc: Xu, Quan; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2] Build: Fix stubdom vtpm build failure

Quoted 6 lines · Olaf Hering
Quoted 2 lines · Quan Xu

Typedefs are duplicated in stubdom/vtpmmgr/tcg.h and supported compilers do not cope with current staging branch.

This version finally compiles. Thanks!

Thanks. I translated this into a Tested-by and acked it myself, committed.

I made the subject "stubdom: fix vtpm build failure due to duplicated typedefs.", I hope that's ok.

Ian.