2018-10-16 23:00:13 +02:00
|
|
|
/*
|
2021-05-28 09:42:25 +02:00
|
|
|
* Query Mbed TLS compile time configurations from mbedtls_config.h
|
2018-10-16 23:00:13 +02:00
|
|
|
*
|
2020-08-07 13:07:28 +02:00
|
|
|
* Copyright The Mbed TLS Contributors
|
2018-10-16 23:00:13 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2021-05-27 11:25:03 +02:00
|
|
|
#include "mbedtls/build_info.h"
|
2018-10-16 23:00:13 +02:00
|
|
|
|
2021-01-12 15:55:10 +01:00
|
|
|
#include "query_config.h"
|
|
|
|
|
2018-10-16 23:00:13 +02:00
|
|
|
#if defined(MBEDTLS_PLATFORM_C)
|
|
|
|
#include "mbedtls/platform.h"
|
|
|
|
#else
|
2018-10-29 19:38:36 +01:00
|
|
|
#include <stdio.h>
|
2018-10-16 23:00:13 +02:00
|
|
|
#define mbedtls_printf printf
|
|
|
|
#endif /* MBEDTLS_PLATFORM_C */
|
|
|
|
|
2018-10-29 19:58:41 +01:00
|
|
|
/*
|
|
|
|
* Include all the headers with public APIs in case they define a macro to its
|
2021-05-28 09:42:25 +02:00
|
|
|
* default value when that configuration is not set in the mbedtls_config.h.
|
2018-10-29 19:58:41 +01:00
|
|
|
*/
|
2018-10-16 23:00:13 +02:00
|
|
|
#include "mbedtls/aes.h"
|
|
|
|
#include "mbedtls/aria.h"
|
|
|
|
#include "mbedtls/asn1.h"
|
|
|
|
#include "mbedtls/asn1write.h"
|
|
|
|
#include "mbedtls/base64.h"
|
|
|
|
#include "mbedtls/bignum.h"
|
|
|
|
#include "mbedtls/camellia.h"
|
|
|
|
#include "mbedtls/ccm.h"
|
|
|
|
#include "mbedtls/chacha20.h"
|
|
|
|
#include "mbedtls/chachapoly.h"
|
|
|
|
#include "mbedtls/cipher.h"
|
|
|
|
#include "mbedtls/cmac.h"
|
|
|
|
#include "mbedtls/ctr_drbg.h"
|
|
|
|
#include "mbedtls/debug.h"
|
|
|
|
#include "mbedtls/des.h"
|
|
|
|
#include "mbedtls/dhm.h"
|
|
|
|
#include "mbedtls/ecdh.h"
|
|
|
|
#include "mbedtls/ecdsa.h"
|
|
|
|
#include "mbedtls/ecjpake.h"
|
|
|
|
#include "mbedtls/ecp.h"
|
|
|
|
#include "mbedtls/entropy.h"
|
|
|
|
#include "mbedtls/error.h"
|
|
|
|
#include "mbedtls/gcm.h"
|
|
|
|
#include "mbedtls/hkdf.h"
|
|
|
|
#include "mbedtls/hmac_drbg.h"
|
|
|
|
#include "mbedtls/md.h"
|
|
|
|
#include "mbedtls/md5.h"
|
|
|
|
#include "mbedtls/memory_buffer_alloc.h"
|
|
|
|
#include "mbedtls/net_sockets.h"
|
|
|
|
#include "mbedtls/nist_kw.h"
|
|
|
|
#include "mbedtls/oid.h"
|
|
|
|
#include "mbedtls/pem.h"
|
|
|
|
#include "mbedtls/pk.h"
|
|
|
|
#include "mbedtls/pkcs12.h"
|
|
|
|
#include "mbedtls/pkcs5.h"
|
|
|
|
#include "mbedtls/platform_time.h"
|
|
|
|
#include "mbedtls/platform_util.h"
|
|
|
|
#include "mbedtls/poly1305.h"
|
|
|
|
#include "mbedtls/ripemd160.h"
|
|
|
|
#include "mbedtls/rsa.h"
|
|
|
|
#include "mbedtls/sha1.h"
|
|
|
|
#include "mbedtls/sha256.h"
|
|
|
|
#include "mbedtls/sha512.h"
|
|
|
|
#include "mbedtls/ssl.h"
|
|
|
|
#include "mbedtls/ssl_cache.h"
|
|
|
|
#include "mbedtls/ssl_ciphersuites.h"
|
|
|
|
#include "mbedtls/ssl_cookie.h"
|
|
|
|
#include "mbedtls/ssl_ticket.h"
|
|
|
|
#include "mbedtls/threading.h"
|
|
|
|
#include "mbedtls/timing.h"
|
|
|
|
#include "mbedtls/version.h"
|
|
|
|
#include "mbedtls/x509.h"
|
|
|
|
#include "mbedtls/x509_crl.h"
|
|
|
|
#include "mbedtls/x509_crt.h"
|
|
|
|
#include "mbedtls/x509_csr.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2018-12-05 11:47:31 +01:00
|
|
|
/*
|
|
|
|
* Helper macros to convert a macro or its expansion into a string
|
|
|
|
* WARNING: This does not work for expanding function-like macros. However,
|
|
|
|
* Mbed TLS does not currently have configuration options used in this fashion.
|
|
|
|
*/
|
2018-10-16 23:00:13 +02:00
|
|
|
#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
|
2018-12-05 11:47:31 +01:00
|
|
|
#define MACRO_NAME_TO_STR(macro) \
|
|
|
|
mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
|
2018-10-16 23:00:13 +02:00
|
|
|
|
2021-12-10 13:29:02 +01:00
|
|
|
#define STRINGIFY(macro) #macro
|
2021-12-06 06:40:37 +01:00
|
|
|
#define OUTPUT_MACRO_NAME_VALUE(macro) mbedtls_printf( #macro "%s\n", \
|
2021-12-10 14:38:12 +01:00
|
|
|
( STRINGIFY(macro) "" )[0] != 0 ? "=" STRINGIFY(macro) : "" )
|
2021-12-06 06:40:37 +01:00
|
|
|
|
2019-01-24 10:55:14 +01:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
/*
|
|
|
|
* Visual Studio throws the warning 4003 because many Mbed TLS feature macros
|
|
|
|
* are defined empty. This means that from the preprocessor's point of view
|
|
|
|
* the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as
|
|
|
|
* some macros expand to nothing. We suppress that specific warning to get a
|
|
|
|
* clean build and to ensure that tests treating warnings as errors do not
|
|
|
|
* fail.
|
|
|
|
*/
|
|
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(disable:4003)
|
|
|
|
#endif /* _MSC_VER */
|
|
|
|
|
2018-10-16 23:00:13 +02:00
|
|
|
int query_config( const char *config )
|
|
|
|
{
|
2018-10-29 19:58:41 +01:00
|
|
|
CHECK_CONFIG /* If the symbol is not found, return an error */
|
|
|
|
return( 1 );
|
2018-10-16 23:00:13 +02:00
|
|
|
}
|
2019-01-24 10:55:14 +01:00
|
|
|
|
2021-12-06 06:40:37 +01:00
|
|
|
void list_config( void )
|
|
|
|
{
|
|
|
|
LIST_CONFIG
|
|
|
|
}
|
2019-01-24 10:55:14 +01:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#pragma warning(pop)
|
|
|
|
#endif /* _MSC_VER */
|