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