&& gp.failedTries < gp.maxTries
&& !IS_ORDERLY(g_prevOrderlyState))
{
-#ifdef USE_DA_USED
+#if USE_DA_USED
gp.failedTries += g_daUsed;
g_daUsed = FALSE;
#else
/********************************************************************************/
/* */
-/* */
+/* ExecCommand */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: ExecCommand.c 809 2016-11-16 18:31:54Z kgoldman $ */
+/* $Id: ExecCommand.c 1259 2018-07-10 19:11:09Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* arising in any way out of use or reliance upon this specification or any */
/* information herein. */
/* */
-/* (c) Copyright IBM Corp. and others, 2016 */
+/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
/* */
/********************************************************************************/
if(g_clearOrderly == TRUE
&& NV_IS_ORDERLY)
{
-#ifdef USE_DA_USED
+#if USE_DA_USED
gp.orderlyState = g_daUsed ? SU_DA_USED_VALUE : SU_NONE_VALUE;
#else
gp.orderlyState = SU_NONE_VALUE;
TPMI_DH_OBJECT g_DRTMHandle;
BOOL g_DrtmPreStartup;
BOOL g_StartupLocality3;
-#ifdef USE_DA_USED
+#if USE_DA_USED
BOOL g_daUsed;
#endif
BOOL g_powerWasLost;
#define PRE_STARTUP_FLAG 0x8000
#define STARTUP_LOCALITY_3 0x4000
#define TPM_SU_STATE_MASK ~(PRE_STARTUP_FLAG | STARTUP_LOCALITY_3) // libtpms added
-#ifdef USE_DA_USED
+#if USE_DA_USED
/* 5.10.10.15 g_daUsed */
/* This location indicates if a DA-protected value is accessed during a boot cycle. If none has,
then there is no need to increment failedTries on the next non-orderly startup. This bit is
/* g_StartupLocality3: must write */
written += BOOL_Marshal(&g_StartupLocality3, buffer, size); /* line 458 */
-#ifdef USE_DA_USED
+#if USE_DA_USED
has_block = TRUE;
#else
has_block = FALSE;
#endif
written += BLOCK_SKIP_WRITE_PUSH(has_block, buffer, size);
-#ifdef USE_DA_USED
+#if USE_DA_USED
/* g_daUsed: must write */
written += BOOL_Marshal(&g_daUsed, buffer, size); /* line 484 */
#endif
rc = BOOL_Unmarshal(&g_StartupLocality3, buffer, size); /* line 458 */
}
-#ifdef USE_DA_USED
+#if USE_DA_USED
needs_block = TRUE;
#else
needs_block = FALSE;
BLOCK_SKIP_READ(skip_da, needs_block, buffer, size,
"Volatile state", "g_daUsed");
}
-#ifdef USE_DA_USED
+#if USE_DA_USED
if (rc == TPM_RC_SUCCESS) {
rc = BOOL_Unmarshal(&g_daUsed, buffer, size); /* line 484 */
}
// ... or if the number of failed tries has been maxed out.
if(gp.failedTries >= gp.maxTries)
return TPM_RC_LOCKOUT;
-#ifdef USE_DA_USED
+#if USE_DA_USED
// If the daUsed flag is not SET, then no DA validation until the
// daUsed state is written to NV
if(!g_daUsed)
if(g_DrtmPreStartup)
locality = 0;
g_StartupLocality3 = (locality == 3);
-#ifdef USE_DA_USED
+#if USE_DA_USED
// If there was no orderly shutdown, then their might have been a write to
// failedTries that didn't get recorded but only if g_daUsed was SET in the
// shutdown state
#ifndef FIPS_COMPLIANT
//# define FIPS_COMPLIANT
#endif
-/* Definition to allow alternate behavior for non-orderly startup. If there is a chance that the TPM
- could not update failedTries */
-#ifndef USE_DA_USED
-# define USE_DA_USED
+// Definition to allow alternate behavior for non-orderly startup. If there is a chance that the TPM
+// could not update failedTries
+#if !(defined USE_DA_USED) || ((USE_DA_USED != NO) && (USE_DA_USED != YES))
+# undef USE_DA_USED
+# define USE_DA_USED YES // Default: Either YES or NO
#endif
/* Define TABLE_DRIVEN_DISPATCH to use tables rather than case statements for command dispatch and
handle unmarshaling */