Files
mbedtls/scripts/data_files/query_config.fmt
T

64 lines
1.9 KiB
C
Raw Normal View History

/* -*-c-*-
2021-05-28 09:42:25 +02:00
* Query Mbed TLS compile time configurations from mbedtls_config.h
2018-10-16 22:00:13 +01:00
*
* Copyright The Mbed TLS Contributors
2023-11-02 19:47:20 +00:00
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2018-10-16 22:00:13 +01:00
*/
2021-05-27 11:25:03 +02:00
#include "mbedtls/build_info.h"
2018-10-16 22:00:13 +01:00
#include "query_config.h"
2018-10-16 22:00:13 +01:00
#include "mbedtls/platform.h"
#include <string.h>
/* Work around https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/393 */
#if defined(MBEDTLS_HAVE_TIME)
#include <mbedtls/platform_time.h>
#endif
2025-07-26 00:23:05 +02:00
/* *INDENT-OFF* */
INCLUDE_HEADERS
2025-07-26 00:23:05 +02:00
/* *INDENT-ON* */
/*
* 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 22:00:13 +01:00
#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
#define MACRO_NAME_TO_STR(macro) \
2023-01-11 14:50:10 +01:00
mbedtls_printf("%s", strlen( #macro "") > 0 ? #macro "\n" : "")
2018-10-16 22:00:13 +01:00
2021-12-10 20:29:02 +08:00
#define STRINGIFY(macro) #macro
2021-12-06 13:40:37 +08:00
#define OUTPUT_MACRO_NAME_VALUE(macro) mbedtls_printf( #macro "%s\n", \
2023-01-11 14:50:10 +01:00
(STRINGIFY(macro) "")[0] != 0 ? "=" STRINGIFY( \
macro) : "")
2021-12-06 13:40:37 +08: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 */
2023-01-11 14:50:10 +01:00
int query_config(const char *config)
2018-10-16 22:00:13 +01:00
{
2023-01-11 14:50:10 +01:00
CHECK_CONFIG /* If the symbol is not found, return an error */
return 1;
2018-10-16 22:00:13 +01:00
}
2023-01-11 14:50:10 +01:00
void list_config(void)
2021-12-06 13:40:37 +08:00
{
LIST_CONFIG
}
#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */