xref: /aosp_15_r20/external/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/user_settings.h (revision 5c591343844d1f9da7da26467c4bf7efc8a7a413)
1 /* Microsoft Reference Implementation for TPM 2.0
2  *
3  *  The copyright in this software is being made available under the BSD License,
4  *  included below. This software may be subject to other third party and
5  *  contributor rights, including patent rights, and no such rights are granted
6  *  under this license.
7  *
8  *  Copyright (c) Microsoft Corporation
9  *
10  *  All rights reserved.
11  *
12  *  BSD License
13  *
14  *  Redistribution and use in source and binary forms, with or without modification,
15  *  are permitted provided that the following conditions are met:
16  *
17  *  Redistributions of source code must retain the above copyright notice, this list
18  *  of conditions and the following disclaimer.
19  *
20  *  Redistributions in binary form must reproduce the above copyright notice, this
21  *  list of conditions and the following disclaimer in the documentation and/or other
22  *  materials provided with the distribution.
23  *
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
25  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 
37 /* TPM specific preprocessor flags for wolfcrypt */
38 
39 
40 #ifndef WOLF_CRYPT_USER_SETTINGS_H
41 #define WOLF_CRYPT_USER_SETTINGS_H
42 
43 /* Remove the automatic setting of the default I/O functions EmbedSend()
44     and EmbedReceive(). */
45 #define WOLFSSL_USER_IO
46 
47 /* Avoid naming conflicts */
48 #define NO_OLD_WC_NAMES
49 
50 /* Use stack based fast math for all big integer math */
51 #define USE_FAST_MATH
52 #define TFM_TIMING_RESISTANT
53 
54 /* Expose direct encryption functions */
55 #define WOLFSSL_AES_DIRECT
56 
57 /* Enable/Disable algorithm support based on TPM implementation header */
58 #if ALG_SHA256
59     #define WOLFSSL_SHA256
60 #endif
61 #if ALG_SHA384 || ALG_SHA512
62     #define WOLFSSL_SHA384
63     #define WOLFSSL_SHA512
64 #endif
65 #if ALG_TDES
66     #define WOLFSSL_DES_ECB
67 #endif
68 #if ALG_RSA
69     /* Turn on RSA key generation functionality */
70     #define WOLFSSL_KEY_GEN
71 #endif
72 #if ALG_ECC || defined(WOLFSSL_LIB)
73     #define HAVE_ECC
74 
75     /* Expose additional ECC primitives */
76     #define WOLFSSL_PUBLIC_ECC_ADD_DBL
77     #define ECC_TIMING_RESISTANT
78 
79     /* Enables Shamir calc method */
80     #define ECC_SHAMIR
81 
82     /* The TPM only needs low level ECC crypto */
83     #define NO_ECC_SIGN
84     #define NO_ECC_VERIFY
85     #define NO_ECC_SECP
86 
87     #undef ECC_BN_P256
88     #undef ECC_SM2_P256
89     #undef ECC_BN_P638
90     #define ECC_BN_P256     NO
91     #define ECC_SM2_P256    NO
92     #define ECC_BN_P638     NO
93 
94 #endif
95 
96 /* Disable explicit RSA. The TPM support for RSA is dependent only on TFM */
97 #define NO_RSA
98 #define NO_RC4
99 #define NO_ASN
100 
101 /* Enable debug wolf library check */
102 //#define LIBRARY_COMPATIBILITY_CHECK
103 
104 #define WOLFSSL_
105 
106 #endif // WOLF_CRYPT_USER_SETTINGS_H
107