mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-07 05:59:50 +00:00
Sync: Fix and extend compile-time testing of NUM_AUTHVALUE_PCR_GROUP
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
8b437483c8
commit
96424c2e4c
@ -1014,12 +1014,14 @@ typedef struct state_clear_data
|
||||
// The set of PCR to be saved on Shutdown(STATE)
|
||||
PCR_SAVE pcrSave; // default reset is 0...0
|
||||
|
||||
# if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0
|
||||
// This structure hold the authorization values for those PCR that have an
|
||||
// update authorization.
|
||||
// This implementation only supports a single group of PCR controlled by
|
||||
// authorization. If more are required, then this structure would be changed to
|
||||
// an array.
|
||||
PCR_AUTHVALUE pcrAuthValues;
|
||||
# endif
|
||||
|
||||
#ifndef __ACT_DISABLED // libtpms added
|
||||
//*****************************************************************************
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
//** Includes, Defines, and Data Definitions
|
||||
#define PCR_C
|
||||
#include "Tpm.h"
|
||||
#include <tpm_public/GpMacros.h>
|
||||
|
||||
// verify values from pcrstruct.h. not <= because group #0 is reserved
|
||||
// indicating no auth/policy support
|
||||
@ -59,7 +60,8 @@ BOOL PCRBelongsAuthGroup(TPMI_DH_PCR handle, // IN: handle of PCR
|
||||
pAssert_BOOL(*groupIndex < NUM_AUTHVALUE_PCR_GROUP);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#else
|
||||
NOT_REFERENCED(handle);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
@ -95,6 +97,8 @@ BOOL PCRBelongsPolicyGroup(
|
||||
pAssert_BOOL(*groupIndex < NUM_POLICY_PCR_GROUP);
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
NOT_REFERENCED(handle);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
@ -114,6 +118,7 @@ static BOOL PCRBelongsTCBGroup(TPMI_DH_PCR handle // IN: handle of PCR
|
||||
_platPcr__GetPcrInitializationAttributes(pcr);
|
||||
return currentPcrAttributes.doNotIncrementPcrCounter;
|
||||
#else
|
||||
NOT_REFERENCED(handle);
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
@ -137,6 +142,7 @@ BOOL PCRPolicyIsAvailable(TPMI_DH_PCR handle // IN: PCR handle
|
||||
TPM2B_AUTH* PCRGetAuthValue(TPMI_DH_PCR handle // IN: PCR handle
|
||||
)
|
||||
{
|
||||
#if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0
|
||||
UINT32 groupIndex;
|
||||
|
||||
if(PCRBelongsAuthGroup(handle, &groupIndex))
|
||||
@ -144,6 +150,9 @@ TPM2B_AUTH* PCRGetAuthValue(TPMI_DH_PCR handle // IN: PCR handle
|
||||
return &gc.pcrAuthValues.auth[groupIndex];
|
||||
}
|
||||
else
|
||||
#else
|
||||
NOT_REFERENCED(handle);
|
||||
#endif
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -158,6 +167,7 @@ PCRGetAuthPolicy(TPMI_DH_PCR handle, // IN: PCR handle
|
||||
TPM2B_DIGEST* policy // OUT: policy of PCR
|
||||
)
|
||||
{
|
||||
#if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0
|
||||
UINT32 groupIndex;
|
||||
|
||||
if(PCRBelongsPolicyGroup(handle, &groupIndex))
|
||||
@ -166,6 +176,9 @@ PCRGetAuthPolicy(TPMI_DH_PCR handle, // IN: PCR handle
|
||||
return gp.pcrPolicies.hashAlg[groupIndex];
|
||||
}
|
||||
else
|
||||
#else
|
||||
NOT_REFERENCED(handle);
|
||||
#endif
|
||||
{
|
||||
policy->t.size = 0;
|
||||
return TPM_ALG_NULL;
|
||||
@ -213,7 +226,9 @@ void PCRManufacture(void)
|
||||
}
|
||||
|
||||
// Store the initial configuration to NV
|
||||
#if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0
|
||||
NV_SYNC_PERSISTENT(pcrPolicies);
|
||||
#endif
|
||||
NV_SYNC_PERSISTENT(pcrAllocated);
|
||||
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user