diff --git a/src/tpm2/CommandAttributeData.h b/src/tpm2/CommandAttributeData.h index 5c78f9f8..b4932590 100644 --- a/src/tpm2/CommandAttributeData.h +++ b/src/tpm2/CommandAttributeData.h @@ -64,7 +64,7 @@ #ifdef _COMMAND_CODE_ATTRIBUTES_ #include "CommandAttributes.h" -#if defined COMPRESSED_LISTS +#if COMPRESSED_LISTS # define PAD_LIST 0 #else # define PAD_LIST 1 diff --git a/src/tpm2/CommandCodeAttributes.c b/src/tpm2/CommandCodeAttributes.c index 5e389091..04b07250 100644 --- a/src/tpm2/CommandCodeAttributes.c +++ b/src/tpm2/CommandCodeAttributes.c @@ -84,7 +84,7 @@ typedef UINT16 ATTRIBUTE_TYPE; implemented. This function checks to see if the input commandIndex points to an implemented command and, if not, it searches upwards until it finds one. When the list is compressed, this function gets defined as a no-op. */ -#ifndef COMPRESSED_LISTS +#if !COMPRESSED_LISTS static COMMAND_INDEX NextImplementedIndex( COMMAND_INDEX commandIndex @@ -209,7 +209,7 @@ GetClosestCommandIndex( } else { -#ifdef COMPRESSED_LISTS +#if COMPRESSED_LISTS COMMAND_INDEX commandIndex = UNIMPLEMENTED_COMMAND_INDEX; COMMAND_INDEX min = 0; COMMAND_INDEX max = LIBRARY_COMMAND_ARRAY_SIZE - 1; @@ -268,7 +268,7 @@ CommandCodeToCommandIndex( COMMAND_INDEX searchIndex = (COMMAND_INDEX)commandCode; BOOL vendor = (commandCode & CC_VEND) != 0; COMMAND_INDEX commandIndex; -#if !defined COMPRESSED_LISTS +#if !COMPRESSED_LISTS if(!vendor) { commandIndex = searchIndex - (COMMAND_INDEX)s_ccAttr[0].commandIndex; @@ -308,7 +308,7 @@ GetNextCommandIndex( { while(++commandIndex < COMMAND_COUNT) { -#if !defined COMPRESSED_LISTS +#if !COMPRESSED_LISTS if(s_commandAttributes[commandIndex] & IS_IMPLEMENTED) #endif return commandIndex; @@ -511,7 +511,7 @@ CommandCapGetCCList( commandIndex != UNIMPLEMENTED_COMMAND_INDEX; commandIndex = GetNextCommandIndex(commandIndex)) { -#ifndef COMPRESSED_LISTS +#if !COMPRESSED_LISTS // this check isn't needed for compressed lists. if(!(s_commandAttributes[commandIndex] & IS_IMPLEMENTED)) continue; diff --git a/src/tpm2/CommandDispatcher.c b/src/tpm2/CommandDispatcher.c index 12a36cb0..ac49f5e2 100644 --- a/src/tpm2/CommandDispatcher.c +++ b/src/tpm2/CommandDispatcher.c @@ -101,7 +101,7 @@ typedef struct UINT16 typesOffset; // address of the types field UINT16 offsets[1]; } COMMAND_DESCRIPTOR_t; -#ifdef COMPRESSED_LISTS +#if COMPRESSED_LISTS # define PAD_LIST 0 #else # define PAD_LIST 1 diff --git a/src/tpm2/Implementation.h b/src/tpm2/Implementation.h index 0b8bb8b6..69a5146a 100644 --- a/src/tpm2/Implementation.h +++ b/src/tpm2/Implementation.h @@ -1347,12 +1347,12 @@ typedef UINT32 TPM_CC; #if CC_Vendor_TCG_Test == YES #define TPM_CC_Vendor_TCG_Test (TPM_CC)(0x20000000) #endif - -#ifndef COMPRESSED_LISTS -#define ADD_FILL 1 +#if COMPRESSED_LISTS +#define ADD_FILL 0 #else -#define ADD_FILL 0 +#define ADD_FILL 1 #endif + /* Size the array of library commands based on whether or not the array is packed (only defined commands) or dense (having entries for unimplemented commands) */ #define LIBRARY_COMMAND_ARRAY_SIZE (0 \ diff --git a/src/tpm2/PropertyCap.c b/src/tpm2/PropertyCap.c index 67a90fc1..422c7970 100644 --- a/src/tpm2/PropertyCap.c +++ b/src/tpm2/PropertyCap.c @@ -341,7 +341,7 @@ TPMPropertyIsDefined( // vendor-defined commands, this will be the same as the // number of library commands. { -#ifdef COMPRESSED_LISTS +#if COMPRESSED_LISTS (*value) = COMMAND_COUNT; #else COMMAND_INDEX commandIndex; @@ -359,7 +359,7 @@ TPMPropertyIsDefined( case TPM_PT_LIBRARY_COMMANDS: // number of commands from the TPM library that are implemented { -#ifdef COMPRESSED_LISTS +#if COMPRESSED_LISTS *value = LIBRARY_COMMAND_ARRAY_SIZE; #else COMMAND_INDEX commandIndex; diff --git a/src/tpm2/TpmBuildSwitches.h b/src/tpm2/TpmBuildSwitches.h index fd4f4000..a7b3835c 100644 --- a/src/tpm2/TpmBuildSwitches.h +++ b/src/tpm2/TpmBuildSwitches.h @@ -126,9 +126,13 @@ commands. Comment this out to use linear lists. */ /* NOTE: if vendor specific commands are present, the associated list is always in compressed form. */ -#ifndef COMPRESSED_LISTS -# define COMPRESSED_LISTS +#if !(defined COMPRESSED_LISTS) \ + || ((COMPRESSED_LISTS != NO) && (COMPRESSED_LISTS != YES)) +# undef COMPRESSED_LISTS +# define COMPRESSED_LISTS YES // Default: Either YES or NO #endif + + /* This switch indicates where clock epoch value should be stored. If this value defined, then it is assumed that the timer will change at any time so the nonce should be a random number kept in RAM. When it is not defined, then the timer only stops during power outages. */