mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-12 19:25:06 +00:00
tpm2: Introduce TPMA_ZERO_INITIALIZER() and use it
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
530e2e14fd
commit
0569a67bc5
@ -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. */
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user