diff --git a/src/tpm2/CommandAttributeData.h b/src/tpm2/CommandAttributeData.h index f26b8392..74ec635a 100644 --- a/src/tpm2/CommandAttributeData.h +++ b/src/tpm2/CommandAttributeData.h @@ -441,7 +441,7 @@ const TPMA_CC s_ccAttr [] = { TPMA_CC_INITIALIZER(0x0000, 0, 0, 0, 0, 0, 0, 1, 0), #endif - 0 + TPMA_ZERO_INITIALIZER() }; /* This is the command code attribute structure. */ diff --git a/src/tpm2/GpMacros.h b/src/tpm2/GpMacros.h index 55b88874..620300b7 100644 --- a/src/tpm2/GpMacros.h +++ b/src/tpm2/GpMacros.h @@ -309,12 +309,14 @@ # define SET_ATTRIBUTE(a, type, b) (a.b = SET) # define CLEAR_ATTRIBUTE(a, type, b) (a.b = CLEAR) # define GET_ATTRIBUTE(a, type, b) (a.b) +# define TPMA_ZERO_INITIALIZER() {0} #else # define IS_ATTRIBUTE(a, type, b) ((a & type##_##b) != 0) # define SET_ATTRIBUTE(a, type, b) (a |= type##_##b) # define CLEAR_ATTRIBUTE(a, type, b) (a &= ~type##_##b) # define GET_ATTRIBUTE(a, type, b) \ (type)((a & type##_##b) >> type##_##b##_SHIFT) +# define TPMA_ZERO_INITIALIZER() (0) #endif #define VERIFY(_X) if(!(_X)) goto Error // These macros determine if the values in this file are referenced or instanced. diff --git a/src/tpm2/Object_spt.c b/src/tpm2/Object_spt.c index 1c5f5b5a..167c4491 100644 --- a/src/tpm2/Object_spt.c +++ b/src/tpm2/Object_spt.c @@ -3,7 +3,7 @@ /* Object Command Support */ /* Written by Ken Goldman */ /* IBM Thomas J. Watson Research Center */ -/* $Id: Object_spt.c 1490 2019-07-26 21:13:22Z kgoldman $ */ +/* $Id: Object_spt.c 1519 2019-11-15 20:43:51Z kgoldman $ */ /* */ /* Licenses and Notices */ /* */ @@ -569,7 +569,7 @@ PublicAttributesValidation( ) { TPMA_OBJECT attributes = publicArea->objectAttributes; - TPMA_OBJECT parentAttributes = {0}; + TPMA_OBJECT parentAttributes = TPMA_ZERO_INITIALIZER(); // if(parentObject != NULL) parentAttributes = parentObject->publicArea.objectAttributes; diff --git a/src/tpm2/PropertyCap.c b/src/tpm2/PropertyCap.c index 4860d6e4..5c933187 100644 --- a/src/tpm2/PropertyCap.c +++ b/src/tpm2/PropertyCap.c @@ -3,7 +3,7 @@ /* For accessing the TPM_CAP_TPM_PROPERTY values */ /* Written by Ken Goldman */ /* IBM Thomas J. Watson Research Center */ -/* $Id: PropertyCap.c 1490 2019-07-26 21:13:22Z kgoldman $ */ +/* $Id: PropertyCap.c 1519 2019-11-15 20:43:51Z kgoldman $ */ /* */ /* Licenses and Notices */ /* */ @@ -55,7 +55,7 @@ /* arising in any way out of use or reliance upon this specification or any */ /* information herein. */ /* */ -/* (c) Copyright IBM Corp. and others, 2016 - 2018 */ +/* (c) Copyright IBM Corp. and others, 2016 - 2019 */ /* */ /********************************************************************************/ @@ -205,7 +205,7 @@ TPMPropertyIsDefined( { TPMA_MEMORY att; UINT32 u32; - } attributes = {0}; + } attributes = { TPMA_ZERO_INITIALIZER() }; SET_ATTRIBUTE(attributes.att, TPMA_MEMORY, sharedNV); SET_ATTRIBUTE(attributes.att, TPMA_MEMORY, objectCopiedToRam); // Note: For a LSb0 machine, the bits in a bit field are in the correct @@ -399,7 +399,7 @@ TPMPropertyIsDefined( union { TPMA_PERMANENT attr; UINT32 u32; - } flags = {0}; + } flags = { TPMA_ZERO_INITIALIZER() }; if(gp.ownerAuth.t.size != 0) SET_ATTRIBUTE(flags.attr, TPMA_PERMANENT, ownerAuthSet); if(gp.endorsementAuth.t.size != 0) @@ -425,7 +425,7 @@ TPMPropertyIsDefined( union { TPMA_STARTUP_CLEAR attr; UINT32 u32; - } flags = {0}; + } flags = { TPMA_ZERO_INITIALIZER() }; // if(g_phEnable) SET_ATTRIBUTE(flags.attr, TPMA_STARTUP_CLEAR, phEnable);