From d5438a56788827612a53a8d9401e0012af4e1b4f Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Sat, 26 Feb 2022 19:54:41 +0100 Subject: [PATCH 1/2] Enable -Wunused-function in cmake builds for tests This has been the case when building with make since d3d8a64dfa7c1b006c854b45f47e10261cf0019a. Be consistent. Signed-off-by: Gilles Peskine --- tests/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 45854f154d..2431e40697 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -140,10 +140,6 @@ endfunction(add_test_suite) # on non-POSIX platforms. add_definitions("-D_POSIX_C_SOURCE=200809L") -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") -endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) - if(CMAKE_COMPILER_IS_CLANG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code") endif(CMAKE_COMPILER_IS_CLANG) From 9c656ec718bd53538cc88b6a896afa53b6bb1359 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Sat, 26 Feb 2022 19:55:58 +0100 Subject: [PATCH 2/2] Fix unused function warning Signed-off-by: Gilles Peskine --- tests/suites/test_suite_ssl.function | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index 4f5ee9762d..3831d4adf7 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -1205,7 +1205,8 @@ int psk_dummy_callback( void *p_info, mbedtls_ssl_context *ssl, #define SSL_CID_LEN_MIN MBEDTLS_SSL_CID_OUT_LEN_MAX #endif -#if defined(MBEDTLS_SSL_PROTO_TLS1_2) +#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ + defined(MBEDTLS_CIPHER_MODE_CBC) && defined(MBEDTLS_AES_C) static int psa_cipher_encrypt_helper( mbedtls_ssl_transform *transform, const unsigned char *iv, size_t iv_len, const unsigned char *input, size_t ilen, @@ -1246,7 +1247,7 @@ static int psa_cipher_encrypt_helper( mbedtls_ssl_transform *transform, iv, iv_len, input, ilen, output, olen ); #endif /* MBEDTLS_USE_PSA_CRYPTO */ } -#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ +#endif /* MBEDTLS_SSL_PROTO_TLS1_2 && MBEDTLS_CIPHER_MODE_CBC && MBEDTLS_AES_C */ static int build_transforms( mbedtls_ssl_transform *t_in, mbedtls_ssl_transform *t_out,