blob: c707e4ca3bf7fc8c87e7a76417cf379e650b15b1 [file] [log] [blame]
Andres Amaya Garcia88121a92018-10-16 22:00:13 +01001/*
Andres Amaya Garciac28da7e2018-10-29 18:58:41 +00002 * Query Mbed TLS compile time configurations from config.h
Andres Amaya Garcia88121a92018-10-16 22:00:13 +01003 *
Bence Szépkúti1e148272020-08-07 13:07:28 +02004 * Copyright The Mbed TLS Contributors
Andres Amaya Garcia88121a92018-10-16 22:00:13 +01005 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010018 */
19
20#if !defined(MBEDTLS_CONFIG_FILE)
21#include "mbedtls/config.h"
22#else
23#include MBEDTLS_CONFIG_FILE
24#endif
25
Gilles Peskinec772b182021-01-12 15:55:10 +010026#include "query_config.h"
27
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010028#if defined(MBEDTLS_PLATFORM_C)
29#include "mbedtls/platform.h"
30#else
Andres Amaya Garcia2fdc2c22018-10-29 18:38:36 +000031#include <stdio.h>
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010032#define mbedtls_printf printf
33#endif /* MBEDTLS_PLATFORM_C */
34
Andres Amaya Garciac28da7e2018-10-29 18:58:41 +000035/*
36 * Include all the headers with public APIs in case they define a macro to its
37 * default value when that configuration is not set in the config.h.
38 */
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010039#include "mbedtls/aes.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010040#include "mbedtls/aria.h"
41#include "mbedtls/asn1.h"
42#include "mbedtls/asn1write.h"
43#include "mbedtls/base64.h"
44#include "mbedtls/bignum.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010045#include "mbedtls/camellia.h"
46#include "mbedtls/ccm.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010047#include "mbedtls/chacha20.h"
48#include "mbedtls/chachapoly.h"
49#include "mbedtls/cipher.h"
50#include "mbedtls/cmac.h"
51#include "mbedtls/ctr_drbg.h"
52#include "mbedtls/debug.h"
53#include "mbedtls/des.h"
54#include "mbedtls/dhm.h"
55#include "mbedtls/ecdh.h"
56#include "mbedtls/ecdsa.h"
57#include "mbedtls/ecjpake.h"
58#include "mbedtls/ecp.h"
59#include "mbedtls/entropy.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010060#include "mbedtls/error.h"
61#include "mbedtls/gcm.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010062#include "mbedtls/hkdf.h"
63#include "mbedtls/hmac_drbg.h"
64#include "mbedtls/md.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010065#include "mbedtls/md5.h"
66#include "mbedtls/memory_buffer_alloc.h"
67#include "mbedtls/net_sockets.h"
68#include "mbedtls/nist_kw.h"
69#include "mbedtls/oid.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010070#include "mbedtls/pem.h"
71#include "mbedtls/pk.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010072#include "mbedtls/pkcs12.h"
73#include "mbedtls/pkcs5.h"
74#include "mbedtls/platform_time.h"
75#include "mbedtls/platform_util.h"
76#include "mbedtls/poly1305.h"
77#include "mbedtls/ripemd160.h"
78#include "mbedtls/rsa.h"
79#include "mbedtls/sha1.h"
80#include "mbedtls/sha256.h"
81#include "mbedtls/sha512.h"
82#include "mbedtls/ssl.h"
83#include "mbedtls/ssl_cache.h"
84#include "mbedtls/ssl_ciphersuites.h"
85#include "mbedtls/ssl_cookie.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010086#include "mbedtls/ssl_ticket.h"
87#include "mbedtls/threading.h"
88#include "mbedtls/timing.h"
89#include "mbedtls/version.h"
90#include "mbedtls/x509.h"
91#include "mbedtls/x509_crl.h"
92#include "mbedtls/x509_crt.h"
93#include "mbedtls/x509_csr.h"
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010094
Andres Amaya Garcia88121a92018-10-16 22:00:13 +010095#include <string.h>
96
Andres Amaya Garcia27b33722018-12-05 10:47:31 +000097/*
98 * Helper macros to convert a macro or its expansion into a string
99 * WARNING: This does not work for expanding function-like macros. However,
100 * Mbed TLS does not currently have configuration options used in this fashion.
101 */
Andres Amaya Garcia88121a92018-10-16 22:00:13 +0100102#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
Andres Amaya Garcia27b33722018-12-05 10:47:31 +0000103#define MACRO_NAME_TO_STR(macro) \
104 mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
Andres Amaya Garcia88121a92018-10-16 22:00:13 +0100105
Andres Amaya Garcia17c53c52019-01-24 09:55:14 +0000106#if defined(_MSC_VER)
107/*
108 * Visual Studio throws the warning 4003 because many Mbed TLS feature macros
109 * are defined empty. This means that from the preprocessor's point of view
110 * the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as
111 * some macros expand to nothing. We suppress that specific warning to get a
112 * clean build and to ensure that tests treating warnings as errors do not
113 * fail.
114 */
115#pragma warning(push)
116#pragma warning(disable:4003)
117#endif /* _MSC_VER */
118
Andres Amaya Garcia88121a92018-10-16 22:00:13 +0100119int query_config( const char *config )
120{
Andres Amaya Garciac28da7e2018-10-29 18:58:41 +0000121CHECK_CONFIG /* If the symbol is not found, return an error */
122 return( 1 );
Andres Amaya Garcia88121a92018-10-16 22:00:13 +0100123}
Andres Amaya Garcia17c53c52019-01-24 09:55:14 +0000124
125#if defined(_MSC_VER)
126#pragma warning(pop)
127#endif /* _MSC_VER */