From fc43533859766e3979152c468bb752e58e1030cd Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 3 Jun 2022 18:01:31 +0530 Subject: [PATCH] mbedtls: enable all tests except SHA for ESP32-C2 --- components/mbedtls/test/test_aes.c | 9 --------- components/mbedtls/test/test_aes_perf.c | 3 --- components/mbedtls/test/test_ecp.c | 6 ------ components/mbedtls/test/test_esp_crt_bundle.c | 6 ------ components/mbedtls/test/test_mbedtls.c | 3 --- components/mbedtls/test/test_mbedtls_mpi.c | 3 --- components/mbedtls/test/test_rsa.c | 9 --------- 7 files changed, 39 deletions(-) diff --git a/components/mbedtls/test/test_aes.c b/components/mbedtls/test/test_aes.c index 2d987b0cfd..b0d76b4da9 100644 --- a/components/mbedtls/test/test_aes.c +++ b/components/mbedtls/test/test_aes.c @@ -17,8 +17,6 @@ #include "freertos/semphr.h" -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 static const uint8_t key_256[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, @@ -301,7 +299,6 @@ TEST_CASE("mbedtls CFB-128 AES-256 test", "[aes]") free(chipertext); free(decryptedtext); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) static void aes_ctr_stream_test(void) { @@ -403,8 +400,6 @@ static void aes_ctr_stream_test(void) free(decryptedtext); } -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 TEST_CASE("mbedtls CTR stream test", "[aes]") { aes_ctr_stream_test(); @@ -784,7 +779,6 @@ TEST_CASE("mbedtls OFB, chained DMA descriptors", "[aes]") free(chipertext); free(decryptedtext); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) @@ -846,14 +840,11 @@ void aes_ctr_alignment_test(uint32_t input_buf_caps, uint32_t output_buf_caps) free(decryptedtext); } -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 TEST_CASE("mbedtls AES internal mem alignment tests", "[aes]") { uint32_t internal_dma_caps = MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL; aes_ctr_alignment_test(internal_dma_caps, internal_dma_caps); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #ifdef CONFIG_SPIRAM_USE_MALLOC diff --git a/components/mbedtls/test/test_aes_perf.c b/components/mbedtls/test/test_aes_perf.c index ea0635b974..00a6247bf4 100644 --- a/components/mbedtls/test/test_aes_perf.c +++ b/components/mbedtls/test/test_aes_perf.c @@ -12,8 +12,6 @@ #include "test_utils.h" #include "ccomp_timer.h" -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 TEST_CASE("mbedtls AES performance", "[aes][timeout=60]") { const unsigned CALLS = 256; @@ -70,4 +68,3 @@ TEST_CASE("mbedtls AES performance", "[aes][timeout=60]") TEST_PERFORMANCE_CCOMP_GREATER_THAN(AES_CBC_THROUGHPUT_MBSEC, "%.3fMB/sec", mb_sec); #endif } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) diff --git a/components/mbedtls/test/test_ecp.c b/components/mbedtls/test/test_ecp.c index f89d8e7c9d..44a58e92cd 100644 --- a/components/mbedtls/test/test_ecp.c +++ b/components/mbedtls/test/test_ecp.c @@ -31,8 +31,6 @@ which are undefined if the following flag is not defined */ error hex value (mbedTLS uses -N for error codes) */ #define TEST_ASSERT_MBEDTLS_OK(X) TEST_ASSERT_EQUAL_HEX32(0, -(X)) -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 TEST_CASE("mbedtls ECDH Generate Key", "[mbedtls]") { mbedtls_ecdh_context ctx; @@ -86,7 +84,6 @@ TEST_CASE("mbedtls ECP mul w/ koblitz", "[mbedtls]") mbedtls_ctr_drbg_free(&ctxRandom); mbedtls_entropy_free(&ctxEntropy); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #if CONFIG_MBEDTLS_HARDWARE_ECC /* @@ -157,8 +154,6 @@ const uint8_t ecc_p256_mul_res_y[] = { 0xC7, 0xD4, 0x0C, 0x90, 0xA1, 0xC9, 0xD3, 0x3A }; -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 static int rng_wrapper(void *ctx, unsigned char *buf, size_t len) { esp_fill_random(buf, len); @@ -258,5 +253,4 @@ TEST_CASE("mbedtls ECP point verify with SECP256R1", "[mbedtls]") { test_ecp_verify(MBEDTLS_ECP_DP_SECP256R1, ecc_p256_mul_res_x, ecc_p256_mul_res_y); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #endif /* CONFIG_MBEDTLS_HARDWARE_ECC */ diff --git a/components/mbedtls/test/test_esp_crt_bundle.c b/components/mbedtls/test/test_esp_crt_bundle.c index fa5d58fafe..b8ea822435 100644 --- a/components/mbedtls/test/test_esp_crt_bundle.c +++ b/components/mbedtls/test/test_esp_crt_bundle.c @@ -210,8 +210,6 @@ esp_err_t endpoint_teardown(mbedtls_endpoint_t *endpoint) return ESP_OK; } -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 esp_err_t client_setup(mbedtls_endpoint_t *client) { int ret; @@ -346,12 +344,9 @@ TEST_CASE("custom certificate bundle", "[mbedtls]") vSemaphoreDelete(signal_sem); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3) -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 TEST_CASE("custom certificate bundle - weak hash", "[mbedtls]") { /* A weak signature hash on the trusted certificate should not stop @@ -397,7 +392,6 @@ TEST_CASE("custom certificate bundle - wrong signature", "[mbedtls]") esp_crt_bundle_detach(NULL); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) TEST_CASE("custom certificate bundle init API - bound checking", "[mbedtls]") { diff --git a/components/mbedtls/test/test_mbedtls.c b/components/mbedtls/test/test_mbedtls.c index eca5b5d083..70eeac5b6b 100644 --- a/components/mbedtls/test/test_mbedtls.c +++ b/components/mbedtls/test/test_mbedtls.c @@ -23,8 +23,6 @@ #include "test_apb_dport_access.h" #include "test_utils.h" -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 TEST_CASE("mbedtls AES self-tests", "[aes]") { start_apb_access_loop(); @@ -45,4 +43,3 @@ TEST_CASE("mbedtls RSA self-tests", "[bignum]") TEST_ASSERT_FALSE_MESSAGE(mbedtls_rsa_self_test(1), "RSA self-tests should pass."); verify_apb_access_loop(); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) diff --git a/components/mbedtls/test/test_mbedtls_mpi.c b/components/mbedtls/test/test_mbedtls_mpi.c index 5d7d7866e7..6e46d1f5c4 100644 --- a/components/mbedtls/test/test_mbedtls_mpi.c +++ b/components/mbedtls/test/test_mbedtls_mpi.c @@ -19,8 +19,6 @@ #define MBEDTLS_OK 0 -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 /* Debugging function to print an MPI number to stdout. Happens to print output that can be copy-pasted directly into a Python shell. */ @@ -277,4 +275,3 @@ TEST_CASE("test MPI modexp", "[bignum]") TEST_ASSERT_FALSE_MESSAGE(test_error, "mbedtls_mpi_exp_mod incorrect for some tests\n"); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) diff --git a/components/mbedtls/test/test_rsa.c b/components/mbedtls/test/test_rsa.c index 0d6292ac92..c69c60b07f 100644 --- a/components/mbedtls/test/test_rsa.c +++ b/components/mbedtls/test/test_rsa.c @@ -24,8 +24,6 @@ #define PRINT_DEBUG_INFO -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 /* Taken from openssl s_client -connect api.gigafive.com:443 -showcerts */ static const char *rsa4096_cert = "-----BEGIN CERTIFICATE-----\n"\ @@ -114,7 +112,6 @@ static const char *rsa2048_cert = "-----BEGIN CERTIFICATE-----\n"\ /* Some random input bytes to public key encrypt */ static const uint8_t pki_input[4096/8] = { 0, 1, 4, 6, 7, 9, 33, 103, 49, 11, 56, 211, 67, 92 }; -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) /* Result of an RSA4096 operation using cert's public key (raw PKI, no padding/etc) */ @@ -330,8 +327,6 @@ _Static_assert(sizeof(pki_rsa4096_output) == 4096/8, "rsa4096 output is wrong si void mbedtls_mpi_printf(const char *name, const mbedtls_mpi *X); -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 static void test_cert(const char *cert, const uint8_t *expected_output, size_t output_len); TEST_CASE("mbedtls RSA4096 cert", "[mbedtls]") @@ -401,7 +396,6 @@ static void test_cert(const char *cert, const uint8_t *expected_output, size_t o mbedtls_x509_crt_free(&crt); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #ifdef CONFIG_MBEDTLS_HARDWARE_MPI static void rsa_key_operations(int keysize, bool check_performance, bool generate_new_rsa); @@ -541,8 +535,6 @@ static void rsa_key_operations(int keysize, bool check_performance, bool generat #endif // CONFIG_MBEDTLS_HARDWARE_MPI -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) -//IDF-5141 TEST_CASE("mbedtls RSA Generate Key", "[mbedtls][timeout=60]") { @@ -580,4 +572,3 @@ TEST_CASE("mbedtls RSA Generate Key", "[mbedtls][timeout=60]") #endif //CONFIG_MBEDTLS_MPI_USE_INTERRUPT } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)