xref: /aosp_15_r20/external/ms-tpm-20-ref/TPMCmd/tpm/include/TpmBuildSwitches.h (revision 5c591343844d1f9da7da26467c4bf7efc8a7a413)
1*5c591343SA. Cody Schuffelen 
2*5c591343SA. Cody Schuffelen /* Microsoft Reference Implementation for TPM 2.0
3*5c591343SA. Cody Schuffelen  *
4*5c591343SA. Cody Schuffelen  *  The copyright in this software is being made available under the BSD License,
5*5c591343SA. Cody Schuffelen  *  included below. This software may be subject to other third party and
6*5c591343SA. Cody Schuffelen  *  contributor rights, including patent rights, and no such rights are granted
7*5c591343SA. Cody Schuffelen  *  under this license.
8*5c591343SA. Cody Schuffelen  *
9*5c591343SA. Cody Schuffelen  *  Copyright (c) Microsoft Corporation
10*5c591343SA. Cody Schuffelen  *
11*5c591343SA. Cody Schuffelen  *  All rights reserved.
12*5c591343SA. Cody Schuffelen  *
13*5c591343SA. Cody Schuffelen  *  BSD License
14*5c591343SA. Cody Schuffelen  *
15*5c591343SA. Cody Schuffelen  *  Redistribution and use in source and binary forms, with or without modification,
16*5c591343SA. Cody Schuffelen  *  are permitted provided that the following conditions are met:
17*5c591343SA. Cody Schuffelen  *
18*5c591343SA. Cody Schuffelen  *  Redistributions of source code must retain the above copyright notice, this list
19*5c591343SA. Cody Schuffelen  *  of conditions and the following disclaimer.
20*5c591343SA. Cody Schuffelen  *
21*5c591343SA. Cody Schuffelen  *  Redistributions in binary form must reproduce the above copyright notice, this
22*5c591343SA. Cody Schuffelen  *  list of conditions and the following disclaimer in the documentation and/or
23*5c591343SA. Cody Schuffelen  *  other materials provided with the distribution.
24*5c591343SA. Cody Schuffelen  *
25*5c591343SA. Cody Schuffelen  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
26*5c591343SA. Cody Schuffelen  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27*5c591343SA. Cody Schuffelen  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28*5c591343SA. Cody Schuffelen  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
29*5c591343SA. Cody Schuffelen  *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30*5c591343SA. Cody Schuffelen  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31*5c591343SA. Cody Schuffelen  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
32*5c591343SA. Cody Schuffelen  *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33*5c591343SA. Cody Schuffelen  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34*5c591343SA. Cody Schuffelen  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35*5c591343SA. Cody Schuffelen  */
36*5c591343SA. Cody Schuffelen // This file contains the build switches. This contains switches for multiple
37*5c591343SA. Cody Schuffelen // versions of the crypto-library so some may not apply to your environment.
38*5c591343SA. Cody Schuffelen //
39*5c591343SA. Cody Schuffelen // The switches are guarded so that they can either be set on the command line or
40*5c591343SA. Cody Schuffelen // set here. If the switch is listed on the command line (-DSOME_SWITCH) with NO
41*5c591343SA. Cody Schuffelen // setting, then the switch will be set to YES. If the switch setting is not on the
42*5c591343SA. Cody Schuffelen // command line or if the setting is other than YES or NO, then the switch will be set
43*5c591343SA. Cody Schuffelen // to the default value. The default can either be YES or NO as indicated on each line
44*5c591343SA. Cody Schuffelen // where the default is selected.
45*5c591343SA. Cody Schuffelen //
46*5c591343SA. Cody Schuffelen // A caution: do not try to test these macros by inserting #defines in this file. For
47*5c591343SA. Cody Schuffelen // some curious reason, a variable set on the command line with no setting will have a
48*5c591343SA. Cody Schuffelen // value of 1. An "#if SOME_VARIABLE" will work if the variable is not defined or is
49*5c591343SA. Cody Schuffelen // defined on the command line with no initial setting. However, a
50*5c591343SA. Cody Schuffelen // "#define SOME_VARIABLE" is a null string and when used in "#if SOME_VARIABLE" will
51*5c591343SA. Cody Schuffelen // not be a proper expression If you want to test various switches, either use the
52*5c591343SA. Cody Schuffelen // command line or change the default.
53*5c591343SA. Cody Schuffelen //
54*5c591343SA. Cody Schuffelen #ifndef _TPM_BUILD_SWITCHES_H_
55*5c591343SA. Cody Schuffelen #define _TPM_BUILD_SWITCHES_H_
56*5c591343SA. Cody Schuffelen 
57*5c591343SA. Cody Schuffelen #undef YES
58*5c591343SA. Cody Schuffelen #define YES 1
59*5c591343SA. Cody Schuffelen #undef NO
60*5c591343SA. Cody Schuffelen #define NO 0
61*5c591343SA. Cody Schuffelen 
62*5c591343SA. Cody Schuffelen // Allow the command line to specify a "profile" file
63*5c591343SA. Cody Schuffelen #ifdef PROFILE
64*5c591343SA. Cody Schuffelen #   define PROFILE_QUOTE(a) #a
65*5c591343SA. Cody Schuffelen #   define PROFILE_INCLUDE(a) PROFILE_QUOTE(a)
66*5c591343SA. Cody Schuffelen #   include PROFILE_INCLUDE(PROFILE)
67*5c591343SA. Cody Schuffelen #endif
68*5c591343SA. Cody Schuffelen 
69*5c591343SA. Cody Schuffelen // Need an unambiguous definition for DEBUG. Do not change this
70*5c591343SA. Cody Schuffelen #ifndef DEBUG
71*5c591343SA. Cody Schuffelen #   ifdef NDEBUG
72*5c591343SA. Cody Schuffelen #       define  DEBUG   NO
73*5c591343SA. Cody Schuffelen #   else
74*5c591343SA. Cody Schuffelen #       define  DEBUG   YES
75*5c591343SA. Cody Schuffelen #   endif
76*5c591343SA. Cody Schuffelen #elif (DEBUG != NO) && (DEBUG != YES)
77*5c591343SA. Cody Schuffelen #   undef   DEBUG
78*5c591343SA. Cody Schuffelen #   define  DEBUG                       YES     // Default: Either YES or NO
79*5c591343SA. Cody Schuffelen #endif
80*5c591343SA. Cody Schuffelen 
81*5c591343SA. Cody Schuffelen #include "CompilerDependencies.h"
82*5c591343SA. Cody Schuffelen 
83*5c591343SA. Cody Schuffelen // This definition is required for the re-factored code
84*5c591343SA. Cody Schuffelen #if (!defined USE_BN_ECC_DATA)                                                      \
85*5c591343SA. Cody Schuffelen                 || ((USE_BN_ECC_DATA != NO) && (USE_BN_ECC_DATA != YES))
86*5c591343SA. Cody Schuffelen #   undef   USE_BN_ECC_DATA
87*5c591343SA. Cody Schuffelen #   define  USE_BN_ECC_DATA             YES     // Default: Either YES or NO
88*5c591343SA. Cody Schuffelen #endif
89*5c591343SA. Cody Schuffelen 
90*5c591343SA. Cody Schuffelen // The SIMULATION switch allows certain other macros to be enabled. The things that
91*5c591343SA. Cody Schuffelen // can be enabled in a simulation include key caching, reproducible "random"
92*5c591343SA. Cody Schuffelen // sequences, instrumentation of the RSA key generation process, and certain other
93*5c591343SA. Cody Schuffelen // debug code. SIMULATION Needs to be defined as either YES or NO. This grouping of
94*5c591343SA. Cody Schuffelen // macros will make sure that it is set correctly. A simulated TPM would include a
95*5c591343SA. Cody Schuffelen // Virtual TPM. The interfaces for a Virtual TPM should be modified from the standard
96*5c591343SA. Cody Schuffelen // ones in the Simulator project.
97*5c591343SA. Cody Schuffelen //
98*5c591343SA. Cody Schuffelen // If SIMULATION is in the compile parameters without modifiers,
99*5c591343SA. Cody Schuffelen // make SIMULATION == YES
100*5c591343SA. Cody Schuffelen #if !(defined SIMULATION) || ((SIMULATION != NO) && (SIMULATION != YES))
101*5c591343SA. Cody Schuffelen #   undef   SIMULATION
102*5c591343SA. Cody Schuffelen #   define  SIMULATION                  YES     // Default: Either YES or NO
103*5c591343SA. Cody Schuffelen #endif
104*5c591343SA. Cody Schuffelen 
105*5c591343SA. Cody Schuffelen // Define this to run the function that checks the compatibility between the
106*5c591343SA. Cody Schuffelen // chosen big number math library and the TPM code. Not all ports use this.
107*5c591343SA. Cody Schuffelen #if !(defined LIBRARY_COMPATIBILITY_CHECK)                                          \
108*5c591343SA. Cody Schuffelen         || (( LIBRARY_COMPATIBILITY_CHECK != NO)                                    \
109*5c591343SA. Cody Schuffelen             && (LIBRARY_COMPATIBILITY_CHECK != YES))
110*5c591343SA. Cody Schuffelen #   undef   LIBRARY_COMPATIBILITY_CHECK
111*5c591343SA. Cody Schuffelen #   define  LIBRARY_COMPATIBILITY_CHECK YES     // Default: Either YES or NO
112*5c591343SA. Cody Schuffelen #endif
113*5c591343SA. Cody Schuffelen 
114*5c591343SA. Cody Schuffelen #if !(defined FIPS_COMPLIANT) || ((FIPS_COMPLIANT != NO) && (FIPS_COMPLIANT != YES))
115*5c591343SA. Cody Schuffelen #   undef   FIPS_COMPLIANT
116*5c591343SA. Cody Schuffelen #   define  FIPS_COMPLIANT              YES     // Default: Either YES or NO
117*5c591343SA. Cody Schuffelen #endif
118*5c591343SA. Cody Schuffelen 
119*5c591343SA. Cody Schuffelen // Definition to allow alternate behavior for non-orderly startup. If there is a
120*5c591343SA. Cody Schuffelen // chance that the TPM could not update 'failedTries'
121*5c591343SA. Cody Schuffelen #if !(defined USE_DA_USED) || ((USE_DA_USED != NO) && (USE_DA_USED != YES))
122*5c591343SA. Cody Schuffelen #   undef   USE_DA_USED
123*5c591343SA. Cody Schuffelen #   define  USE_DA_USED                 YES     // Default: Either YES or NO
124*5c591343SA. Cody Schuffelen #endif
125*5c591343SA. Cody Schuffelen 
126*5c591343SA. Cody Schuffelen // Define TABLE_DRIVEN_DISPATCH to use tables rather than case statements
127*5c591343SA. Cody Schuffelen // for command dispatch and handle unmarshaling
128*5c591343SA. Cody Schuffelen #if !(defined TABLE_DRIVEN_DISPATCH)                                                \
129*5c591343SA. Cody Schuffelen         || ((TABLE_DRIVEN_DISPATCH != NO) && (TABLE_DRIVEN_DISPATCH != YES))
130*5c591343SA. Cody Schuffelen #   undef   TABLE_DRIVEN_DISPATCH
131*5c591343SA. Cody Schuffelen #   define  TABLE_DRIVEN_DISPATCH       YES     // Default: Either YES or NO
132*5c591343SA. Cody Schuffelen #endif
133*5c591343SA. Cody Schuffelen 
134*5c591343SA. Cody Schuffelen // This switch is used to enable the self-test capability in AlgorithmTests.c
135*5c591343SA. Cody Schuffelen #if !(defined SELF_TEST) || ((SELF_TEST != NO) && (SELF_TEST != YES))
136*5c591343SA. Cody Schuffelen #   undef   SELF_TEST
137*5c591343SA. Cody Schuffelen #   define  SELF_TEST                   YES     // Default: Either YES or NO
138*5c591343SA. Cody Schuffelen #endif
139*5c591343SA. Cody Schuffelen 
140*5c591343SA. Cody Schuffelen // Enable the generation of RSA primes using a sieve.
141*5c591343SA. Cody Schuffelen #if !(defined RSA_KEY_SIEVE) || ((RSA_KEY_SIEVE != NO) && (RSA_KEY_SIEVE != YES))
142*5c591343SA. Cody Schuffelen #   undef   RSA_KEY_SIEVE
143*5c591343SA. Cody Schuffelen #   define  RSA_KEY_SIEVE               YES     // Default: Either YES or NO
144*5c591343SA. Cody Schuffelen #endif
145*5c591343SA. Cody Schuffelen 
146*5c591343SA. Cody Schuffelen // Enable the instrumentation of the sieve process. This is used to tune the sieve
147*5c591343SA. Cody Schuffelen // variables.
148*5c591343SA. Cody Schuffelen #if RSA_KEY_SIEVE && SIMULATION
149*5c591343SA. Cody Schuffelen #   if !(defined RSA_INSTRUMENT)                                                    \
150*5c591343SA. Cody Schuffelen             || ((RSA_INSTRUMENT != NO) && (RSA_INSTRUMENT != YES))
151*5c591343SA. Cody Schuffelen #       undef   RSA_INSTRUMENT
152*5c591343SA. Cody Schuffelen #       define  RSA_INSTRUMENT          NO      // Default: Either YES or NO
153*5c591343SA. Cody Schuffelen #   endif
154*5c591343SA. Cody Schuffelen #endif
155*5c591343SA. Cody Schuffelen 
156*5c591343SA. Cody Schuffelen // This switch enables the RNG state save and restore
157*5c591343SA. Cody Schuffelen #if !(defined _DRBG_STATE_SAVE)                                                     \
158*5c591343SA. Cody Schuffelen     || ((_DRBG_STATE_SAVE != NO) && (_DRBG_STATE_SAVE != YES))
159*5c591343SA. Cody Schuffelen #   undef   _DRBG_STATE_SAVE
160*5c591343SA. Cody Schuffelen #   define  _DRBG_STATE_SAVE            YES     // Default: Either YES or NO
161*5c591343SA. Cody Schuffelen #endif
162*5c591343SA. Cody Schuffelen 
163*5c591343SA. Cody Schuffelen // Switch added to support packed lists that leave out space associated with
164*5c591343SA. Cody Schuffelen // unimplemented commands. Comment this out to use linear lists.
165*5c591343SA. Cody Schuffelen // Note: if vendor specific commands are present, the associated list is always
166*5c591343SA. Cody Schuffelen // in compressed form.
167*5c591343SA. Cody Schuffelen #if !(defined COMPRESSED_LISTS)                                                     \
168*5c591343SA. Cody Schuffelen     || ((COMPRESSED_LISTS != NO) && (COMPRESSED_LISTS != YES))
169*5c591343SA. Cody Schuffelen #   undef   COMPRESSED_LISTS
170*5c591343SA. Cody Schuffelen #   define  COMPRESSED_LISTS            YES     // Default: Either YES or NO
171*5c591343SA. Cody Schuffelen #endif
172*5c591343SA. Cody Schuffelen 
173*5c591343SA. Cody Schuffelen // This switch indicates where clock epoch value should be stored. If this value
174*5c591343SA. Cody Schuffelen // defined, then it is assumed that the timer will change at any time so the
175*5c591343SA. Cody Schuffelen // nonce should be a random number kept in RAM. When it is not defined, then the
176*5c591343SA. Cody Schuffelen // timer only stops during power outages.
177*5c591343SA. Cody Schuffelen #if !(defined CLOCK_STOPS) || ((CLOCK_STOPS != NO) && (CLOCK_STOPS != YES))
178*5c591343SA. Cody Schuffelen #   undef   CLOCK_STOPS
179*5c591343SA. Cody Schuffelen #   define  CLOCK_STOPS                 NO      // Default: Either YES or NO
180*5c591343SA. Cody Schuffelen #endif
181*5c591343SA. Cody Schuffelen 
182*5c591343SA. Cody Schuffelen // This switch allows use of #defines in place of pass-through marshaling or
183*5c591343SA. Cody Schuffelen // unmarshaling code. A pass-through function just calls another function to do
184*5c591343SA. Cody Schuffelen // the required function and does no parameter checking of its own. The
185*5c591343SA. Cody Schuffelen // table-driven dispatcher calls directly to the lowest level
186*5c591343SA. Cody Schuffelen // marshaling/unmarshaling code and by-passes any pass-through functions.
187*5c591343SA. Cody Schuffelen #if (defined USE_MARSHALING_DEFINES) && (USE_MARSHALING_DEFINES != NO)
188*5c591343SA. Cody Schuffelen #   undef   USE_MARSHALING_DEFINES
189*5c591343SA. Cody Schuffelen #   define  USE_MARSHALING_DEFINES      YES
190*5c591343SA. Cody Schuffelen #else
191*5c591343SA. Cody Schuffelen #   define USE_MARSHALING_DEFINES       YES     // Default: Either YES or NO
192*5c591343SA. Cody Schuffelen #endif
193*5c591343SA. Cody Schuffelen 
194*5c591343SA. Cody Schuffelen //**********************************
195*5c591343SA. Cody Schuffelen // The switches in this group can only be enabled when doing debug during simulation
196*5c591343SA. Cody Schuffelen #if SIMULATION && DEBUG
197*5c591343SA. Cody Schuffelen // This forces the use of a smaller context slot size. This reduction reduces the
198*5c591343SA. Cody Schuffelen // range of the epoch allowing the tester to force the epoch to occur faster than
199*5c591343SA. Cody Schuffelen // the normal defined in TpmProfile.h
200*5c591343SA. Cody Schuffelen #   if !(defined CONTEXT_SLOT)
201*5c591343SA. Cody Schuffelen #       define CONTEXT_SLOT             UINT8
202*5c591343SA. Cody Schuffelen #   endif
203*5c591343SA. Cody Schuffelen // Enables use of the key cache. Default is YES
204*5c591343SA. Cody Schuffelen #   if !(defined USE_RSA_KEY_CACHE)                                                 \
205*5c591343SA. Cody Schuffelen     || ((USE_RSA_KEY_CACHE != NO) && (USE_RSA_KEY_CACHE != YES))
206*5c591343SA. Cody Schuffelen #       undef   USE_RSA_KEY_CACHE
207*5c591343SA. Cody Schuffelen #       define  USE_RSA_KEY_CACHE       YES     // Default: Either YES or NO
208*5c591343SA. Cody Schuffelen #   endif
209*5c591343SA. Cody Schuffelen 
210*5c591343SA. Cody Schuffelen // Enables use of a file to store the key cache values so that the TPM will start
211*5c591343SA. Cody Schuffelen // faster during debug. Default for this is YES
212*5c591343SA. Cody Schuffelen #   if USE_RSA_KEY_CACHE
213*5c591343SA. Cody Schuffelen #       if !(defined USE_KEY_CACHE_FILE)                                            \
214*5c591343SA. Cody Schuffelen             || ((USE_KEY_CACHE_FILE != NO) && (USE_KEY_CACHE_FILE != YES))
215*5c591343SA. Cody Schuffelen #           undef   USE_KEY_CACHE_FILE
216*5c591343SA. Cody Schuffelen #           define  USE_KEY_CACHE_FILE  YES     // Default: Either YES or NO
217*5c591343SA. Cody Schuffelen #       endif
218*5c591343SA. Cody Schuffelen #   else
219*5c591343SA. Cody Schuffelen #       undef   USE_KEY_CACHE_FILE
220*5c591343SA. Cody Schuffelen #       define  USE_KEY_CACHE_FILE      NO
221*5c591343SA. Cody Schuffelen #   endif   // USE_RSA_KEY_CACHE
222*5c591343SA. Cody Schuffelen 
223*5c591343SA. Cody Schuffelen // This provides fixed seeding of the RNG when doing debug on a simulator. This
224*5c591343SA. Cody Schuffelen // should allow consistent results on test runs as long as the input parameters
225*5c591343SA. Cody Schuffelen // to the functions remains the same. There is no default value.
226*5c591343SA. Cody Schuffelen #   if !(defined USE_DEBUG_RNG) || ((USE_DEBUG_RNG != NO) && (USE_DEBUG_RNG != YES))
227*5c591343SA. Cody Schuffelen #       undef   USE_DEBUG_RNG
228*5c591343SA. Cody Schuffelen #       define  USE_DEBUG_RNG           YES     // Default: Either YES or NO
229*5c591343SA. Cody Schuffelen #   endif
230*5c591343SA. Cody Schuffelen 
231*5c591343SA. Cody Schuffelen // Do not change these. They are the settings needed when not doing a simulation and
232*5c591343SA. Cody Schuffelen // not doing debug. Can't use the key cache except during debug. Otherwise, all of the
233*5c591343SA. Cody Schuffelen // key values end up being the same
234*5c591343SA. Cody Schuffelen #else
235*5c591343SA. Cody Schuffelen #   define USE_RSA_KEY_CACHE            NO
236*5c591343SA. Cody Schuffelen #   define USE_RSA_KEY_CACHE_FILE       NO
237*5c591343SA. Cody Schuffelen #   define USE_DEBUG_RNG                NO
238*5c591343SA. Cody Schuffelen #endif  // DEBUG && SIMULATION
239*5c591343SA. Cody Schuffelen 
240*5c591343SA. Cody Schuffelen #if DEBUG
241*5c591343SA. Cody Schuffelen 
242*5c591343SA. Cody Schuffelen // In some cases, the relationship between two values may be dependent
243*5c591343SA. Cody Schuffelen // on things that change based on various selections like the chosen cryptographic
244*5c591343SA. Cody Schuffelen // libraries. It is possible that these selections will result in incompatible
245*5c591343SA. Cody Schuffelen // settings. These are often detectable by the compiler but it is not always
246*5c591343SA. Cody Schuffelen // possible to do the check in the preprocessor code. For example, when the
247*5c591343SA. Cody Schuffelen // check requires use of 'sizeof'() then the preprocessor can't do the comparison.
248*5c591343SA. Cody Schuffelen // For these cases, we include a special macro that, depending on the compiler
249*5c591343SA. Cody Schuffelen // will generate a warning to indicate if the check always passes or always fails
250*5c591343SA. Cody Schuffelen // because it involves fixed constants. To run these checks, define COMPILER_CHECKS.
251*5c591343SA. Cody Schuffelen #   if !(defined COMPILER_CHECKS)                                                   \
252*5c591343SA. Cody Schuffelen         || ((COMPILER_CHECKS != NO) && (COMPILER_CHECKS != YES))
253*5c591343SA. Cody Schuffelen #       undef   COMPILER_CHECKS
254*5c591343SA. Cody Schuffelen #       define  COMPILER_CHECKS         NO      // Default: Either YES or NO
255*5c591343SA. Cody Schuffelen #   endif
256*5c591343SA. Cody Schuffelen 
257*5c591343SA. Cody Schuffelen // Some of the values (such as sizes) are the result of different options set in
258*5c591343SA. Cody Schuffelen // TpmProfile.h. The combination might not be consistent. A function is defined
259*5c591343SA. Cody Schuffelen // (TpmSizeChecks()) that is used to verify the sizes at run time. To enable the
260*5c591343SA. Cody Schuffelen // function, define this parameter.
261*5c591343SA. Cody Schuffelen #   if !(defined RUNTIME_SIZE_CHECKS)                                               \
262*5c591343SA. Cody Schuffelen     || ((RUNTIME_SIZE_CHECKS != NO) && (RUNTIME_SIZE_CHECKS != YES))
263*5c591343SA. Cody Schuffelen #       undef RUNTIME_SIZE_CHECKS
264*5c591343SA. Cody Schuffelen #       define RUNTIME_SIZE_CHECKS      YES      // Default: Either YES or NO
265*5c591343SA. Cody Schuffelen #   endif
266*5c591343SA. Cody Schuffelen 
267*5c591343SA. Cody Schuffelen // If doing debug, can set the DRBG to print out the intermediate test values.
268*5c591343SA. Cody Schuffelen // Before enabling this, make sure that the dbgDumpMemBlock() function
269*5c591343SA. Cody Schuffelen // has been added someplace (preferably, somewhere in CryptRand.c)
270*5c591343SA. Cody Schuffelen #   if !(defined DRBG_DEBUG_PRINT)                                                  \
271*5c591343SA. Cody Schuffelen     || ((DRBG_DEBUG_PRINT != NO) && (DRBG_DEBUG_PRINT != YES))
272*5c591343SA. Cody Schuffelen #       undef   DRBG_DEBUG_PRINT
273*5c591343SA. Cody Schuffelen #       define  DRBG_DEBUG_PRINT        NO      // Default: Either YES or NO
274*5c591343SA. Cody Schuffelen #   endif
275*5c591343SA. Cody Schuffelen 
276*5c591343SA. Cody Schuffelen // If an assertion event it not going to produce any trace information (function and
277*5c591343SA. Cody Schuffelen // line number) then make FAIL_TRACE == NO
278*5c591343SA. Cody Schuffelen #   if !(defined FAIL_TRACE) || ((FAIL_TRACE != NO) && (FAIL_TRACE != YES))
279*5c591343SA. Cody Schuffelen #       undef   FAIL_TRACE
280*5c591343SA. Cody Schuffelen #       define  FAIL_TRACE              YES     // Default: Either YES or NO
281*5c591343SA. Cody Schuffelen #   endif
282*5c591343SA. Cody Schuffelen 
283*5c591343SA. Cody Schuffelen #endif // DEBUG
284*5c591343SA. Cody Schuffelen 
285*5c591343SA. Cody Schuffelen // Indicate if the implementation is going to give lockout time credit for time up to
286*5c591343SA. Cody Schuffelen // the last orderly shutdown.
287*5c591343SA. Cody Schuffelen #if !(defined ACCUMULATE_SELF_HEAL_TIMER)                                           \
288*5c591343SA. Cody Schuffelen     || ((ACCUMULATE_SELF_HEAL_TIMER != NO) && (ACCUMULATE_SELF_HEAL_TIMER != YES))
289*5c591343SA. Cody Schuffelen #   undef   ACCUMULATE_SELF_HEAL_TIMER
290*5c591343SA. Cody Schuffelen #   define  ACCUMULATE_SELF_HEAL_TIMER  YES     // Default: Either YES or NO
291*5c591343SA. Cody Schuffelen #endif
292*5c591343SA. Cody Schuffelen 
293*5c591343SA. Cody Schuffelen // Indicates if the implementation is to compute the sizes of the proof and primary
294*5c591343SA. Cody Schuffelen // seed size values based on the implemented algorithms.
295*5c591343SA. Cody Schuffelen #if !(defined USE_SPEC_COMPLIANT_PROOFS)                                            \
296*5c591343SA. Cody Schuffelen     || ((USE_SPEC_COMPLIANT_PROOFS != NO) && (USE_SPEC_COMPLIANT_PROOFS != YES))
297*5c591343SA. Cody Schuffelen #   undef   USE_SPEC_COMPLIANT_PROOFS
298*5c591343SA. Cody Schuffelen #   define  USE_SPEC_COMPLIANT_PROOFS   YES     // Default: Either YES or NO
299*5c591343SA. Cody Schuffelen #endif
300*5c591343SA. Cody Schuffelen 
301*5c591343SA. Cody Schuffelen // Comment this out to allow compile to continue even though the chosen proof values
302*5c591343SA. Cody Schuffelen // do not match the compliant values. This is written so that someone would
303*5c591343SA. Cody Schuffelen // have to proactively ignore errors.
304*5c591343SA. Cody Schuffelen #if !(defined SKIP_PROOF_ERRORS)                                                    \
305*5c591343SA. Cody Schuffelen     || ((SKIP_PROOF_ERRORS != NO) && (SKIP_PROOF_ERRORS != YES))
306*5c591343SA. Cody Schuffelen #   undef   SKIP_PROOF_ERRORS
307*5c591343SA. Cody Schuffelen #   define  SKIP_PROOF_ERRORS           NO      // Default: Either YES or NO
308*5c591343SA. Cody Schuffelen #endif
309*5c591343SA. Cody Schuffelen 
310*5c591343SA. Cody Schuffelen // This define is used to eliminate the use of bit-fields. It can be enabled for big-
311*5c591343SA. Cody Schuffelen // or little-endian machines. For big-endian architectures that numbers bits in
312*5c591343SA. Cody Schuffelen // registers from left to right (MSb0) this must be enabled. Little-endian machines
313*5c591343SA. Cody Schuffelen // number from right to left with the least significant bit having assigned a bit
314*5c591343SA. Cody Schuffelen // number of 0. These are LSb0 machines (they are also little-endian so they are also
315*5c591343SA. Cody Schuffelen // least-significant byte 0 (LSB0) machines. Big-endian (MSB0) machines may number in
316*5c591343SA. Cody Schuffelen // either direction (MSb0 or LSb0). For an MSB0+MSb0 machine this value is required to
317*5c591343SA. Cody Schuffelen // be 'NO'
318*5c591343SA. Cody Schuffelen #if !(defined USE_BIT_FIELD_STRUCTURES)                                             \
319*5c591343SA. Cody Schuffelen     || ((USE_BIT_FIELD_STRUCTURES != NO) && (USE_BIT_FIELD_STRUCTURES != YES))
320*5c591343SA. Cody Schuffelen #   undef   USE_BIT_FIELD_STRUCTURES
321*5c591343SA. Cody Schuffelen #   define  USE_BIT_FIELD_STRUCTURES    NO        // Default: Either YES or NO
322*5c591343SA. Cody Schuffelen #endif
323*5c591343SA. Cody Schuffelen 
324*5c591343SA. Cody Schuffelen // This define is used to control the debug for the CertifyX509 command.
325*5c591343SA. Cody Schuffelen #if !(defined CERTIFYX509_DEBUG)                                                    \
326*5c591343SA. Cody Schuffelen     || ((CERTIFYX509_DEBUG != NO) && (CERTIFYX509_DEBUG != YES))
327*5c591343SA. Cody Schuffelen #   undef   CERTIFYX509_DEBUG
328*5c591343SA. Cody Schuffelen #   define  CERTIFYX509_DEBUG YES               // Default: Either YES or NO
329*5c591343SA. Cody Schuffelen #endif
330*5c591343SA. Cody Schuffelen 
331*5c591343SA. Cody Schuffelen // This define is used to enable the new table-driven marshaling code.
332*5c591343SA. Cody Schuffelen #if !(defined TABLE_DRIVEN_MARSHAL)                                                 \
333*5c591343SA. Cody Schuffelen     || ((TABLE_DRIVEN_MARSHAL != NO) && (TABLE_DRIVEN_MARSHAL != YES))
334*5c591343SA. Cody Schuffelen #   undef   TABLE_DRIVEN_MARSHAL
335*5c591343SA. Cody Schuffelen #   define  TABLE_DRIVEN_MARSHAL NO  // Default: Either YES or NO
336*5c591343SA. Cody Schuffelen #endif
337*5c591343SA. Cody Schuffelen 
338*5c591343SA. Cody Schuffelen // Change these definitions to turn all algorithms or commands ON or OFF. That is,
339*5c591343SA. Cody Schuffelen // to turn all algorithms on, set ALG_NO to YES. This is mostly useful as a debug
340*5c591343SA. Cody Schuffelen // feature.
341*5c591343SA. Cody Schuffelen #define      ALG_YES      YES
342*5c591343SA. Cody Schuffelen #define      ALG_NO       NO
343*5c591343SA. Cody Schuffelen #define      CC_YES       YES
344*5c591343SA. Cody Schuffelen #define      CC_NO        NO
345*5c591343SA. Cody Schuffelen 
346*5c591343SA. Cody Schuffelen #endif // _TPM_BUILD_SWITCHES_H_