From d4abf3ff455c654b2f74a09832d18d9b706cac30 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Mon, 6 Feb 2023 14:25:47 +0530 Subject: [PATCH] mbedtls: Remove `-Wno-format` compile option for test app --- components/mbedtls/test_apps/main/CMakeLists.txt | 1 - components/mbedtls/test_apps/main/test_ecp.c | 9 +++++---- components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c | 5 +++-- components/mbedtls/test_apps/main/test_sha.c | 9 +++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/components/mbedtls/test_apps/main/CMakeLists.txt b/components/mbedtls/test_apps/main/CMakeLists.txt index 2063cdd28c..1017c93a5b 100644 --- a/components/mbedtls/test_apps/main/CMakeLists.txt +++ b/components/mbedtls/test_apps/main/CMakeLists.txt @@ -10,7 +10,6 @@ idf_component_register(SRC_DIRS "." PRIV_REQUIRES cmock test_utils mbedtls esp_timer unity spi_flash EMBED_TXTFILES ${TEST_CRTS} WHOLE_ARCHIVE) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") idf_component_get_property(mbedtls mbedtls COMPONENT_LIB) target_compile_definitions(${mbedtls} INTERFACE "-DMBEDTLS_DEPRECATED_WARNING") diff --git a/components/mbedtls/test_apps/main/test_ecp.c b/components/mbedtls/test_apps/main/test_ecp.c index 37cd5fbb4c..c2b7710bff 100644 --- a/components/mbedtls/test_apps/main/test_ecp.c +++ b/components/mbedtls/test_apps/main/test_ecp.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -247,9 +248,9 @@ static void test_ecp_mul(mbedtls_ecp_group_id id, const uint8_t *x_coord, const TEST_ASSERT_EQUAL(0, memcmp(y, result_y_coord, mbedtls_mpi_size(&R.MBEDTLS_PRIVATE(Y)))); if (id == MBEDTLS_ECP_DP_SECP192R1) { - TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P192_POINT_MULTIPLY_OP, "%d us", elapsed_time); + TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P192_POINT_MULTIPLY_OP, "%" PRId64 " us", elapsed_time); } else if (id == MBEDTLS_ECP_DP_SECP256R1) { - TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P256_POINT_MULTIPLY_OP, "%d us", elapsed_time); + TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P256_POINT_MULTIPLY_OP, "%" PRId64 " us", elapsed_time); } mbedtls_ecp_point_free(&R); @@ -303,9 +304,9 @@ static void test_ecp_verify(mbedtls_ecp_group_id id, const uint8_t *x_coord, con TEST_ASSERT_EQUAL(0, ret); if (id == MBEDTLS_ECP_DP_SECP192R1) { - TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P192_POINT_VERIFY_OP, "%d us", elapsed_time); + TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P192_POINT_VERIFY_OP, "%" PRId64 " us", elapsed_time); } else if (id == MBEDTLS_ECP_DP_SECP256R1) { - TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P256_POINT_VERIFY_OP, "%d us", elapsed_time); + TEST_PERFORMANCE_CCOMP_LESS_THAN(ECP_P256_POINT_VERIFY_OP, "%" PRId64 " us", elapsed_time); } mbedtls_ecp_point_free(&P); diff --git a/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c b/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c index 4b90355bd3..6c0989f96b 100644 --- a/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c +++ b/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -114,9 +115,9 @@ void test_ecdsa_verify(mbedtls_ecp_group_id id, const uint8_t *hash, const uint8 elapsed_time = ccomp_timer_stop(); if (id == MBEDTLS_ECP_DP_SECP192R1) { - TEST_PERFORMANCE_CCOMP_LESS_THAN(ECDSA_P192_VERIFY_OP, "%d us", elapsed_time); + TEST_PERFORMANCE_CCOMP_LESS_THAN(ECDSA_P192_VERIFY_OP, "%" PRId64 " us", elapsed_time); } else if (id == MBEDTLS_ECP_DP_SECP256R1) { - TEST_PERFORMANCE_CCOMP_LESS_THAN(ECDSA_P256_VERIFY_OP, "%d us", elapsed_time); + TEST_PERFORMANCE_CCOMP_LESS_THAN(ECDSA_P256_VERIFY_OP, "%" PRId64 " us", elapsed_time); } mbedtls_mpi_free(&r); diff --git a/components/mbedtls/test_apps/main/test_sha.c b/components/mbedtls/test_apps/main/test_sha.c index cfc38ae4ae..68aeea941e 100644 --- a/components/mbedtls/test_apps/main/test_sha.c +++ b/components/mbedtls/test_apps/main/test_sha.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "esp_types.h" #include "esp_log.h" #include "ccomp_timer.h" @@ -70,7 +71,7 @@ TEST_CASE("Test esp_sha()", "[hw_crypto]") elapsed = ccomp_timer_stop(); TEST_ASSERT_EQUAL_HEX8_ARRAY(sha1_expected, sha1_result, sizeof(sha1_expected)); us_sha1 = elapsed; - ESP_LOGI(TAG, "esp_sha() 32KB SHA1 in %u us", us_sha1); + ESP_LOGI(TAG, "esp_sha() 32KB SHA1 in %" PRIu32 " us", us_sha1); #if SOC_SHA_SUPPORT_SHA512 ccomp_timer_start(); @@ -79,15 +80,15 @@ TEST_CASE("Test esp_sha()", "[hw_crypto]") TEST_ASSERT_EQUAL_HEX8_ARRAY(sha512_expected, sha512_result, sizeof(sha512_expected)); us_sha512 = elapsed; - ESP_LOGI(TAG, "esp_sha() 32KB SHA512 in %u us", us_sha512); + ESP_LOGI(TAG, "esp_sha() 32KB SHA512 in %" PRIu32 " us", us_sha512); #endif free(buffer); - TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA1_32KB, "%dus", us_sha1); + TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA1_32KB, "%" PRId32 " us", us_sha1); #if SOC_SHA_SUPPORT_SHA512 - TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA512_32KB, "%dus", us_sha512); + TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA512_32KB, "%" PRId32 " us", us_sha512); #endif }