blob: dc91d83ed66c730f98f0ea3b99caf926c0db2113 [file] [log] [blame]
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +01001/*
Andres Amaya Garcia5547a402018-10-29 18:58:41 +00002 * Query Mbed TLS compile time configurations from config.h
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +01003 *
Bence Szépkútia2947ac2020-08-19 16:37:36 +02004 * Copyright The Mbed TLS Contributors
Bence Szépkútif744bd72020-06-05 13:02:18 +02005 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
6 *
7 * This file is provided under the Apache License 2.0, or the
8 * GNU General Public License v2.0 or later.
9 *
10 * **********
11 * Apache License 2.0:
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +010012 *
13 * Licensed under the Apache License, Version 2.0 (the "License"); you may
14 * not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
Bence Szépkútif744bd72020-06-05 13:02:18 +020025 * **********
26 *
27 * **********
28 * GNU General Public License v2.0 or later:
29 *
30 * This program is free software; you can redistribute it and/or modify
31 * it under the terms of the GNU General Public License as published by
32 * the Free Software Foundation; either version 2 of the License, or
33 * (at your option) any later version.
34 *
35 * This program is distributed in the hope that it will be useful,
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 * GNU General Public License for more details.
39 *
40 * You should have received a copy of the GNU General Public License along
41 * with this program; if not, write to the Free Software Foundation, Inc.,
42 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
43 *
44 * **********
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +010045 */
46
47#if !defined(MBEDTLS_CONFIG_FILE)
48#include "mbedtls/config.h"
49#else
50#include MBEDTLS_CONFIG_FILE
51#endif
52
53#if defined(MBEDTLS_PLATFORM_C)
54#include "mbedtls/platform.h"
55#else
Andres Amaya Garcia289c64a2018-10-29 18:38:36 +000056#include <stdio.h>
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +010057#define mbedtls_printf printf
58#endif /* MBEDTLS_PLATFORM_C */
59
Andres Amaya Garcia5547a402018-10-29 18:58:41 +000060/*
61 * Include all the headers with public APIs in case they define a macro to its
62 * default value when that configuration is not set in the config.h.
63 */
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +010064#include "mbedtls/aes.h"
65#include "mbedtls/aesni.h"
66#include "mbedtls/arc4.h"
67#include "mbedtls/aria.h"
68#include "mbedtls/asn1.h"
69#include "mbedtls/asn1write.h"
70#include "mbedtls/base64.h"
71#include "mbedtls/bignum.h"
72#include "mbedtls/blowfish.h"
73#include "mbedtls/camellia.h"
74#include "mbedtls/ccm.h"
75#include "mbedtls/certs.h"
76#include "mbedtls/chacha20.h"
77#include "mbedtls/chachapoly.h"
78#include "mbedtls/cipher.h"
79#include "mbedtls/cmac.h"
80#include "mbedtls/ctr_drbg.h"
81#include "mbedtls/debug.h"
82#include "mbedtls/des.h"
83#include "mbedtls/dhm.h"
84#include "mbedtls/ecdh.h"
85#include "mbedtls/ecdsa.h"
86#include "mbedtls/ecjpake.h"
87#include "mbedtls/ecp.h"
88#include "mbedtls/entropy.h"
89#include "mbedtls/entropy_poll.h"
90#include "mbedtls/error.h"
91#include "mbedtls/gcm.h"
92#include "mbedtls/havege.h"
93#include "mbedtls/hkdf.h"
94#include "mbedtls/hmac_drbg.h"
95#include "mbedtls/md.h"
96#include "mbedtls/md2.h"
97#include "mbedtls/md4.h"
98#include "mbedtls/md5.h"
99#include "mbedtls/memory_buffer_alloc.h"
100#include "mbedtls/net_sockets.h"
101#include "mbedtls/nist_kw.h"
102#include "mbedtls/oid.h"
103#include "mbedtls/padlock.h"
104#include "mbedtls/pem.h"
105#include "mbedtls/pk.h"
106#include "mbedtls/pkcs11.h"
107#include "mbedtls/pkcs12.h"
108#include "mbedtls/pkcs5.h"
109#include "mbedtls/platform_time.h"
110#include "mbedtls/platform_util.h"
111#include "mbedtls/poly1305.h"
112#include "mbedtls/ripemd160.h"
113#include "mbedtls/rsa.h"
114#include "mbedtls/sha1.h"
115#include "mbedtls/sha256.h"
116#include "mbedtls/sha512.h"
117#include "mbedtls/ssl.h"
118#include "mbedtls/ssl_cache.h"
119#include "mbedtls/ssl_ciphersuites.h"
120#include "mbedtls/ssl_cookie.h"
121#include "mbedtls/ssl_internal.h"
122#include "mbedtls/ssl_ticket.h"
123#include "mbedtls/threading.h"
124#include "mbedtls/timing.h"
125#include "mbedtls/version.h"
126#include "mbedtls/x509.h"
127#include "mbedtls/x509_crl.h"
128#include "mbedtls/x509_crt.h"
129#include "mbedtls/x509_csr.h"
130#include "mbedtls/xtea.h"
131
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +0100132#include <string.h>
133
Andres Amaya Garciac500ad82018-12-05 10:47:31 +0000134/*
135 * Helper macros to convert a macro or its expansion into a string
136 * WARNING: This does not work for expanding function-like macros. However,
137 * Mbed TLS does not currently have configuration options used in this fashion.
138 */
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +0100139#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
Andres Amaya Garciac500ad82018-12-05 10:47:31 +0000140#define MACRO_NAME_TO_STR(macro) \
141 mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +0100142
Andres Amaya Garcia4c47e182019-01-24 09:55:14 +0000143#if defined(_MSC_VER)
144/*
145 * Visual Studio throws the warning 4003 because many Mbed TLS feature macros
146 * are defined empty. This means that from the preprocessor's point of view
147 * the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as
148 * some macros expand to nothing. We suppress that specific warning to get a
149 * clean build and to ensure that tests treating warnings as errors do not
150 * fail.
151 */
152#pragma warning(push)
153#pragma warning(disable:4003)
154#endif /* _MSC_VER */
155
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +0100156int query_config( const char *config )
157{
Andres Amaya Garcia5547a402018-10-29 18:58:41 +0000158CHECK_CONFIG /* If the symbol is not found, return an error */
159 return( 1 );
Andres Amaya Garciaf1a5b262018-10-16 22:00:13 +0100160}
Andres Amaya Garcia4c47e182019-01-24 09:55:14 +0000161
162#if defined(_MSC_VER)
163#pragma warning(pop)
164#endif /* _MSC_VER */