1// This file was extracted from the TCG Published
2// Trusted Platform Module Library
3// Part 4: Supporting Routines
4// Family "2.0"
5// Level 00 Revision 01.16
6// October 30, 2014
7
8#ifndef   _TPM_BUILD_SWITCHES_H
9#define   _TPM_BUILD_SWITCHES_H
10#define   SIMULATION
11#define   FIPS_COMPLIANT
12//
13//     Define the alignment macro appropriate for the build environment For MS C compiler
14//
15#ifdef __GNUC__
16#define ALIGN_TO(boundary)            __attribute__ ((aligned(boundary)))
17#define __declspec(x)
18#else
19#define ALIGN_TO(boundary)            __declspec(align(boundary))
20#endif
21//
22//     For ISO 9899:2011
23//
24// #define ALIGN_TO(boundary)                 _Alignas(boundary)
25//
26//     This switch enables the RNG state save and restore
27//
28#undef _DRBG_STATE_SAVE
29#define _DRBG_STATE_SAVE                    // Comment this out if no state save is wanted
30//
31//     Set the alignment size for the crypto. It would be nice to set this according to macros automatically
32//     defined by the build environment, but that doesn't seem possible because there isn't any simple set for
33//     that. So, this is just a plugged value. Your compiler should complain if this alignment isn't possible.
34//
35//     NOTE:           this value can be set at the command line or just plugged in here.
36//
37#ifdef CRYPTO_ALIGN_16
38#   define CRYPTO_ALIGNMENT    16
39#elif defined CRYPTO_ALIGN_8
40#   define CRYPTO_ALIGNMENT    8
41#eliF defined CRYPTO_ALIGN_2
42#   define CRYPTO_ALIGNMENT    2
43#elif defined CRTYPO_ALIGN_1
44#   define CRYPTO_ALIGNMENT    1
45#else
46#   define CRYPTO_ALIGNMENT    4    // For 32-bit builds
47#endif
48#define CRYPTO_ALIGNED ALIGN_TO(CRYPTO_ALIGNMENT)
49//
50//     This macro is used to handle LIB_EXPORT of function and variable names in lieu of a .def file
51//
52#define LIB_EXPORT __declspec(dllexport)
53// #define LIB_EXPORT
54//
55//
56//
57//     For import of a variable
58//
59#define LIB_IMPORT __declspec(dllimport)
60//#define LIB_IMPORT
61//
62//     This is defined to indicate a function that does not return. This is used in static code anlaysis.
63//
64#define _No_Return_ __declspec(noreturn)
65//#define _No_Return_
66#ifdef SELF_TEST
67#pragma comment(lib, "algorithmtests.lib")
68#endif
69//
70//     The switches in this group can only be enabled when running a simulation
71//
72#ifdef SIMULATION
73#   define RSA_KEY_CACHE
74#   define TPM_RNG_FOR_DEBUG
75#else
76#   undef RSA_KEY_CACHE
77#   undef TPM_RNG_FOR_DEBUG
78#endif // SIMULATION
79#define INLINE __inline
80#endif // _TPM_BUILD_SWITCHES_H
81