Mbed TLS v3.5.0
config_adjust_psa_superset_legacy.h
Go to the documentation of this file.
1 
12 /*
13  * Copyright The Mbed TLS Contributors
14  * SPDX-License-Identifier: Apache-2.0
15  *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * http://www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  */
28 
29 #ifndef MBEDTLS_CONFIG_ADJUST_PSA_SUPERSET_LEGACY_H
30 #define MBEDTLS_CONFIG_ADJUST_PSA_SUPERSET_LEGACY_H
31 
32 /****************************************************************/
33 /* Hashes that are built in are also enabled in PSA.
34  * This simplifies dependency declarations especially
35  * for modules that obey MBEDTLS_USE_PSA_CRYPTO. */
36 /****************************************************************/
37 
38 #if defined(MBEDTLS_MD5_C)
39 #define PSA_WANT_ALG_MD5 1
40 #endif
41 
42 #if defined(MBEDTLS_RIPEMD160_C)
43 #define PSA_WANT_ALG_RIPEMD160 1
44 #endif
45 
46 #if defined(MBEDTLS_SHA1_C)
47 #define PSA_WANT_ALG_SHA_1 1
48 #endif
49 
50 #if defined(MBEDTLS_SHA224_C)
51 #define PSA_WANT_ALG_SHA_224 1
52 #endif
53 
54 #if defined(MBEDTLS_SHA256_C)
55 #define PSA_WANT_ALG_SHA_256 1
56 #endif
57 
58 #if defined(MBEDTLS_SHA384_C)
59 #define PSA_WANT_ALG_SHA_384 1
60 #endif
61 
62 #if defined(MBEDTLS_SHA512_C)
63 #define PSA_WANT_ALG_SHA_512 1
64 #endif
65 
66 #if defined(MBEDTLS_SHA3_C)
67 #define PSA_WANT_ALG_SHA3_224 1
68 #define PSA_WANT_ALG_SHA3_256 1
69 #define PSA_WANT_ALG_SHA3_384 1
70 #define PSA_WANT_ALG_SHA3_512 1
71 #endif
72 
73 /* Ensure that the PSA's supported curves (PSA_WANT_ECC_xxx) are always a
74  * superset of the builtin ones (MBEDTLS_ECP_DP_xxx). */
75 #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
76 #if !defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
77 #define PSA_WANT_ECC_BRAINPOOL_P_R1_256 1
78 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_256 */
79 #endif /* MBEDTLS_ECP_DP_BP256R1_ENABLED */
80 
81 #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
82 #if !defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
83 #define PSA_WANT_ECC_BRAINPOOL_P_R1_384 1
84 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_384 */
85 #endif /*MBEDTLS_ECP_DP_BP384R1_ENABLED */
86 
87 #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
88 #if !defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
89 #define PSA_WANT_ECC_BRAINPOOL_P_R1_512 1
90 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_512 */
91 #endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */
92 
93 #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
94 #if !defined(PSA_WANT_ECC_MONTGOMERY_255)
95 #define PSA_WANT_ECC_MONTGOMERY_255 1
96 #endif /* PSA_WANT_ECC_MONTGOMERY_255 */
97 #endif /* MBEDTLS_ECP_DP_CURVE25519_ENABLED */
98 
99 #if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
100 #if !defined(PSA_WANT_ECC_MONTGOMERY_448)
101 #define PSA_WANT_ECC_MONTGOMERY_448 1
102 #endif /* PSA_WANT_ECC_MONTGOMERY_448 */
103 #endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */
104 
105 #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
106 #if !defined(PSA_WANT_ECC_SECP_R1_192)
107 #define PSA_WANT_ECC_SECP_R1_192 1
108 #endif /* PSA_WANT_ECC_SECP_R1_192 */
109 #endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */
110 
111 #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
112 #if !defined(PSA_WANT_ECC_SECP_R1_224)
113 #define PSA_WANT_ECC_SECP_R1_224 1
114 #endif /* PSA_WANT_ECC_SECP_R1_224 */
115 #endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */
116 
117 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
118 #if !defined(PSA_WANT_ECC_SECP_R1_256)
119 #define PSA_WANT_ECC_SECP_R1_256 1
120 #endif /* PSA_WANT_ECC_SECP_R1_256 */
121 #endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED */
122 
123 #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
124 #if !defined(PSA_WANT_ECC_SECP_R1_384)
125 #define PSA_WANT_ECC_SECP_R1_384 1
126 #endif /* PSA_WANT_ECC_SECP_R1_384 */
127 #endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
128 
129 #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
130 #if !defined(PSA_WANT_ECC_SECP_R1_521)
131 #define PSA_WANT_ECC_SECP_R1_521 1
132 #endif /* PSA_WANT_ECC_SECP_R1_521 */
133 #endif /* MBEDTLS_ECP_DP_SECP521R1_ENABLED */
134 
135 #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
136 #if !defined(PSA_WANT_ECC_SECP_K1_192)
137 #define PSA_WANT_ECC_SECP_K1_192 1
138 #endif /* PSA_WANT_ECC_SECP_K1_192 */
139 #endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */
140 
141 /* SECP224K1 is buggy via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/3541) */
142 #if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
143 #if !defined(PSA_WANT_ECC_SECP_K1_224)
144 #define PSA_WANT_ECC_SECP_K1_224 1
145 #endif /* PSA_WANT_ECC_SECP_K1_224 */
146 #endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */
147 
148 #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
149 #if !defined(PSA_WANT_ECC_SECP_K1_256)
150 #define PSA_WANT_ECC_SECP_K1_256 1
151 #endif /* PSA_WANT_ECC_SECP_K1_256 */
152 #endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */
153 
154 #endif /* MBEDTLS_CONFIG_ADJUST_PSA_SUPERSET_LEGACY_H */