[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Build: Fix stubdom vtpm build failure



Olaf,
        Could you help me test this patch in SLE_11_SP3/openSUSE_11.4?

Quan

> -----Original Message-----
> From: Xu, Quan
> Sent: Saturday, March 14, 2015 10:37 AM
> To: olaf@xxxxxxxxx; ian.campbell@xxxxxxxxxx
> Cc: xen-devel@xxxxxxxxxxxxx; dgdegra@xxxxxxxxxxxxx;
> andrew.cooper3@xxxxxxxxxx; Xu, Quan
> Subject: [PATCH] Build: Fix stubdom vtpm build failure
> 
> Typedefs are duplicated in stubdom/vtpmmgr/tcg.h and supported compilers do
> not cope with current staging branch.
> 
> Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
> Signed-off-by: Quan Xu <quan.xu@xxxxxxxxx>
> ---
>  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   |   42
> +++++++++++++++-------------------------
>  stubdom/vtpmmgr/vtpmmgr.h      |    4 ++--
>  6 files changed, 36 insertions(+), 42 deletions(-)  create mode 100644
> stubdom/vtpmmgr/common_types.h
> 
> diff --git a/stubdom/vtpmmgr/common_types.h
> b/stubdom/vtpmmgr/common_types.h new file mode 100644 index
> 0000000..7321bb6
> --- /dev/null
> +++ b/stubdom/vtpmmgr/common_types.h
> @@ -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
> diff --git a/stubdom/vtpmmgr/tcg.h b/stubdom/vtpmmgr/tcg.h index
> 7321ec6..813ce57 100644
> --- a/stubdom/vtpmmgr/tcg.h
> +++ b/stubdom/vtpmmgr/tcg.h
> @@ -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;
> diff --git a/stubdom/vtpmmgr/tpm2.c b/stubdom/vtpmmgr/tpm2.c index
> 1903e27..c9f1016 100644
> --- a/stubdom/vtpmmgr/tpm2.c
> +++ b/stubdom/vtpmmgr/tpm2.c
> @@ -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); diff --git a/stubdom/vtpmmgr/tpm2.h
> b/stubdom/vtpmmgr/tpm2.h index 9f597ee..9e01286 100644
> --- a/stubdom/vtpmmgr/tpm2.h
> +++ b/stubdom/vtpmmgr/tpm2.h
> @@ -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, diff --git
> a/stubdom/vtpmmgr/tpm2_types.h b/stubdom/vtpmmgr/tpm2_types.h index
> ac2830d..d2e1311 100644
> --- a/stubdom/vtpmmgr/tpm2_types.h
> +++ b/stubdom/vtpmmgr/tpm2_types.h
> @@ -3,6 +3,7 @@
> 
>  #include <stdlib.h>
>  #include <stdint.h>
> +#include "common_types.h"
> 
>  // "implementation.h"
>  // Table 212 -- Logic Values
> @@ -82,14 +83,6 @@
>  #define    MAX_ECC_KEY_BITS     256
>  #define    MAX_ECC_KEY_BYTES    ((MAX_ECC_KEY_BITS + 7) / 8)
> 
> -
> -typedef unsigned char BYTE;
> -typedef unsigned char BOOL;
> -typedef uint8_t       UINT8;
> -typedef uint16_t      UINT16;
> -typedef uint32_t      UINT32;
> -typedef uint64_t      UINT64;
> -
>  // TPM2 command code
> 
>  typedef UINT32 TPM_CC;
> @@ -216,7 +209,7 @@ typedef UINT16 TPM_ST;
> 
> 
>  // TPM Handle types
> -typedef UINT32 TPM_HANDLE;
> +typedef UINT32 TPM2_HANDLE;
>  typedef UINT8 TPM_HT;
> 
> 
> @@ -261,50 +254,47 @@ typedef BYTE TPMA_LOCALITY;  // Table 37 --
> TPMI_YES_NO Type <I/O>  typedef BYTE TPMI_YES_NO;
> 
> -typedef TPM_HANDLE TPMI_RH_HIERARCHY_AUTH;
> -
>  // Table 38 -- TPMI_DH_OBJECT Type <I/O> -typedef TPM_HANDLE
> TPMI_DH_OBJECT;
> +typedef TPM2_HANDLE TPMI_DH_OBJECT;
> 
>  // Table 39 -- TPMI_DH_PERSISTENT Type <I/O> -typedef TPM_HANDLE
> TPMI_DH_PERSISTENT;
> +typedef TPM2_HANDLE TPMI_DH_PERSISTENT;
> 
>  // Table 42 -- TPMI_SH_AUTH_SESSION Type <I/O> -typedef TPM_HANDLE
> TPMI_SH_AUTH_SESSION;
> +typedef TPM2_HANDLE TPMI_SH_AUTH_SESSION;
> 
>  // Table 40 -- TPMI_DH_ENTITY Type <I>
> -typedef TPM_HANDLE TPMI_DH_ENTITY;
> +typedef TPM2_HANDLE TPMI_DH_ENTITY;
> 
>  // Table 45 -- TPMI_DH_CONTEXT Type <I/O> -typedef TPM_HANDLE
> TPMI_DH_CONTEXT;
> +typedef TPM2_HANDLE TPMI_DH_CONTEXT;
> 
>  // Table 46 -- TPMI_RH_HIERARCHY Type <I/O> -typedef TPM_HANDLE
> TPMI_RH_HIERARCHY;
> +typedef TPM2_HANDLE TPMI_RH_HIERARCHY;
> 
> -// Table 47 -- TPMI_RH_HIERARCHY_AUTH Type <I> -typedef TPM_HANDLE
> TPMI_RH_HIERARCHY_AUTH;
> +// Table 47 -- TPM2I_RH_HIERARCHY_AUTH Type <I> typedef TPM2_HANDLE
> +TPM2I_RH_HIERARCHY_AUTH;
> 
>  // Table 48 -- TPMI_RH_PLATFORM Type <I> -typedef TPM_HANDLE
> TPMI_RH_PLATFORM;
> +typedef TPM2_HANDLE TPMI_RH_PLATFORM;
> 
>  // Table 49 -- TPMI_RH_OWNER Type <I>
> -typedef TPM_HANDLE TPMI_RH_OWNER;
> +typedef TPM2_HANDLE TPMI_RH_OWNER;
> 
>  // Table 50 -- TPMI_RH_ENDORSEMENT Type <I> -typedef TPM_HANDLE
> TPMI_RH_ENDORSEMENT;
> +typedef TPM2_HANDLE TPMI_RH_ENDORSEMENT;
> 
>  // Table 51 -- TPMI_RH_PROVISION Type <I> -typedef TPM_HANDLE
> TPMI_RH_PROVISION;
> +typedef TPM2_HANDLE TPMI_RH_PROVISION;
> 
>  // Table 52 -- TPMI_RH_CLEAR Type <I>
> -typedef TPM_HANDLE TPMI_RH_CLEAR;
> +typedef TPM2_HANDLE TPMI_RH_CLEAR;
> 
>  // Table 54 -- TPMI_RH_LOCKOUT Type <I> -typedef TPM_HANDLE
> TPMI_RH_LOCKOUT;
> +typedef TPM2_HANDLE TPMI_RH_LOCKOUT;
> 
>  // Table 7 -- TPM_ALG_ID
>  typedef UINT16 TPM_ALG_ID;
> -typedef UINT16 TPM_ALG_ID;
> 
>  #define    TPM2_ALG_ERROR             (TPM_ALG_ID)(0x0000) // a: ; D:
>  #define    TPM2_ALG_FIRST             (TPM_ALG_ID)(0x0001) // a: ; D:
> diff --git a/stubdom/vtpmmgr/vtpmmgr.h b/stubdom/vtpmmgr/vtpmmgr.h
> index 46fd14f..2e6f8de 100644
> --- a/stubdom/vtpmmgr/vtpmmgr.h
> +++ b/stubdom/vtpmmgr/vtpmmgr.h
> @@ -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;
>  };
> --
> 1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.