From e38290531190dbc3f9683766eebed2f0dd4aca0c Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Fri, 12 Aug 2022 15:18:41 -0500 Subject: [PATCH] CMakeLists.txt: synchronize CMAKE_C_FLAGS with diagnostic flags set in autotools-generated Makefile (-Wall -Wextra -Wno-unused -Werror), and fix WOLFSSL_RSA_PSS to add -DWOLFSSL_PSS_LONG_SALT as needed by changes to test_wolfSSL_CertRsaPss() in fb531dacc2 (gating of those changes is also added in this commit). --- CMakeLists.txt | 3 +++ cmake/functions.cmake | 2 -- tests/api.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 467f4b797..531bfa0d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,8 @@ find_package(Threads) # Example for map file and custom linker script #set(CMAKE_EXE_LINKER_FLAGS " -Xlinker -Map=output.map -T\"${CMAKE_CURRENT_SOURCE_DIR}/linker.ld\"") +set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Werror ${CMAKE_C_FLAGS}") + #################################################### # Build Options #################################################### @@ -874,6 +876,7 @@ else() endif() if(WOLFSSL_RSA_PSS) list(APPEND WOLFSSL_DEFINITIONS "-DWC_RSA_PSS") + list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_PSS_LONG_SALT") endif() # DH diff --git a/cmake/functions.cmake b/cmake/functions.cmake index 3cbed6325..fb9e40872 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -905,8 +905,6 @@ function(add_to_options_file DEFINITIONS OPTION_FILE) endif() file(APPEND ${OPTION_FILE} "\n") - else() - message("option w/o begin -D is ${DEF}, not saving to ${OPTION_FILE}") endif() endforeach() endfunction() diff --git a/tests/api.c b/tests/api.c index e91cf04f9..d18ba918c 100644 --- a/tests/api.c +++ b/tests/api.c @@ -2416,7 +2416,7 @@ static int test_wolfSSL_CertRsaPss(void) AssertIntEQ(wc_ParseCert(&cert, CERT_TYPE, VERIFY, cm), 0); wc_FreeDecodedCert(&cert); -#ifdef WOLFSSL_SHA384 +#if defined(WOLFSSL_SHA384) && defined(WOLFSSL_PSS_LONG_SALT) f = XFOPEN(rsaPssSha384Cert, "rb"); AssertTrue((f != XBADFILE)); bytes = (int)XFREAD(buf, 1, sizeof(buf), f);