1 /*
2  *  Version feature information
3  *
4  *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
5  *  SPDX-License-Identifier: GPL-2.0
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License along
18  *  with this program; if not, write to the Free Software Foundation, Inc.,
19  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  *  This file is part of mbed TLS (https://tls.mbed.org)
22  */
23 
24 #if !defined(MBEDTLS_CONFIG_FILE)
25 #include "mbedtls/config.h"
26 #else
27 #include MBEDTLS_CONFIG_FILE
28 #endif
29 
30 #if defined(MBEDTLS_VERSION_C)
31 
32 #include "mbedtls/version.h"
33 
34 #include <string.h>
35 
36 static const char *features[] = {
37 #if defined(MBEDTLS_VERSION_FEATURES)
38 #if defined(MBEDTLS_HAVE_ASM)
39     "MBEDTLS_HAVE_ASM",
40 #endif /* MBEDTLS_HAVE_ASM */
41 #if defined(MBEDTLS_NO_UDBL_DIVISION)
42     "MBEDTLS_NO_UDBL_DIVISION",
43 #endif /* MBEDTLS_NO_UDBL_DIVISION */
44 #if defined(MBEDTLS_HAVE_SSE2)
45     "MBEDTLS_HAVE_SSE2",
46 #endif /* MBEDTLS_HAVE_SSE2 */
47 #if defined(MBEDTLS_HAVE_TIME)
48     "MBEDTLS_HAVE_TIME",
49 #endif /* MBEDTLS_HAVE_TIME */
50 #if defined(MBEDTLS_HAVE_TIME_DATE)
51     "MBEDTLS_HAVE_TIME_DATE",
52 #endif /* MBEDTLS_HAVE_TIME_DATE */
53 #if defined(MBEDTLS_PLATFORM_MEMORY)
54     "MBEDTLS_PLATFORM_MEMORY",
55 #endif /* MBEDTLS_PLATFORM_MEMORY */
56 #if defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
57     "MBEDTLS_PLATFORM_NO_STD_FUNCTIONS",
58 #endif /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */
59 #if defined(MBEDTLS_PLATFORM_EXIT_ALT)
60     "MBEDTLS_PLATFORM_EXIT_ALT",
61 #endif /* MBEDTLS_PLATFORM_EXIT_ALT */
62 #if defined(MBEDTLS_PLATFORM_TIME_ALT)
63     "MBEDTLS_PLATFORM_TIME_ALT",
64 #endif /* MBEDTLS_PLATFORM_TIME_ALT */
65 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
66     "MBEDTLS_PLATFORM_FPRINTF_ALT",
67 #endif /* MBEDTLS_PLATFORM_FPRINTF_ALT */
68 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT)
69     "MBEDTLS_PLATFORM_PRINTF_ALT",
70 #endif /* MBEDTLS_PLATFORM_PRINTF_ALT */
71 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
72     "MBEDTLS_PLATFORM_SNPRINTF_ALT",
73 #endif /* MBEDTLS_PLATFORM_SNPRINTF_ALT */
74 #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
75     "MBEDTLS_PLATFORM_NV_SEED_ALT",
76 #endif /* MBEDTLS_PLATFORM_NV_SEED_ALT */
77 #if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
78     "MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT",
79 #endif /* MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT */
80 #if defined(MBEDTLS_DEPRECATED_WARNING)
81     "MBEDTLS_DEPRECATED_WARNING",
82 #endif /* MBEDTLS_DEPRECATED_WARNING */
83 #if defined(MBEDTLS_DEPRECATED_REMOVED)
84     "MBEDTLS_DEPRECATED_REMOVED",
85 #endif /* MBEDTLS_DEPRECATED_REMOVED */
86 #if defined(MBEDTLS_TIMING_ALT)
87     "MBEDTLS_TIMING_ALT",
88 #endif /* MBEDTLS_TIMING_ALT */
89 #if defined(MBEDTLS_AES_ALT)
90     "MBEDTLS_AES_ALT",
91 #endif /* MBEDTLS_AES_ALT */
92 #if defined(MBEDTLS_ARC4_ALT)
93     "MBEDTLS_ARC4_ALT",
94 #endif /* MBEDTLS_ARC4_ALT */
95 #if defined(MBEDTLS_BLOWFISH_ALT)
96     "MBEDTLS_BLOWFISH_ALT",
97 #endif /* MBEDTLS_BLOWFISH_ALT */
98 #if defined(MBEDTLS_CAMELLIA_ALT)
99     "MBEDTLS_CAMELLIA_ALT",
100 #endif /* MBEDTLS_CAMELLIA_ALT */
101 #if defined(MBEDTLS_DES_ALT)
102     "MBEDTLS_DES_ALT",
103 #endif /* MBEDTLS_DES_ALT */
104 #if defined(MBEDTLS_XTEA_ALT)
105     "MBEDTLS_XTEA_ALT",
106 #endif /* MBEDTLS_XTEA_ALT */
107 #if defined(MBEDTLS_MD2_ALT)
108     "MBEDTLS_MD2_ALT",
109 #endif /* MBEDTLS_MD2_ALT */
110 #if defined(MBEDTLS_MD4_ALT)
111     "MBEDTLS_MD4_ALT",
112 #endif /* MBEDTLS_MD4_ALT */
113 #if defined(MBEDTLS_MD5_ALT)
114     "MBEDTLS_MD5_ALT",
115 #endif /* MBEDTLS_MD5_ALT */
116 #if defined(MBEDTLS_RIPEMD160_ALT)
117     "MBEDTLS_RIPEMD160_ALT",
118 #endif /* MBEDTLS_RIPEMD160_ALT */
119 #if defined(MBEDTLS_SHA1_ALT)
120     "MBEDTLS_SHA1_ALT",
121 #endif /* MBEDTLS_SHA1_ALT */
122 #if defined(MBEDTLS_SHA256_ALT)
123     "MBEDTLS_SHA256_ALT",
124 #endif /* MBEDTLS_SHA256_ALT */
125 #if defined(MBEDTLS_SHA512_ALT)
126     "MBEDTLS_SHA512_ALT",
127 #endif /* MBEDTLS_SHA512_ALT */
128 #if defined(MBEDTLS_ECP_ALT)
129     "MBEDTLS_ECP_ALT",
130 #endif /* MBEDTLS_ECP_ALT */
131 #if defined(MBEDTLS_MD2_PROCESS_ALT)
132     "MBEDTLS_MD2_PROCESS_ALT",
133 #endif /* MBEDTLS_MD2_PROCESS_ALT */
134 #if defined(MBEDTLS_MD4_PROCESS_ALT)
135     "MBEDTLS_MD4_PROCESS_ALT",
136 #endif /* MBEDTLS_MD4_PROCESS_ALT */
137 #if defined(MBEDTLS_MD5_PROCESS_ALT)
138     "MBEDTLS_MD5_PROCESS_ALT",
139 #endif /* MBEDTLS_MD5_PROCESS_ALT */
140 #if defined(MBEDTLS_RIPEMD160_PROCESS_ALT)
141     "MBEDTLS_RIPEMD160_PROCESS_ALT",
142 #endif /* MBEDTLS_RIPEMD160_PROCESS_ALT */
143 #if defined(MBEDTLS_SHA1_PROCESS_ALT)
144     "MBEDTLS_SHA1_PROCESS_ALT",
145 #endif /* MBEDTLS_SHA1_PROCESS_ALT */
146 #if defined(MBEDTLS_SHA256_PROCESS_ALT)
147     "MBEDTLS_SHA256_PROCESS_ALT",
148 #endif /* MBEDTLS_SHA256_PROCESS_ALT */
149 #if defined(MBEDTLS_SHA512_PROCESS_ALT)
150     "MBEDTLS_SHA512_PROCESS_ALT",
151 #endif /* MBEDTLS_SHA512_PROCESS_ALT */
152 #if defined(MBEDTLS_DES_SETKEY_ALT)
153     "MBEDTLS_DES_SETKEY_ALT",
154 #endif /* MBEDTLS_DES_SETKEY_ALT */
155 #if defined(MBEDTLS_DES_CRYPT_ECB_ALT)
156     "MBEDTLS_DES_CRYPT_ECB_ALT",
157 #endif /* MBEDTLS_DES_CRYPT_ECB_ALT */
158 #if defined(MBEDTLS_DES3_CRYPT_ECB_ALT)
159     "MBEDTLS_DES3_CRYPT_ECB_ALT",
160 #endif /* MBEDTLS_DES3_CRYPT_ECB_ALT */
161 #if defined(MBEDTLS_AES_SETKEY_ENC_ALT)
162     "MBEDTLS_AES_SETKEY_ENC_ALT",
163 #endif /* MBEDTLS_AES_SETKEY_ENC_ALT */
164 #if defined(MBEDTLS_AES_SETKEY_DEC_ALT)
165     "MBEDTLS_AES_SETKEY_DEC_ALT",
166 #endif /* MBEDTLS_AES_SETKEY_DEC_ALT */
167 #if defined(MBEDTLS_AES_ENCRYPT_ALT)
168     "MBEDTLS_AES_ENCRYPT_ALT",
169 #endif /* MBEDTLS_AES_ENCRYPT_ALT */
170 #if defined(MBEDTLS_AES_DECRYPT_ALT)
171     "MBEDTLS_AES_DECRYPT_ALT",
172 #endif /* MBEDTLS_AES_DECRYPT_ALT */
173 #if defined(MBEDTLS_ECP_INTERNAL_ALT)
174     "MBEDTLS_ECP_INTERNAL_ALT",
175 #endif /* MBEDTLS_ECP_INTERNAL_ALT */
176 #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT)
177     "MBEDTLS_ECP_RANDOMIZE_JAC_ALT",
178 #endif /* MBEDTLS_ECP_RANDOMIZE_JAC_ALT */
179 #if defined(MBEDTLS_ECP_ADD_MIXED_ALT)
180     "MBEDTLS_ECP_ADD_MIXED_ALT",
181 #endif /* MBEDTLS_ECP_ADD_MIXED_ALT */
182 #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT)
183     "MBEDTLS_ECP_DOUBLE_JAC_ALT",
184 #endif /* MBEDTLS_ECP_DOUBLE_JAC_ALT */
185 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT)
186     "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT",
187 #endif /* MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT */
188 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT)
189     "MBEDTLS_ECP_NORMALIZE_JAC_ALT",
190 #endif /* MBEDTLS_ECP_NORMALIZE_JAC_ALT */
191 #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT)
192     "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT",
193 #endif /* MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT */
194 #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT)
195     "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT",
196 #endif /* MBEDTLS_ECP_RANDOMIZE_MXZ_ALT */
197 #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT)
198     "MBEDTLS_ECP_NORMALIZE_MXZ_ALT",
199 #endif /* MBEDTLS_ECP_NORMALIZE_MXZ_ALT */
200 #if defined(MBEDTLS_TEST_NULL_ENTROPY)
201     "MBEDTLS_TEST_NULL_ENTROPY",
202 #endif /* MBEDTLS_TEST_NULL_ENTROPY */
203 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
204     "MBEDTLS_ENTROPY_HARDWARE_ALT",
205 #endif /* MBEDTLS_ENTROPY_HARDWARE_ALT */
206 #if defined(MBEDTLS_AES_ROM_TABLES)
207     "MBEDTLS_AES_ROM_TABLES",
208 #endif /* MBEDTLS_AES_ROM_TABLES */
209 #if defined(MBEDTLS_CAMELLIA_SMALL_MEMORY)
210     "MBEDTLS_CAMELLIA_SMALL_MEMORY",
211 #endif /* MBEDTLS_CAMELLIA_SMALL_MEMORY */
212 #if defined(MBEDTLS_CIPHER_MODE_CBC)
213     "MBEDTLS_CIPHER_MODE_CBC",
214 #endif /* MBEDTLS_CIPHER_MODE_CBC */
215 #if defined(MBEDTLS_CIPHER_MODE_CFB)
216     "MBEDTLS_CIPHER_MODE_CFB",
217 #endif /* MBEDTLS_CIPHER_MODE_CFB */
218 #if defined(MBEDTLS_CIPHER_MODE_CTR)
219     "MBEDTLS_CIPHER_MODE_CTR",
220 #endif /* MBEDTLS_CIPHER_MODE_CTR */
221 #if defined(MBEDTLS_CIPHER_NULL_CIPHER)
222     "MBEDTLS_CIPHER_NULL_CIPHER",
223 #endif /* MBEDTLS_CIPHER_NULL_CIPHER */
224 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
225     "MBEDTLS_CIPHER_PADDING_PKCS7",
226 #endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */
227 #if defined(MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS)
228     "MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS",
229 #endif /* MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS */
230 #if defined(MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN)
231     "MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN",
232 #endif /* MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN */
233 #if defined(MBEDTLS_CIPHER_PADDING_ZEROS)
234     "MBEDTLS_CIPHER_PADDING_ZEROS",
235 #endif /* MBEDTLS_CIPHER_PADDING_ZEROS */
236 #if defined(MBEDTLS_ENABLE_WEAK_CIPHERSUITES)
237     "MBEDTLS_ENABLE_WEAK_CIPHERSUITES",
238 #endif /* MBEDTLS_ENABLE_WEAK_CIPHERSUITES */
239 #if defined(MBEDTLS_REMOVE_ARC4_CIPHERSUITES)
240     "MBEDTLS_REMOVE_ARC4_CIPHERSUITES",
241 #endif /* MBEDTLS_REMOVE_ARC4_CIPHERSUITES */
242 #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
243     "MBEDTLS_ECP_DP_SECP192R1_ENABLED",
244 #endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */
245 #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
246     "MBEDTLS_ECP_DP_SECP224R1_ENABLED",
247 #endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */
248 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
249     "MBEDTLS_ECP_DP_SECP256R1_ENABLED",
250 #endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED */
251 #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
252     "MBEDTLS_ECP_DP_SECP384R1_ENABLED",
253 #endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
254 #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
255     "MBEDTLS_ECP_DP_SECP521R1_ENABLED",
256 #endif /* MBEDTLS_ECP_DP_SECP521R1_ENABLED */
257 #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
258     "MBEDTLS_ECP_DP_SECP192K1_ENABLED",
259 #endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */
260 #if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
261     "MBEDTLS_ECP_DP_SECP224K1_ENABLED",
262 #endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */
263 #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
264     "MBEDTLS_ECP_DP_SECP256K1_ENABLED",
265 #endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */
266 #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
267     "MBEDTLS_ECP_DP_BP256R1_ENABLED",
268 #endif /* MBEDTLS_ECP_DP_BP256R1_ENABLED */
269 #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
270     "MBEDTLS_ECP_DP_BP384R1_ENABLED",
271 #endif /* MBEDTLS_ECP_DP_BP384R1_ENABLED */
272 #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
273     "MBEDTLS_ECP_DP_BP512R1_ENABLED",
274 #endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */
275 #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
276     "MBEDTLS_ECP_DP_CURVE25519_ENABLED",
277 #endif /* MBEDTLS_ECP_DP_CURVE25519_ENABLED */
278 #if defined(MBEDTLS_ECP_NIST_OPTIM)
279     "MBEDTLS_ECP_NIST_OPTIM",
280 #endif /* MBEDTLS_ECP_NIST_OPTIM */
281 #if defined(MBEDTLS_ECDSA_DETERMINISTIC)
282     "MBEDTLS_ECDSA_DETERMINISTIC",
283 #endif /* MBEDTLS_ECDSA_DETERMINISTIC */
284 #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
285     "MBEDTLS_KEY_EXCHANGE_PSK_ENABLED",
286 #endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED */
287 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
288     "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED",
289 #endif /* MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */
290 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
291     "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED",
292 #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED */
293 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
294     "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED",
295 #endif /* MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */
296 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
297     "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED",
298 #endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */
299 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
300     "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED",
301 #endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED */
302 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED)
303     "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED",
304 #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED */
305 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)
306     "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED",
307 #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */
308 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
309     "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED",
310 #endif /* MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */
311 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED)
312     "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED",
313 #endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED */
314 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
315     "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED",
316 #endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
317 #if defined(MBEDTLS_PK_PARSE_EC_EXTENDED)
318     "MBEDTLS_PK_PARSE_EC_EXTENDED",
319 #endif /* MBEDTLS_PK_PARSE_EC_EXTENDED */
320 #if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
321     "MBEDTLS_ERROR_STRERROR_DUMMY",
322 #endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
323 #if defined(MBEDTLS_GENPRIME)
324     "MBEDTLS_GENPRIME",
325 #endif /* MBEDTLS_GENPRIME */
326 #if defined(MBEDTLS_FS_IO)
327     "MBEDTLS_FS_IO",
328 #endif /* MBEDTLS_FS_IO */
329 #if defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
330     "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES",
331 #endif /* MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES */
332 #if defined(MBEDTLS_NO_PLATFORM_ENTROPY)
333     "MBEDTLS_NO_PLATFORM_ENTROPY",
334 #endif /* MBEDTLS_NO_PLATFORM_ENTROPY */
335 #if defined(MBEDTLS_ENTROPY_FORCE_SHA256)
336     "MBEDTLS_ENTROPY_FORCE_SHA256",
337 #endif /* MBEDTLS_ENTROPY_FORCE_SHA256 */
338 #if defined(MBEDTLS_ENTROPY_NV_SEED)
339     "MBEDTLS_ENTROPY_NV_SEED",
340 #endif /* MBEDTLS_ENTROPY_NV_SEED */
341 #if defined(MBEDTLS_MEMORY_DEBUG)
342     "MBEDTLS_MEMORY_DEBUG",
343 #endif /* MBEDTLS_MEMORY_DEBUG */
344 #if defined(MBEDTLS_MEMORY_BACKTRACE)
345     "MBEDTLS_MEMORY_BACKTRACE",
346 #endif /* MBEDTLS_MEMORY_BACKTRACE */
347 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
348     "MBEDTLS_PK_RSA_ALT_SUPPORT",
349 #endif /* MBEDTLS_PK_RSA_ALT_SUPPORT */
350 #if defined(MBEDTLS_PKCS1_V15)
351     "MBEDTLS_PKCS1_V15",
352 #endif /* MBEDTLS_PKCS1_V15 */
353 #if defined(MBEDTLS_PKCS1_V21)
354     "MBEDTLS_PKCS1_V21",
355 #endif /* MBEDTLS_PKCS1_V21 */
356 #if defined(MBEDTLS_RSA_NO_CRT)
357     "MBEDTLS_RSA_NO_CRT",
358 #endif /* MBEDTLS_RSA_NO_CRT */
359 #if defined(MBEDTLS_SELF_TEST)
360     "MBEDTLS_SELF_TEST",
361 #endif /* MBEDTLS_SELF_TEST */
362 #if defined(MBEDTLS_SHA256_SMALLER)
363     "MBEDTLS_SHA256_SMALLER",
364 #endif /* MBEDTLS_SHA256_SMALLER */
365 #if defined(MBEDTLS_SSL_ALL_ALERT_MESSAGES)
366     "MBEDTLS_SSL_ALL_ALERT_MESSAGES",
367 #endif /* MBEDTLS_SSL_ALL_ALERT_MESSAGES */
368 #if defined(MBEDTLS_SSL_DEBUG_ALL)
369     "MBEDTLS_SSL_DEBUG_ALL",
370 #endif /* MBEDTLS_SSL_DEBUG_ALL */
371 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
372     "MBEDTLS_SSL_ENCRYPT_THEN_MAC",
373 #endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
374 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
375     "MBEDTLS_SSL_EXTENDED_MASTER_SECRET",
376 #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
377 #if defined(MBEDTLS_SSL_FALLBACK_SCSV)
378     "MBEDTLS_SSL_FALLBACK_SCSV",
379 #endif /* MBEDTLS_SSL_FALLBACK_SCSV */
380 #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
381     "MBEDTLS_SSL_HW_RECORD_ACCEL",
382 #endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
383 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
384     "MBEDTLS_SSL_CBC_RECORD_SPLITTING",
385 #endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
386 #if defined(MBEDTLS_SSL_RENEGOTIATION)
387     "MBEDTLS_SSL_RENEGOTIATION",
388 #endif /* MBEDTLS_SSL_RENEGOTIATION */
389 #if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
390     "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO",
391 #endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
392 #if defined(MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE)
393     "MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE",
394 #endif /* MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE */
395 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
396     "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH",
397 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
398 #if defined(MBEDTLS_SSL_PROTO_SSL3)
399     "MBEDTLS_SSL_PROTO_SSL3",
400 #endif /* MBEDTLS_SSL_PROTO_SSL3 */
401 #if defined(MBEDTLS_SSL_PROTO_TLS1)
402     "MBEDTLS_SSL_PROTO_TLS1",
403 #endif /* MBEDTLS_SSL_PROTO_TLS1 */
404 #if defined(MBEDTLS_SSL_PROTO_TLS1_1)
405     "MBEDTLS_SSL_PROTO_TLS1_1",
406 #endif /* MBEDTLS_SSL_PROTO_TLS1_1 */
407 #if defined(MBEDTLS_SSL_PROTO_TLS1_2)
408     "MBEDTLS_SSL_PROTO_TLS1_2",
409 #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
410 #if defined(MBEDTLS_SSL_PROTO_DTLS)
411     "MBEDTLS_SSL_PROTO_DTLS",
412 #endif /* MBEDTLS_SSL_PROTO_DTLS */
413 #if defined(MBEDTLS_SSL_ALPN)
414     "MBEDTLS_SSL_ALPN",
415 #endif /* MBEDTLS_SSL_ALPN */
416 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
417     "MBEDTLS_SSL_DTLS_ANTI_REPLAY",
418 #endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
419 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
420     "MBEDTLS_SSL_DTLS_HELLO_VERIFY",
421 #endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY */
422 #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE)
423     "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE",
424 #endif /* MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE */
425 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
426     "MBEDTLS_SSL_DTLS_BADMAC_LIMIT",
427 #endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */
428 #if defined(MBEDTLS_SSL_SESSION_TICKETS)
429     "MBEDTLS_SSL_SESSION_TICKETS",
430 #endif /* MBEDTLS_SSL_SESSION_TICKETS */
431 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
432     "MBEDTLS_SSL_EXPORT_KEYS",
433 #endif /* MBEDTLS_SSL_EXPORT_KEYS */
434 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
435     "MBEDTLS_SSL_SERVER_NAME_INDICATION",
436 #endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
437 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
438     "MBEDTLS_SSL_TRUNCATED_HMAC",
439 #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
440 #if defined(MBEDTLS_THREADING_ALT)
441     "MBEDTLS_THREADING_ALT",
442 #endif /* MBEDTLS_THREADING_ALT */
443 #if defined(MBEDTLS_THREADING_PTHREAD)
444     "MBEDTLS_THREADING_PTHREAD",
445 #endif /* MBEDTLS_THREADING_PTHREAD */
446 #if defined(MBEDTLS_VERSION_FEATURES)
447     "MBEDTLS_VERSION_FEATURES",
448 #endif /* MBEDTLS_VERSION_FEATURES */
449 #if defined(MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3)
450     "MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3",
451 #endif /* MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 */
452 #if defined(MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION)
453     "MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION",
454 #endif /* MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION */
455 #if defined(MBEDTLS_X509_CHECK_KEY_USAGE)
456     "MBEDTLS_X509_CHECK_KEY_USAGE",
457 #endif /* MBEDTLS_X509_CHECK_KEY_USAGE */
458 #if defined(MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE)
459     "MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE",
460 #endif /* MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE */
461 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
462     "MBEDTLS_X509_RSASSA_PSS_SUPPORT",
463 #endif /* MBEDTLS_X509_RSASSA_PSS_SUPPORT */
464 #if defined(MBEDTLS_ZLIB_SUPPORT)
465     "MBEDTLS_ZLIB_SUPPORT",
466 #endif /* MBEDTLS_ZLIB_SUPPORT */
467 #if defined(MBEDTLS_AESNI_C)
468     "MBEDTLS_AESNI_C",
469 #endif /* MBEDTLS_AESNI_C */
470 #if defined(MBEDTLS_AES_C)
471     "MBEDTLS_AES_C",
472 #endif /* MBEDTLS_AES_C */
473 #if defined(MBEDTLS_ARC4_C)
474     "MBEDTLS_ARC4_C",
475 #endif /* MBEDTLS_ARC4_C */
476 #if defined(MBEDTLS_ASN1_PARSE_C)
477     "MBEDTLS_ASN1_PARSE_C",
478 #endif /* MBEDTLS_ASN1_PARSE_C */
479 #if defined(MBEDTLS_ASN1_WRITE_C)
480     "MBEDTLS_ASN1_WRITE_C",
481 #endif /* MBEDTLS_ASN1_WRITE_C */
482 #if defined(MBEDTLS_BASE64_C)
483     "MBEDTLS_BASE64_C",
484 #endif /* MBEDTLS_BASE64_C */
485 #if defined(MBEDTLS_BIGNUM_C)
486     "MBEDTLS_BIGNUM_C",
487 #endif /* MBEDTLS_BIGNUM_C */
488 #if defined(MBEDTLS_BLOWFISH_C)
489     "MBEDTLS_BLOWFISH_C",
490 #endif /* MBEDTLS_BLOWFISH_C */
491 #if defined(MBEDTLS_CAMELLIA_C)
492     "MBEDTLS_CAMELLIA_C",
493 #endif /* MBEDTLS_CAMELLIA_C */
494 #if defined(MBEDTLS_CCM_C)
495     "MBEDTLS_CCM_C",
496 #endif /* MBEDTLS_CCM_C */
497 #if defined(MBEDTLS_CERTS_C)
498     "MBEDTLS_CERTS_C",
499 #endif /* MBEDTLS_CERTS_C */
500 #if defined(MBEDTLS_CIPHER_C)
501     "MBEDTLS_CIPHER_C",
502 #endif /* MBEDTLS_CIPHER_C */
503 #if defined(MBEDTLS_CMAC_C)
504     "MBEDTLS_CMAC_C",
505 #endif /* MBEDTLS_CMAC_C */
506 #if defined(MBEDTLS_CTR_DRBG_C)
507     "MBEDTLS_CTR_DRBG_C",
508 #endif /* MBEDTLS_CTR_DRBG_C */
509 #if defined(MBEDTLS_DEBUG_C)
510     "MBEDTLS_DEBUG_C",
511 #endif /* MBEDTLS_DEBUG_C */
512 #if defined(MBEDTLS_DES_C)
513     "MBEDTLS_DES_C",
514 #endif /* MBEDTLS_DES_C */
515 #if defined(MBEDTLS_DHM_C)
516     "MBEDTLS_DHM_C",
517 #endif /* MBEDTLS_DHM_C */
518 #if defined(MBEDTLS_ECDH_C)
519     "MBEDTLS_ECDH_C",
520 #endif /* MBEDTLS_ECDH_C */
521 #if defined(MBEDTLS_ECDSA_C)
522     "MBEDTLS_ECDSA_C",
523 #endif /* MBEDTLS_ECDSA_C */
524 #if defined(MBEDTLS_ECJPAKE_C)
525     "MBEDTLS_ECJPAKE_C",
526 #endif /* MBEDTLS_ECJPAKE_C */
527 #if defined(MBEDTLS_ECP_C)
528     "MBEDTLS_ECP_C",
529 #endif /* MBEDTLS_ECP_C */
530 #if defined(MBEDTLS_ENTROPY_C)
531     "MBEDTLS_ENTROPY_C",
532 #endif /* MBEDTLS_ENTROPY_C */
533 #if defined(MBEDTLS_ERROR_C)
534     "MBEDTLS_ERROR_C",
535 #endif /* MBEDTLS_ERROR_C */
536 #if defined(MBEDTLS_GCM_C)
537     "MBEDTLS_GCM_C",
538 #endif /* MBEDTLS_GCM_C */
539 #if defined(MBEDTLS_HAVEGE_C)
540     "MBEDTLS_HAVEGE_C",
541 #endif /* MBEDTLS_HAVEGE_C */
542 #if defined(MBEDTLS_HMAC_DRBG_C)
543     "MBEDTLS_HMAC_DRBG_C",
544 #endif /* MBEDTLS_HMAC_DRBG_C */
545 #if defined(MBEDTLS_MD_C)
546     "MBEDTLS_MD_C",
547 #endif /* MBEDTLS_MD_C */
548 #if defined(MBEDTLS_MD2_C)
549     "MBEDTLS_MD2_C",
550 #endif /* MBEDTLS_MD2_C */
551 #if defined(MBEDTLS_MD4_C)
552     "MBEDTLS_MD4_C",
553 #endif /* MBEDTLS_MD4_C */
554 #if defined(MBEDTLS_MD5_C)
555     "MBEDTLS_MD5_C",
556 #endif /* MBEDTLS_MD5_C */
557 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
558     "MBEDTLS_MEMORY_BUFFER_ALLOC_C",
559 #endif /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */
560 #if defined(MBEDTLS_NET_C)
561     "MBEDTLS_NET_C",
562 #endif /* MBEDTLS_NET_C */
563 #if defined(MBEDTLS_OID_C)
564     "MBEDTLS_OID_C",
565 #endif /* MBEDTLS_OID_C */
566 #if defined(MBEDTLS_PADLOCK_C)
567     "MBEDTLS_PADLOCK_C",
568 #endif /* MBEDTLS_PADLOCK_C */
569 #if defined(MBEDTLS_PEM_PARSE_C)
570     "MBEDTLS_PEM_PARSE_C",
571 #endif /* MBEDTLS_PEM_PARSE_C */
572 #if defined(MBEDTLS_PEM_WRITE_C)
573     "MBEDTLS_PEM_WRITE_C",
574 #endif /* MBEDTLS_PEM_WRITE_C */
575 #if defined(MBEDTLS_PK_C)
576     "MBEDTLS_PK_C",
577 #endif /* MBEDTLS_PK_C */
578 #if defined(MBEDTLS_PK_PARSE_C)
579     "MBEDTLS_PK_PARSE_C",
580 #endif /* MBEDTLS_PK_PARSE_C */
581 #if defined(MBEDTLS_PK_WRITE_C)
582     "MBEDTLS_PK_WRITE_C",
583 #endif /* MBEDTLS_PK_WRITE_C */
584 #if defined(MBEDTLS_PKCS5_C)
585     "MBEDTLS_PKCS5_C",
586 #endif /* MBEDTLS_PKCS5_C */
587 #if defined(MBEDTLS_PKCS11_C)
588     "MBEDTLS_PKCS11_C",
589 #endif /* MBEDTLS_PKCS11_C */
590 #if defined(MBEDTLS_PKCS12_C)
591     "MBEDTLS_PKCS12_C",
592 #endif /* MBEDTLS_PKCS12_C */
593 #if defined(MBEDTLS_PLATFORM_C)
594     "MBEDTLS_PLATFORM_C",
595 #endif /* MBEDTLS_PLATFORM_C */
596 #if defined(MBEDTLS_RIPEMD160_C)
597     "MBEDTLS_RIPEMD160_C",
598 #endif /* MBEDTLS_RIPEMD160_C */
599 #if defined(MBEDTLS_RSA_C)
600     "MBEDTLS_RSA_C",
601 #endif /* MBEDTLS_RSA_C */
602 #if defined(MBEDTLS_SHA1_C)
603     "MBEDTLS_SHA1_C",
604 #endif /* MBEDTLS_SHA1_C */
605 #if defined(MBEDTLS_SHA256_C)
606     "MBEDTLS_SHA256_C",
607 #endif /* MBEDTLS_SHA256_C */
608 #if defined(MBEDTLS_SHA512_C)
609     "MBEDTLS_SHA512_C",
610 #endif /* MBEDTLS_SHA512_C */
611 #if defined(MBEDTLS_SSL_CACHE_C)
612     "MBEDTLS_SSL_CACHE_C",
613 #endif /* MBEDTLS_SSL_CACHE_C */
614 #if defined(MBEDTLS_SSL_COOKIE_C)
615     "MBEDTLS_SSL_COOKIE_C",
616 #endif /* MBEDTLS_SSL_COOKIE_C */
617 #if defined(MBEDTLS_SSL_TICKET_C)
618     "MBEDTLS_SSL_TICKET_C",
619 #endif /* MBEDTLS_SSL_TICKET_C */
620 #if defined(MBEDTLS_SSL_CLI_C)
621     "MBEDTLS_SSL_CLI_C",
622 #endif /* MBEDTLS_SSL_CLI_C */
623 #if defined(MBEDTLS_SSL_SRV_C)
624     "MBEDTLS_SSL_SRV_C",
625 #endif /* MBEDTLS_SSL_SRV_C */
626 #if defined(MBEDTLS_SSL_TLS_C)
627     "MBEDTLS_SSL_TLS_C",
628 #endif /* MBEDTLS_SSL_TLS_C */
629 #if defined(MBEDTLS_THREADING_C)
630     "MBEDTLS_THREADING_C",
631 #endif /* MBEDTLS_THREADING_C */
632 #if defined(MBEDTLS_TIMING_C)
633     "MBEDTLS_TIMING_C",
634 #endif /* MBEDTLS_TIMING_C */
635 #if defined(MBEDTLS_VERSION_C)
636     "MBEDTLS_VERSION_C",
637 #endif /* MBEDTLS_VERSION_C */
638 #if defined(MBEDTLS_X509_USE_C)
639     "MBEDTLS_X509_USE_C",
640 #endif /* MBEDTLS_X509_USE_C */
641 #if defined(MBEDTLS_X509_CRT_PARSE_C)
642     "MBEDTLS_X509_CRT_PARSE_C",
643 #endif /* MBEDTLS_X509_CRT_PARSE_C */
644 #if defined(MBEDTLS_X509_CRL_PARSE_C)
645     "MBEDTLS_X509_CRL_PARSE_C",
646 #endif /* MBEDTLS_X509_CRL_PARSE_C */
647 #if defined(MBEDTLS_X509_CSR_PARSE_C)
648     "MBEDTLS_X509_CSR_PARSE_C",
649 #endif /* MBEDTLS_X509_CSR_PARSE_C */
650 #if defined(MBEDTLS_X509_CREATE_C)
651     "MBEDTLS_X509_CREATE_C",
652 #endif /* MBEDTLS_X509_CREATE_C */
653 #if defined(MBEDTLS_X509_CRT_WRITE_C)
654     "MBEDTLS_X509_CRT_WRITE_C",
655 #endif /* MBEDTLS_X509_CRT_WRITE_C */
656 #if defined(MBEDTLS_X509_CSR_WRITE_C)
657     "MBEDTLS_X509_CSR_WRITE_C",
658 #endif /* MBEDTLS_X509_CSR_WRITE_C */
659 #if defined(MBEDTLS_XTEA_C)
660     "MBEDTLS_XTEA_C",
661 #endif /* MBEDTLS_XTEA_C */
662 #endif /* MBEDTLS_VERSION_FEATURES */
663     NULL
664 };
665 
666 int mbedtls_version_check_feature( const char *feature )
667 {
668     const char **idx = features;
669 
670     if( *idx == NULL )
671         return( -2 );
672 
673     if( feature == NULL )
674         return( -1 );
675 
676     while( *idx != NULL )
677     {
678         if( !strcmp( *idx, feature ) )
679             return( 0 );
680         idx++;
681     }
682     return( -1 );
683 }
684 
685 #endif /* MBEDTLS_VERSION_C */
686