mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-12 21:35:50 +00:00
rev148: Rework COMPRESSED_LIST
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
c12e8fd47a
commit
5c45518fae
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 \
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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. */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user