diff --git a/programs/ssl/query_config.c b/programs/ssl/query_config.c index c3cf1f8575..af518e8ba1 100644 --- a/programs/ssl/query_config.c +++ b/programs/ssl/query_config.c @@ -2413,14 +2413,6 @@ int query_config( const char *config ) } #endif /* MBEDTLS_SSL_COOKIE_TIMEOUT */ -#if defined(MBEDTLS_SSL_CIPHERSUITES) - if( strcmp( "MBEDTLS_SSL_CIPHERSUITES", config ) == 0 ) - { - MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CIPHERSUITES ); - return( 0 ); - } -#endif /* MBEDTLS_SSL_CIPHERSUITES */ - #if defined(MBEDTLS_X509_MAX_INTERMEDIATE_CA) if( strcmp( "MBEDTLS_X509_MAX_INTERMEDIATE_CA", config ) == 0 ) { diff --git a/scripts/generate_query_config.pl b/scripts/generate_query_config.pl index 747001a034..651f0d4d7e 100755 --- a/scripts/generate_query_config.pl +++ b/scripts/generate_query_config.pl @@ -23,6 +23,15 @@ my $config_file = "./include/mbedtls/config.h"; my $query_config_format_file = "./scripts/data_files/query_config.fmt"; my $query_config_file = "./programs/ssl/query_config.c"; +# Excluded macros from the generated query_config.c. For example, macros that +# have commas or function-like macros cannot be transformed into strings easily +# using the preprocessor, so they should be excluded or the preprocessor will +# throw errors. +my @excluded = qw( +MBEDTLS_SSL_CIPHERSUITES +); +my $excluded_re = join '|', @excluded; + open(CONFIG_FILE, "$config_file") or die "Opening config file '$config_file': $!"; # This variable will contain the string to replace in the CHECK_CONFIG of the @@ -36,6 +45,9 @@ while (my $line = ) { # Skip over the macro that prevents multiple inclusion next if "MBEDTLS_CONFIG_H" eq $name; + # Skip over the macro if it is in the ecluded list + next if $name =~ /$excluded_re/; + $config_check .= "#if defined($name)\n"; $config_check .= " if( strcmp( \"$name\", config ) == 0 )\n"; $config_check .= " {\n";