1/* 2 * Query Mbed TLS compile time configurations from config.h 3 * 4 * Copyright The Mbed TLS Contributors 5 * 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. 18 */ 19 20#if !defined(MBEDTLS_CONFIG_FILE) 21#include "mbedtls/config.h" 22#else 23#include MBEDTLS_CONFIG_FILE 24#endif 25 26#include "query_config.h" 27 28#if defined(MBEDTLS_PLATFORM_C) 29#include "mbedtls/platform.h" 30#else 31#include <stdio.h> 32#define mbedtls_printf printf 33#endif /* MBEDTLS_PLATFORM_C */ 34 35/* 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 */ 39#include "mbedtls/aes.h" 40#include "mbedtls/aesni.h" 41#include "mbedtls/arc4.h" 42#include "mbedtls/aria.h" 43#include "mbedtls/asn1.h" 44#include "mbedtls/asn1write.h" 45#include "mbedtls/base64.h" 46#include "mbedtls/bignum.h" 47#include "mbedtls/blowfish.h" 48#include "mbedtls/camellia.h" 49#include "mbedtls/ccm.h" 50#include "mbedtls/certs.h" 51#include "mbedtls/chacha20.h" 52#include "mbedtls/chachapoly.h" 53#include "mbedtls/cipher.h" 54#include "mbedtls/cmac.h" 55#include "mbedtls/ctr_drbg.h" 56#include "mbedtls/debug.h" 57#include "mbedtls/des.h" 58#include "mbedtls/dhm.h" 59#include "mbedtls/ecdh.h" 60#include "mbedtls/ecdsa.h" 61#include "mbedtls/ecjpake.h" 62#include "mbedtls/ecp.h" 63#include "mbedtls/entropy.h" 64#include "mbedtls/entropy_poll.h" 65#include "mbedtls/error.h" 66#include "mbedtls/gcm.h" 67#include "mbedtls/havege.h" 68#include "mbedtls/hkdf.h" 69#include "mbedtls/hmac_drbg.h" 70#include "mbedtls/md.h" 71#include "mbedtls/md2.h" 72#include "mbedtls/md4.h" 73#include "mbedtls/md5.h" 74#include "mbedtls/memory_buffer_alloc.h" 75#include "mbedtls/net_sockets.h" 76#include "mbedtls/nist_kw.h" 77#include "mbedtls/oid.h" 78#include "mbedtls/padlock.h" 79#include "mbedtls/pem.h" 80#include "mbedtls/pk.h" 81#include "mbedtls/pkcs11.h" 82#include "mbedtls/pkcs12.h" 83#include "mbedtls/pkcs5.h" 84#include "mbedtls/platform_time.h" 85#include "mbedtls/platform_util.h" 86#include "mbedtls/poly1305.h" 87#include "mbedtls/ripemd160.h" 88#include "mbedtls/rsa.h" 89#include "mbedtls/sha1.h" 90#include "mbedtls/sha256.h" 91#include "mbedtls/sha512.h" 92#include "mbedtls/ssl.h" 93#include "mbedtls/ssl_cache.h" 94#include "mbedtls/ssl_ciphersuites.h" 95#include "mbedtls/ssl_cookie.h" 96#include "mbedtls/ssl_internal.h" 97#include "mbedtls/ssl_ticket.h" 98#include "mbedtls/threading.h" 99#include "mbedtls/timing.h" 100#include "mbedtls/version.h" 101#include "mbedtls/x509.h" 102#include "mbedtls/x509_crl.h" 103#include "mbedtls/x509_crt.h" 104#include "mbedtls/x509_csr.h" 105#include "mbedtls/xtea.h" 106 107#include <string.h> 108 109/* 110 * Helper macros to convert a macro or its expansion into a string 111 * WARNING: This does not work for expanding function-like macros. However, 112 * Mbed TLS does not currently have configuration options used in this fashion. 113 */ 114#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro) 115#define MACRO_NAME_TO_STR(macro) \ 116 mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" ) 117 118#if defined(_MSC_VER) 119/* 120 * Visual Studio throws the warning 4003 because many Mbed TLS feature macros 121 * are defined empty. This means that from the preprocessor's point of view 122 * the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as 123 * some macros expand to nothing. We suppress that specific warning to get a 124 * clean build and to ensure that tests treating warnings as errors do not 125 * fail. 126 */ 127#pragma warning(push) 128#pragma warning(disable:4003) 129#endif /* _MSC_VER */ 130 131int query_config( const char *config ) 132{ 133CHECK_CONFIG /* If the symbol is not found, return an error */ 134 return( 1 ); 135} 136 137#if defined(_MSC_VER) 138#pragma warning(pop) 139#endif /* _MSC_VER */ 140