Move the declaration of query_config() to a dedicated header file
Declaring query_config() belongs with the query_config program, not in ssl_test_lib.h, so move the declaration to a new header file query_config.h. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
b4df754274
commit
c772b1822a
6 changed files with 56 additions and 19 deletions
|
@ -268,7 +268,11 @@ ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
SSL_TEST_OBJECTS = test/query_config.o ssl/ssl_test_lib.o
|
SSL_TEST_OBJECTS = test/query_config.o ssl/ssl_test_lib.o
|
||||||
SSL_TEST_DEPS = $(SSL_TEST_OBJECTS) ssl/ssl_test_lib.h ssl/ssl_test_common_source.c $(DEP)
|
SSL_TEST_DEPS = $(SSL_TEST_OBJECTS) \
|
||||||
|
test/query_config.h \
|
||||||
|
ssl/ssl_test_lib.h \
|
||||||
|
ssl/ssl_test_common_source.c \
|
||||||
|
$(DEP)
|
||||||
|
|
||||||
ssl/ssl_test_lib.o: ssl/ssl_test_lib.c ssl/ssl_test_lib.h $(DEP)
|
ssl/ssl_test_lib.o: ssl/ssl_test_lib.c ssl/ssl_test_lib.h $(DEP)
|
||||||
echo " CC ssl/ssl_test_lib.c"
|
echo " CC ssl/ssl_test_lib.c"
|
||||||
|
@ -286,7 +290,7 @@ ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c $(SSL_TEST_DEPS)
|
||||||
echo " CC ssl/ssl_server2.c"
|
echo " CC ssl/ssl_server2.c"
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
ssl/ssl_context_info$(EXEXT): ssl/ssl_context_info.c test/query_config.o $(DEP)
|
ssl/ssl_context_info$(EXEXT): ssl/ssl_context_info.c test/query_config.o test/query_config.h $(DEP)
|
||||||
echo " CC ssl/ssl_context_info.c"
|
echo " CC ssl/ssl_context_info.c"
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_context_info.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_context_info.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
@ -314,7 +318,7 @@ test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
|
||||||
echo " CXX test/cpp_dummy_build.cpp"
|
echo " CXX test/cpp_dummy_build.cpp"
|
||||||
$(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
test/query_config.o: test/query_config.c $(DEP)
|
test/query_config.o: test/query_config.c test/query_config.h $(DEP)
|
||||||
echo " CC test/query_config.c"
|
echo " CC test/query_config.c"
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c test/query_config.c -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c test/query_config.c -o $@
|
||||||
|
|
||||||
|
@ -330,7 +334,7 @@ test/zeroize$(EXEXT): test/zeroize.c $(DEP)
|
||||||
echo " CC test/zeroize.c"
|
echo " CC test/zeroize.c"
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/zeroize.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/zeroize.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
test/query_compile_time_config$(EXEXT): test/query_compile_time_config.c test/query_config.o $(DEP)
|
test/query_compile_time_config$(EXEXT): test/query_compile_time_config.c test/query_config.o test/query_config.h $(DEP)
|
||||||
echo " CC test/query_compile_time_config.c"
|
echo " CC test/query_compile_time_config.c"
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/query_compile_time_config.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/query_compile_time_config.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
|
|
@ -83,20 +83,7 @@
|
||||||
|
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
|
|
||||||
/** Check whether a given configuration symbol is enabled.
|
#include "../test/query_config.h"
|
||||||
*
|
|
||||||
* \param config The symbol to query (e.g. "MBEDTLS_RSA_C").
|
|
||||||
* \return \c 0 if the symbol was defined at compile time
|
|
||||||
* (in MBEDTLS_CONFIG_FILE or config.h),
|
|
||||||
* \c 1 otherwise.
|
|
||||||
*
|
|
||||||
* \note This function is defined in `programs/test/query_config.c`
|
|
||||||
* which is automatically generated by
|
|
||||||
* `scripts/generate_query_config.pl`.
|
|
||||||
*/
|
|
||||||
int query_config( const char *config );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_EXPORT_KEYS)
|
#if defined(MBEDTLS_SSL_EXPORT_KEYS)
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
"Mbed TLS build and the macro expansion of that configuration will be\n" \
|
"Mbed TLS build and the macro expansion of that configuration will be\n" \
|
||||||
"printed (if any). Otherwise, 1 will be returned.\n"
|
"printed (if any). Otherwise, 1 will be returned.\n"
|
||||||
|
|
||||||
int query_config( const char *config );
|
#include "query_config.h"
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include MBEDTLS_CONFIG_FILE
|
#include MBEDTLS_CONFIG_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "query_config.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_PLATFORM_C)
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
|
|
42
programs/test/query_config.h
Normal file
42
programs/test/query_config.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Query Mbed TLS compile time configurations from config.h
|
||||||
|
*
|
||||||
|
* Copyright The Mbed TLS Contributors
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H
|
||||||
|
#define MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||||
|
#include "mbedtls/config.h"
|
||||||
|
#else
|
||||||
|
#include MBEDTLS_CONFIG_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Check whether a given configuration symbol is enabled.
|
||||||
|
*
|
||||||
|
* \param config The symbol to query (e.g. "MBEDTLS_RSA_C").
|
||||||
|
* \return \c 0 if the symbol was defined at compile time
|
||||||
|
* (in MBEDTLS_CONFIG_FILE or config.h),
|
||||||
|
* \c 1 otherwise.
|
||||||
|
*
|
||||||
|
* \note This function is defined in `programs/test/query_config.c`
|
||||||
|
* which is automatically generated by
|
||||||
|
* `scripts/generate_query_config.pl`.
|
||||||
|
*/
|
||||||
|
int query_config( const char *config );
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H */
|
|
@ -23,6 +23,8 @@
|
||||||
#include MBEDTLS_CONFIG_FILE
|
#include MBEDTLS_CONFIG_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "query_config.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_PLATFORM_C)
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue