From ea2aafbb7a8f0be57fcca24d6a895fe002829809 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Wed, 3 Mar 2021 17:59:11 +0800 Subject: [PATCH 01/17] esp32s2: move memprot api --- components/esp32c3/CMakeLists.txt | 3 +-- components/esp32s2/CMakeLists.txt | 3 +-- components/esp32s3/CMakeLists.txt | 1 - .../include => esp_hw_support/include/soc}/esp32c3/memprot.h | 2 ++ .../include => esp_hw_support/include/soc}/esp32s2/memprot.h | 0 .../include => esp_hw_support/include/soc}/esp32s3/memprot.h | 0 components/esp_hw_support/port/esp32c3/CMakeLists.txt | 2 +- components/{ => esp_hw_support/port}/esp32c3/memprot.c | 0 components/esp_hw_support/port/esp32s2/CMakeLists.txt | 2 +- components/{ => esp_hw_support/port}/esp32s2/memprot.c | 0 components/esp_hw_support/port/esp32s3/CMakeLists.txt | 2 +- components/{ => esp_hw_support/port}/esp32s3/memprot.c | 0 12 files changed, 7 insertions(+), 8 deletions(-) rename components/{esp32c3/include => esp_hw_support/include/soc}/esp32c3/memprot.h (99%) rename components/{esp32s2/include => esp_hw_support/include/soc}/esp32s2/memprot.h (100%) rename components/{esp32s3/include => esp_hw_support/include/soc}/esp32s3/memprot.h (100%) rename components/{ => esp_hw_support/port}/esp32c3/memprot.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/memprot.c (100%) rename components/{ => esp_hw_support/port}/esp32s3/memprot.c (100%) diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index a785c520dc..1d00a870ee 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -14,8 +14,7 @@ else() set(srcs "dport_access.c" "esp_hmac.c" "esp_ds.c" - "esp_crypto_lock.c" - "memprot.c") + "esp_crypto_lock.c") set(include_dirs "include") set(requires driver efuse soc riscv) #unfortunately rom/uart uses SOC registers directly diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index 737d0ed696..209579c67b 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -11,8 +11,7 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(srcs "memprot.c" - "dport_access.c" + set(srcs "dport_access.c" "spiram.c" "spiram_psram.c" "esp_crypto_lock.c" diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index bf3205df54..f4a19a15da 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -14,7 +14,6 @@ else() set(srcs "dport_access.c" "esp_crypto_lock.c" - "memprot.c" "spiram.c" "spi_timing_config.c") set(include_dirs "include") diff --git a/components/esp32c3/include/esp32c3/memprot.h b/components/esp_hw_support/include/soc/esp32c3/memprot.h similarity index 99% rename from components/esp32c3/include/esp32c3/memprot.h rename to components/esp_hw_support/include/soc/esp32c3/memprot.h index 094f28f42e..0d7e6ca40d 100644 --- a/components/esp32c3/include/esp32c3/memprot.h +++ b/components/esp_hw_support/include/soc/esp32c3/memprot.h @@ -20,6 +20,8 @@ #pragma once #include +#include + #include "esp_attr.h" #ifdef __cplusplus diff --git a/components/esp32s2/include/esp32s2/memprot.h b/components/esp_hw_support/include/soc/esp32s2/memprot.h similarity index 100% rename from components/esp32s2/include/esp32s2/memprot.h rename to components/esp_hw_support/include/soc/esp32s2/memprot.h diff --git a/components/esp32s3/include/esp32s3/memprot.h b/components/esp_hw_support/include/soc/esp32s3/memprot.h similarity index 100% rename from components/esp32s3/include/esp32s3/memprot.h rename to components/esp_hw_support/include/soc/esp32s3/memprot.h diff --git a/components/esp_hw_support/port/esp32c3/CMakeLists.txt b/components/esp_hw_support/port/esp32c3/CMakeLists.txt index 3738e9b305..0bde69c4b8 100644 --- a/components/esp_hw_support/port/esp32c3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32c3/CMakeLists.txt @@ -9,7 +9,7 @@ set(srcs "cpu_util_esp32c3.c" ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c") + list(APPEND srcs "../async_memcpy_impl_gdma.c" "memprot.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32c3/memprot.c b/components/esp_hw_support/port/esp32c3/memprot.c similarity index 100% rename from components/esp32c3/memprot.c rename to components/esp_hw_support/port/esp32c3/memprot.c diff --git a/components/esp_hw_support/port/esp32s2/CMakeLists.txt b/components/esp_hw_support/port/esp32s2/CMakeLists.txt index bd63e46898..2f46610a4b 100644 --- a/components/esp_hw_support/port/esp32s2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s2/CMakeLists.txt @@ -14,7 +14,7 @@ set(srcs ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "async_memcpy_impl_cp_dma.c") + list(APPEND srcs "async_memcpy_impl_cp_dma.c" "memprot.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s2/memprot.c b/components/esp_hw_support/port/esp32s2/memprot.c similarity index 100% rename from components/esp32s2/memprot.c rename to components/esp_hw_support/port/esp32s2/memprot.c diff --git a/components/esp_hw_support/port/esp32s3/CMakeLists.txt b/components/esp_hw_support/port/esp32s3/CMakeLists.txt index 740c693562..b698f0b02e 100644 --- a/components/esp_hw_support/port/esp32s3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s3/CMakeLists.txt @@ -13,7 +13,7 @@ set(srcs ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c") + list(APPEND srcs "../async_memcpy_impl_gdma.c" "memprot.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s3/memprot.c b/components/esp_hw_support/port/esp32s3/memprot.c similarity index 100% rename from components/esp32s3/memprot.c rename to components/esp_hw_support/port/esp32s3/memprot.c From 702e41e1c83b6bf80b28df6aceda523f1eadba94 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Wed, 3 Mar 2021 18:21:07 +0800 Subject: [PATCH 02/17] esp32s2: move crypto related functions --- components/esp32c3/CMakeLists.txt | 5 +- components/esp32c3/test/test_sha.c | 80 ---- components/esp32s2/CMakeLists.txt | 5 +- components/esp32s2/test/test_ds.c | 379 ------------------ components/esp32s2/test/test_sha.c | 103 ----- components/esp32s3/CMakeLists.txt | 1 - components/esp_common/src/esp_err_to_name.c | 8 +- components/esp_hw_support/CMakeLists.txt | 2 +- .../include/soc/esp32c3}/esp_crypto_lock.h | 0 .../include/soc/esp32c3}/esp_ds.h | 0 .../include/soc/esp32c3}/esp_hmac.h | 0 .../include/soc/esp32s2}/esp_crypto_lock.h | 0 .../include/soc/esp32s2}/esp_ds.h | 0 .../include/soc/esp32s2}/esp_hmac.h | 0 .../include/soc/esp32s3}/esp_crypto_lock.h | 0 .../port/esp32c3/CMakeLists.txt | 6 +- .../port}/esp32c3/esp_crypto_lock.c | 0 .../port}/esp32c3/esp_ds.c | 0 .../port}/esp32c3/esp_hmac.c | 0 .../port/esp32s2/CMakeLists.txt | 6 +- .../port}/esp32s2/esp_crypto_lock.c | 0 .../port}/esp32s2/esp_ds.c | 0 .../port}/esp32s2/esp_hmac.c | 0 .../port/esp32s3/CMakeLists.txt | 4 +- .../port}/esp32s3/esp_crypto_lock.c | 0 .../test/digital_signature_test_cases_3072.h} | 0 .../test/digital_signature_test_cases_4096.h} | 0 .../test/gen_digital_signature_tests.py | 0 .../test/test_ds.c | 101 ++++- .../test/test_hmac.c | 6 +- components/hal/include/hal/sha_types.h | 11 +- .../test/test_aes_sha_rsa.c.bak} | 0 components/{esp32 => mbedtls}/test/test_sha.c | 39 +- docs/doxygen/Doxyfile_esp32c3 | 4 +- docs/doxygen/Doxyfile_esp32s2 | 4 +- tools/ci/mypy_ignore_list.txt | 3 +- 36 files changed, 154 insertions(+), 613 deletions(-) delete mode 100644 components/esp32c3/test/test_sha.c delete mode 100644 components/esp32s2/test/test_ds.c delete mode 100644 components/esp32s2/test/test_sha.c rename components/{esp32c3/include => esp_hw_support/include/soc/esp32c3}/esp_crypto_lock.h (100%) rename components/{esp32c3/include => esp_hw_support/include/soc/esp32c3}/esp_ds.h (100%) rename components/{esp32c3/include => esp_hw_support/include/soc/esp32c3}/esp_hmac.h (100%) rename components/{esp32s2/include => esp_hw_support/include/soc/esp32s2}/esp_crypto_lock.h (100%) rename components/{esp32s2/include => esp_hw_support/include/soc/esp32s2}/esp_ds.h (100%) rename components/{esp32s2/include => esp_hw_support/include/soc/esp32s2}/esp_hmac.h (100%) rename components/{esp32s3/include => esp_hw_support/include/soc/esp32s3}/esp_crypto_lock.h (100%) rename components/{ => esp_hw_support/port}/esp32c3/esp_crypto_lock.c (100%) rename components/{ => esp_hw_support/port}/esp32c3/esp_ds.c (100%) rename components/{ => esp_hw_support/port}/esp32c3/esp_hmac.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/esp_crypto_lock.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/esp_ds.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/esp_hmac.c (100%) rename components/{ => esp_hw_support/port}/esp32s3/esp_crypto_lock.c (100%) rename components/{esp32c3/test/digital_signature_test_cases.h => esp_hw_support/test/digital_signature_test_cases_3072.h} (100%) rename components/{esp32s2/test/digital_signature_test_cases.h => esp_hw_support/test/digital_signature_test_cases_4096.h} (100%) rename components/{esp32s2 => esp_hw_support}/test/gen_digital_signature_tests.py (100%) rename components/{esp32c3 => esp_hw_support}/test/test_ds.c (81%) rename components/{esp32s2 => esp_hw_support}/test/test_hmac.c (99%) rename components/{esp32/test/test_aes_sha_rsa.c => mbedtls/test/test_aes_sha_rsa.c.bak} (100%) rename components/{esp32 => mbedtls}/test/test_sha.c (89%) diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index 1d00a870ee..eda76c3379 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -11,10 +11,7 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(srcs "dport_access.c" - "esp_hmac.c" - "esp_ds.c" - "esp_crypto_lock.c") + set(srcs "dport_access.c") set(include_dirs "include") set(requires driver efuse soc riscv) #unfortunately rom/uart uses SOC registers directly diff --git a/components/esp32c3/test/test_sha.c b/components/esp32c3/test/test_sha.c deleted file mode 100644 index 052433d6ac..0000000000 --- a/components/esp32c3/test/test_sha.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include -#include -#include "esp_types.h" -#include "esp32c3/clk.h" -#include "esp_log.h" -#include "esp_timer.h" -#include "esp_heap_caps.h" -#include "idf_performance.h" - -#include "unity.h" -#include "test_utils.h" -#include "mbedtls/sha1.h" -#include "mbedtls/sha256.h" -#include "sha/sha_dma.h" - -/* Note: Most of the SHA functions are called as part of mbedTLS, so -are tested as part of mbedTLS tests. Only esp_sha() is different. -*/ - -#define TAG "sha_test" - -TEST_CASE("Test esp_sha()", "[hw_crypto]") -{ - const size_t BUFFER_SZ = 32 * 1024 + 6; // NB: not an exact multiple of SHA block size - - int64_t begin, end; - uint32_t us_sha1; - uint8_t sha1_result[20] = { 0 }; - void *buffer = heap_caps_malloc(BUFFER_SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - TEST_ASSERT_NOT_NULL(buffer); - memset(buffer, 0xEE, BUFFER_SZ); - - const uint8_t sha1_expected[20] = { 0xc7, 0xbb, 0xd3, 0x74, 0xf2, 0xf6, 0x20, 0x86, - 0x61, 0xf4, 0x50, 0xd5, 0xf5, 0x18, 0x44, 0xcc, - 0x7a, 0xb7, 0xa5, 0x4a }; - - begin = esp_timer_get_time(); - esp_sha(SHA1, buffer, BUFFER_SZ, sha1_result); - end = esp_timer_get_time(); - TEST_ASSERT_EQUAL_HEX8_ARRAY(sha1_expected, sha1_result, sizeof(sha1_expected)); - us_sha1 = end - begin; - ESP_LOGI(TAG, "esp_sha() 32KB SHA1 in %u us", us_sha1); - - free(buffer); - - TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA1_32KB, "%dus", us_sha1); -} - -TEST_CASE("Test esp_sha() function with long input", "[hw_crypto]") -{ - const void* ptr; - spi_flash_mmap_handle_t handle; - uint8_t sha1_espsha[20] = { 0 }; - uint8_t sha1_mbedtls[20] = { 0 }; - uint8_t sha256_espsha[32] = { 0 }; - uint8_t sha256_mbedtls[32] = { 0 }; - - const size_t LEN = 1024 * 1024; - - /* mmap() 1MB of flash, we don't care what it is really */ - esp_err_t err = spi_flash_mmap(0x0, LEN, SPI_FLASH_MMAP_DATA, &ptr, &handle); - - TEST_ASSERT_EQUAL_HEX32(ESP_OK, err); - TEST_ASSERT_NOT_NULL(ptr); - - /* Compare esp_sha() result to the mbedTLS result, should always be the same */ - - esp_sha(SHA1, ptr, LEN, sha1_espsha); - int r = mbedtls_sha1_ret(ptr, LEN, sha1_mbedtls); - TEST_ASSERT_EQUAL(0, r); - - esp_sha(SHA2_256, ptr, LEN, sha256_espsha); - r = mbedtls_sha256_ret(ptr, LEN, sha256_mbedtls, 0); - TEST_ASSERT_EQUAL(0, r); - - TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha1_espsha, sha1_mbedtls, sizeof(sha1_espsha), "SHA1 results should match"); - - TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha256_espsha, sha256_mbedtls, sizeof(sha256_espsha), "SHA256 results should match"); -} diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index 209579c67b..c229ea1ddc 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -13,10 +13,7 @@ else() set(srcs "dport_access.c" "spiram.c" - "spiram_psram.c" - "esp_crypto_lock.c" - "esp_hmac.c" - "esp_ds.c") + "spiram_psram.c") set(include_dirs "include") diff --git a/components/esp32s2/test/test_ds.c b/components/esp32s2/test/test_ds.c deleted file mode 100644 index 719f24adb6..0000000000 --- a/components/esp32s2/test/test_ds.c +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// 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. - -#include "unity.h" -#include "esp32s2/rom/efuse.h" -#include "esp32s2/rom/digital_signature.h" -#include "esp32s2/rom/aes.h" -#include "esp32s2/rom/sha.h" -#include - -#include "esp_ds.h" - -#define NUM_RESULTS 10 - -typedef struct { - uint8_t iv[ETS_DS_IV_LEN]; - ets_ds_p_data_t p_data; - uint8_t expected_c[ETS_DS_C_LEN]; - uint8_t hmac_key_idx; - uint32_t expected_results[NUM_RESULTS][4096/32]; -} encrypt_testcase_t; - -// Generated header (gen_digital_signature_tests.py) defines -// NUM_HMAC_KEYS, test_hmac_keys, NUM_MESSAGES, NUM_CASES, test_messages[], test_cases[] -// Some adaptations were made: removed the 512 bit case and changed RSA lengths to the enums from esp_ds.h -#include "digital_signature_test_cases.h" - -_Static_assert(NUM_RESULTS == NUM_MESSAGES, "expected_results size should be the same as NUM_MESSAGES in generated header"); - -TEST_CASE("Digital Signature Parameter Encryption data NULL", "[hw_crypto]") -{ - const char iv [32]; - esp_ds_p_data_t p_data; - const char key [32]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(NULL, iv, &p_data, key)); -} - -TEST_CASE("Digital Signature Parameter Encryption iv NULL", "[hw_crypto]") -{ - esp_ds_data_t data; - esp_ds_p_data_t p_data; - const char key [32]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, NULL, &p_data, key)); -} - -TEST_CASE("Digital Signature Parameter Encryption p_data NULL", "[hw_crypto]") -{ - esp_ds_data_t data; - const char iv [32]; - const char key [32]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, NULL, key)); -} - -TEST_CASE("Digital Signature Parameter Encryption key NULL", "[hw_crypto]") -{ - esp_ds_data_t data; - const char iv [32]; - esp_ds_p_data_t p_data; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, &p_data, NULL)); -} - -TEST_CASE("Digital Signature Parameter Encryption", "[hw_crypto]") -{ - for (int i = 0; i < NUM_CASES; i++) { - printf("Encrypting test case %d...\n", i); - const encrypt_testcase_t *t = &test_cases[i]; - esp_ds_data_t result = { }; - esp_ds_p_data_t p_data; - - memcpy(p_data.Y, t->p_data.Y, 4096/8); - memcpy(p_data.M, t->p_data.M, 4096/8); - memcpy(p_data.Rb, t->p_data.Rb, 4096/8); - p_data.M_prime = t->p_data.M_prime; - p_data.length = t->p_data.length; - - esp_err_t r = esp_ds_encrypt_params(&result, t->iv, &p_data, - test_hmac_keys[t->hmac_key_idx]); - printf("Encrypting test case %d done\n", i); - TEST_ASSERT_EQUAL(ESP_OK, r); - TEST_ASSERT_EQUAL(t->p_data.length, result.rsa_length); - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->iv, result.iv, ETS_DS_IV_LEN); - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_c, result.c, ETS_DS_C_LEN); - } -} - -TEST_CASE("Digital Signature start Invalid message", "[hw_crypto]") -{ - esp_ds_data_t ds_data = { }; - ds_data.rsa_length = ESP_DS_RSA_4096; - esp_ds_context_t *ctx; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(NULL, &ds_data, HMAC_KEY1, &ctx)); -} - -TEST_CASE("Digital Signature start Invalid data", "[hw_crypto]") -{ - const char *message = "test"; - esp_ds_context_t *ctx; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, NULL, HMAC_KEY1, &ctx)); -} - -TEST_CASE("Digital Signature start Invalid context", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_4096; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature RSA length 0", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 0; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature RSA length too long", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 128; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature start HMAC key out of range", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_4096; - esp_ds_context_t *ctx; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY5 + 1, &ctx)); - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY0 - 1, &ctx)); -} - -TEST_CASE("Digital Signature finish Invalid signature ptr", "[hw_crypto]") -{ - esp_ds_context_t *ctx = NULL; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_finish_sign(NULL, ctx)); -} - -TEST_CASE("Digital Signature finish Invalid context", "[hw_crypto]") -{ - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_finish_sign(signature_data, NULL)); -} - -TEST_CASE("Digital Signature Blocking Invalid message", "[hw_crypto]") -{ - esp_ds_data_t ds_data = { }; - ds_data.rsa_length = ESP_DS_RSA_4096; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(NULL, &ds_data, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking Invalid data", "[hw_crypto]") -{ - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, NULL, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking Invalid signature ptr", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_4096; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature Blocking RSA length 0", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 0; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking RSA length too long", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 128; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking HMAC key out of range", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 127; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY5 + 1, signature_data)); - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY0 - 1, signature_data)); -} - -#if CONFIG_IDF_ENV_FPGA - -static void burn_hmac_keys(void) -{ - printf("Burning %d HMAC keys to efuse...\n", NUM_HMAC_KEYS); - for (int i = 0; i < NUM_HMAC_KEYS; i++) { - // TODO: vary the purpose across the keys - ets_efuse_purpose_t purpose = ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE; - - // starting from block 1, block 0 occupied with HMAC upstream test key - int ets_status = ets_efuse_write_key(ETS_EFUSE_BLOCK_KEY1 + i, - purpose, - test_hmac_keys[i], 32); - - if (ets_status == ESP_OK) { - printf("written DS test key to block [%d]!\n", ETS_EFUSE_BLOCK_KEY1 + i); - } else { - printf("writing DS test key to block [%d] failed, maybe written already\n", ETS_EFUSE_BLOCK_KEY1 + i); - } - } -} - -TEST_CASE("Digital Signature wrong HMAC key purpose (FPGA only)", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_4096; - esp_ds_context_t *ctx; - const char *message = "test"; - - // HMAC fails in that case because it checks for the correct purpose - TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_start_sign(message, &ds_data, HMAC_KEY0, &ctx)); -} - -TEST_CASE("Digital Signature Blocking wrong HMAC key purpose (FPGA only)", "[hw_crypto]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_4096; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - // HMAC fails in that case because it checks for the correct purpose - TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_sign(message, &ds_data, HMAC_KEY0, signature_data)); -} - -TEST_CASE("Digital Signature Operation (FPGA only)", "[hw_crypto]") -{ - burn_hmac_keys(); - - for (int i = 0; i < NUM_CASES; i++) { - printf("Running test case %d...\n", i); - const encrypt_testcase_t *t = &test_cases[i]; - - // copy encrypt parameter test case into ds_data structure - esp_ds_data_t ds_data = { }; - memcpy(ds_data.iv, t->iv, ETS_DS_IV_LEN); - memcpy(ds_data.c, t->expected_c, ETS_DS_C_LEN); - ds_data.rsa_length = t->p_data.length; - - for (int j = 0; j < NUM_MESSAGES; j++) { - uint8_t signature[4096/8] = { 0 }; - printf(" ... message %d\n", j); - esp_ds_context_t *esp_ds_ctx; - - esp_err_t ds_r = esp_ds_start_sign(test_messages[j], - &ds_data, - t->hmac_key_idx + 1, - &esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - - ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_results[j], signature, sizeof(signature)); - } - } -} - -TEST_CASE("Digital Signature Blocking Operation (FPGA only)", "[hw_crypto]") -{ - burn_hmac_keys(); - - for (int i = 0; i < NUM_CASES; i++) { - printf("Running test case %d...\n", i); - const encrypt_testcase_t *t = &test_cases[i]; - - // copy encrypt parameter test case into ds_data structure - esp_ds_data_t ds_data = { }; - memcpy(ds_data.iv, t->iv, ETS_DS_IV_LEN); - memcpy(ds_data.c, t->expected_c, ETS_DS_C_LEN); - ds_data.rsa_length = t->p_data.length; - - uint8_t signature[4096/8] = { 0 }; - esp_ds_context_t *esp_ds_ctx; - - esp_err_t ds_r = esp_ds_start_sign(test_messages[0], - &ds_data, - t->hmac_key_idx + 1, - &esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - - ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_results[0], signature, sizeof(signature)); - } -} -TEST_CASE("Digital Signature Invalid Data (FPGA only)", "[hw_crypto]") -{ - burn_hmac_keys(); - - // Set up a valid test case - const encrypt_testcase_t *t = &test_cases[0]; - esp_ds_data_t ds_data = { }; - memcpy(ds_data.iv, t->iv, ETS_DS_IV_LEN); - memcpy(ds_data.c, t->expected_c, ETS_DS_C_LEN); - ds_data.rsa_length = t->p_data.length; - - uint8_t signature[4096/8] = { 0 }; - const uint8_t zero[4096/8] = { 0 }; - - // Corrupt the IV one bit at a time, rerun and expect failure - for (int bit = 0; bit < 128; bit++) { - printf("Corrupting IV bit %d...\n", bit); - ds_data.iv[bit / 8] ^= 1 << (bit % 8); - esp_ds_context_t *esp_ds_ctx; - - esp_err_t ds_r = esp_ds_start_sign(test_messages[0], &ds_data, t->hmac_key_idx + 1, &esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); - TEST_ASSERT_EQUAL_HEX8_ARRAY(zero, signature, 4096/8); - - ds_data.iv[bit / 8] ^= 1 << (bit % 8); - } - - // Corrupt encrypted key data one bit at a time, rerun and expect failure - printf("Corrupting C...\n"); - for (int bit = 0; bit < ETS_DS_C_LEN * 8; bit++) { - printf("Corrupting C bit %d...\n", bit); - ds_data.c[bit / 8] ^= 1 << (bit % 8); - esp_ds_context_t *esp_ds_ctx; - - esp_err_t ds_r = esp_ds_start_sign(test_messages[0], &ds_data, t->hmac_key_idx + 1, &esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); - TEST_ASSERT_EQUAL_HEX8_ARRAY(zero, signature, 4096/8); - - ds_data.c[bit / 8] ^= 1 << (bit % 8); - } -} - -#endif // CONFIG_IDF_ENV_FPGA diff --git a/components/esp32s2/test/test_sha.c b/components/esp32s2/test/test_sha.c deleted file mode 100644 index 6a57faf08b..0000000000 --- a/components/esp32s2/test/test_sha.c +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include -#include -#include "esp_types.h" -#include "esp32s2/clk.h" -#include "esp_log.h" -#include "ccomp_timer.h" -#include "esp_heap_caps.h" -#include "idf_performance.h" - -#include "unity.h" -#include "test_utils.h" -#include "mbedtls/sha1.h" -#include "mbedtls/sha256.h" -#include "mbedtls/sha512.h" -#include "sha/sha_dma.h" - -/* Note: Most of the SHA functions are called as part of mbedTLS, so -are tested as part of mbedTLS tests. Only esp_sha() is different. -*/ - -#define TAG "sha_test" - -TEST_CASE("Test esp_sha()", "[hw_crypto]") -{ - const size_t BUFFER_SZ = 32 * 1024 + 6; // NB: not an exact multiple of SHA block size - - uint32_t us_sha1, us_sha512; - uint8_t sha1_result[20] = { 0 }; - uint8_t sha512_result[64] = { 0 }; - void *buffer = heap_caps_malloc(BUFFER_SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - TEST_ASSERT_NOT_NULL(buffer); - memset(buffer, 0xEE, BUFFER_SZ); - - const uint8_t sha1_expected[20] = { 0xc7, 0xbb, 0xd3, 0x74, 0xf2, 0xf6, 0x20, 0x86, - 0x61, 0xf4, 0x50, 0xd5, 0xf5, 0x18, 0x44, 0xcc, - 0x7a, 0xb7, 0xa5, 0x4a }; - const uint8_t sha512_expected[64] = { 0xc7, 0x7f, 0xda, 0x8c, 0xb3, 0x58, 0x14, 0x8a, - 0x52, 0x3b, 0x46, 0x04, 0xc0, 0x85, 0xc5, 0xf0, - 0x46, 0x64, 0x14, 0xd5, 0x96, 0x7a, 0xa2, 0x80, - 0x20, 0x9c, 0x04, 0x27, 0x7d, 0x3b, 0xf9, 0x1f, - 0xb2, 0xa3, 0x45, 0x3c, 0xa1, 0x6a, 0x8d, 0xdd, - 0x35, 0x5e, 0x35, 0x57, 0x76, 0x22, 0x74, 0xd8, - 0x1e, 0x07, 0xc6, 0xa2, 0x9e, 0x3b, 0x65, 0x75, - 0x80, 0x7d, 0xe6, 0x6e, 0x47, 0x61, 0x2c, 0x94 }; - - ccomp_timer_start();; - esp_sha(SHA1, buffer, BUFFER_SZ, sha1_result); - us_sha1 = ccomp_timer_stop(); - TEST_ASSERT_EQUAL_HEX8_ARRAY(sha1_expected, sha1_result, sizeof(sha1_expected)); - ESP_LOGI(TAG, "esp_sha() 32KB SHA1 in %u us", us_sha1); - - ccomp_timer_start();; - esp_sha(SHA2_512, buffer, BUFFER_SZ, sha512_result); - us_sha512 = ccomp_timer_stop(); - TEST_ASSERT_EQUAL_HEX8_ARRAY(sha512_expected, sha512_result, sizeof(sha512_expected)); - ESP_LOGI(TAG, "esp_sha() 32KB SHA512 in %u us", us_sha512); - - free(buffer); - - TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA1_32KB, "%dus", us_sha1); - TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA512_32KB, "%dus", us_sha512); -} - -TEST_CASE("Test esp_sha() function with long input", "[hw_crypto]") -{ - const void* ptr; - spi_flash_mmap_handle_t handle; - uint8_t sha1_espsha[20] = { 0 }; - uint8_t sha1_mbedtls[20] = { 0 }; - uint8_t sha256_espsha[32] = { 0 }; - uint8_t sha256_mbedtls[32] = { 0 }; - uint8_t sha512_espsha[64] = { 0 }; - uint8_t sha512_mbedtls[64] = { 0 }; - - const size_t LEN = 1024 * 1024; - - /* mmap() 1MB of flash, we don't care what it is really */ - esp_err_t err = spi_flash_mmap(0x0, LEN, SPI_FLASH_MMAP_DATA, &ptr, &handle); - - TEST_ASSERT_EQUAL_HEX32(ESP_OK, err); - TEST_ASSERT_NOT_NULL(ptr); - - /* Compare esp_sha() result to the mbedTLS result, should always be the same */ - - esp_sha(SHA1, ptr, LEN, sha1_espsha); - int r = mbedtls_sha1_ret(ptr, LEN, sha1_mbedtls); - TEST_ASSERT_EQUAL(0, r); - - esp_sha(SHA2_256, ptr, LEN, sha256_espsha); - r = mbedtls_sha256_ret(ptr, LEN, sha256_mbedtls, 0); - TEST_ASSERT_EQUAL(0, r); - - esp_sha(SHA2_512, ptr, LEN, sha512_espsha); - r = mbedtls_sha512_ret(ptr, LEN, sha512_mbedtls, 0); - TEST_ASSERT_EQUAL(0, r); - - TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha1_espsha, sha1_mbedtls, sizeof(sha1_espsha), "SHA1 results should match"); - - TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha256_espsha, sha256_mbedtls, sizeof(sha256_espsha), "SHA256 results should match"); - - TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha512_espsha, sha512_mbedtls, sizeof(sha512_espsha), "SHA512 results should match"); -} diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index f4a19a15da..d07f001ae7 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -13,7 +13,6 @@ else() # Regular app build set(srcs "dport_access.c" - "esp_crypto_lock.c" "spiram.c" "spi_timing_config.c") set(include_dirs "include") diff --git a/components/esp_common/src/esp_err_to_name.c b/components/esp_common/src/esp_err_to_name.c index e7b429f72e..460eafcf00 100644 --- a/components/esp_common/src/esp_err_to_name.c +++ b/components/esp_common/src/esp_err_to_name.c @@ -5,9 +5,6 @@ #if __has_include("soc/soc.h") #include "soc/soc.h" #endif -#if __has_include("esp_ds.h") -#include "esp_ds.h" -#endif #if __has_include("esp_efuse.h") #include "esp_efuse.h" #endif @@ -59,6 +56,9 @@ #if __has_include("nvs.h") #include "nvs.h" #endif +#if __has_include("soc/esp32s2/esp_ds.h") +#include "soc/esp32s2/esp_ds.h" +#endif #if __has_include("ulp_common.h") #include "ulp_common.h" #endif @@ -740,7 +740,7 @@ static const esp_err_msg_t esp_err_msg_table[] = { ERR_TBL_IT(ESP_ERR_HW_CRYPTO_BASE), /* 49152 0xc000 Starting number of HW cryptography module error codes */ # endif - // components/esp32s2/include/esp_ds.h + // components/esp_hw_support/include/soc/esp32s2/esp_ds.h # ifdef ESP_ERR_HW_CRYPTO_DS_HMAC_FAIL ERR_TBL_IT(ESP_ERR_HW_CRYPTO_DS_HMAC_FAIL), /* 49153 0xc001 HMAC peripheral problem */ # endif diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index b2906aa75d..7be6d6e18d 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -25,7 +25,7 @@ else() endif() idf_component_register(SRCS ${srcs} - INCLUDE_DIRS include include/soc + INCLUDE_DIRS include include/soc include/soc/${target} PRIV_INCLUDE_DIRS port/include REQUIRES ${requires} PRIV_REQUIRES ${priv_requires} diff --git a/components/esp32c3/include/esp_crypto_lock.h b/components/esp_hw_support/include/soc/esp32c3/esp_crypto_lock.h similarity index 100% rename from components/esp32c3/include/esp_crypto_lock.h rename to components/esp_hw_support/include/soc/esp32c3/esp_crypto_lock.h diff --git a/components/esp32c3/include/esp_ds.h b/components/esp_hw_support/include/soc/esp32c3/esp_ds.h similarity index 100% rename from components/esp32c3/include/esp_ds.h rename to components/esp_hw_support/include/soc/esp32c3/esp_ds.h diff --git a/components/esp32c3/include/esp_hmac.h b/components/esp_hw_support/include/soc/esp32c3/esp_hmac.h similarity index 100% rename from components/esp32c3/include/esp_hmac.h rename to components/esp_hw_support/include/soc/esp32c3/esp_hmac.h diff --git a/components/esp32s2/include/esp_crypto_lock.h b/components/esp_hw_support/include/soc/esp32s2/esp_crypto_lock.h similarity index 100% rename from components/esp32s2/include/esp_crypto_lock.h rename to components/esp_hw_support/include/soc/esp32s2/esp_crypto_lock.h diff --git a/components/esp32s2/include/esp_ds.h b/components/esp_hw_support/include/soc/esp32s2/esp_ds.h similarity index 100% rename from components/esp32s2/include/esp_ds.h rename to components/esp_hw_support/include/soc/esp32s2/esp_ds.h diff --git a/components/esp32s2/include/esp_hmac.h b/components/esp_hw_support/include/soc/esp32s2/esp_hmac.h similarity index 100% rename from components/esp32s2/include/esp_hmac.h rename to components/esp_hw_support/include/soc/esp32s2/esp_hmac.h diff --git a/components/esp32s3/include/esp_crypto_lock.h b/components/esp_hw_support/include/soc/esp32s3/esp_crypto_lock.h similarity index 100% rename from components/esp32s3/include/esp_crypto_lock.h rename to components/esp_hw_support/include/soc/esp32s3/esp_crypto_lock.h diff --git a/components/esp_hw_support/port/esp32c3/CMakeLists.txt b/components/esp_hw_support/port/esp32c3/CMakeLists.txt index 0bde69c4b8..5b93a6e004 100644 --- a/components/esp_hw_support/port/esp32c3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32c3/CMakeLists.txt @@ -9,7 +9,11 @@ set(srcs "cpu_util_esp32c3.c" ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c" "memprot.c") + list(APPEND srcs "../async_memcpy_impl_gdma.c" + "memprot.c" + "esp_hmac.c" + "esp_crypto_lock.c" + "esp_ds.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32c3/esp_crypto_lock.c b/components/esp_hw_support/port/esp32c3/esp_crypto_lock.c similarity index 100% rename from components/esp32c3/esp_crypto_lock.c rename to components/esp_hw_support/port/esp32c3/esp_crypto_lock.c diff --git a/components/esp32c3/esp_ds.c b/components/esp_hw_support/port/esp32c3/esp_ds.c similarity index 100% rename from components/esp32c3/esp_ds.c rename to components/esp_hw_support/port/esp32c3/esp_ds.c diff --git a/components/esp32c3/esp_hmac.c b/components/esp_hw_support/port/esp32c3/esp_hmac.c similarity index 100% rename from components/esp32c3/esp_hmac.c rename to components/esp_hw_support/port/esp32c3/esp_hmac.c diff --git a/components/esp_hw_support/port/esp32s2/CMakeLists.txt b/components/esp_hw_support/port/esp32s2/CMakeLists.txt index 2f46610a4b..e379a61cb2 100644 --- a/components/esp_hw_support/port/esp32s2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s2/CMakeLists.txt @@ -14,7 +14,11 @@ set(srcs ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "async_memcpy_impl_cp_dma.c" "memprot.c") + list(APPEND srcs "async_memcpy_impl_cp_dma.c" + "memprot.c" + "esp_hmac.c" + "esp_crypto_lock.c" + "esp_ds.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s2/esp_crypto_lock.c b/components/esp_hw_support/port/esp32s2/esp_crypto_lock.c similarity index 100% rename from components/esp32s2/esp_crypto_lock.c rename to components/esp_hw_support/port/esp32s2/esp_crypto_lock.c diff --git a/components/esp32s2/esp_ds.c b/components/esp_hw_support/port/esp32s2/esp_ds.c similarity index 100% rename from components/esp32s2/esp_ds.c rename to components/esp_hw_support/port/esp32s2/esp_ds.c diff --git a/components/esp32s2/esp_hmac.c b/components/esp_hw_support/port/esp32s2/esp_hmac.c similarity index 100% rename from components/esp32s2/esp_hmac.c rename to components/esp_hw_support/port/esp32s2/esp_hmac.c diff --git a/components/esp_hw_support/port/esp32s3/CMakeLists.txt b/components/esp_hw_support/port/esp32s3/CMakeLists.txt index b698f0b02e..6f12e969ea 100644 --- a/components/esp_hw_support/port/esp32s3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s3/CMakeLists.txt @@ -13,7 +13,9 @@ set(srcs ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c" "memprot.c") + list(APPEND srcs "../async_memcpy_impl_gdma.c" + "esp_crypto_lock.c" + "memprot.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s3/esp_crypto_lock.c b/components/esp_hw_support/port/esp32s3/esp_crypto_lock.c similarity index 100% rename from components/esp32s3/esp_crypto_lock.c rename to components/esp_hw_support/port/esp32s3/esp_crypto_lock.c diff --git a/components/esp32c3/test/digital_signature_test_cases.h b/components/esp_hw_support/test/digital_signature_test_cases_3072.h similarity index 100% rename from components/esp32c3/test/digital_signature_test_cases.h rename to components/esp_hw_support/test/digital_signature_test_cases_3072.h diff --git a/components/esp32s2/test/digital_signature_test_cases.h b/components/esp_hw_support/test/digital_signature_test_cases_4096.h similarity index 100% rename from components/esp32s2/test/digital_signature_test_cases.h rename to components/esp_hw_support/test/digital_signature_test_cases_4096.h diff --git a/components/esp32s2/test/gen_digital_signature_tests.py b/components/esp_hw_support/test/gen_digital_signature_tests.py similarity index 100% rename from components/esp32s2/test/gen_digital_signature_tests.py rename to components/esp_hw_support/test/gen_digital_signature_tests.py diff --git a/components/esp32c3/test/test_ds.c b/components/esp_hw_support/test/test_ds.c similarity index 81% rename from components/esp32c3/test/test_ds.c rename to components/esp_hw_support/test/test_ds.c index aaffce8439..5e43bc7e55 100644 --- a/components/esp32c3/test/test_ds.c +++ b/components/esp_hw_support/test/test_ds.c @@ -12,16 +12,32 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include "unity.h" + +#include "soc/soc_caps.h" + +#if SOC_DIG_SIGN_SUPPORTED +#if CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/rom/efuse.h" +#include "esp32s2/rom/digital_signature.h" +#include "esp32s2/rom/aes.h" +#include "esp32s2/rom/sha.h" +#elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/efuse.h" #include "esp32c3/rom/digital_signature.h" #include "esp32c3/rom/hmac.h" -#include +#endif #include "esp_ds.h" #define NUM_RESULTS 10 + +#if CONFIG_IDF_TARGET_ESP32S2 +#define DS_MAX_BITS (4096) +#elif CONFIG_IDF_TARGET_ESP32C3 #define DS_MAX_BITS (ETS_DS_MAX_BITS) +#endif typedef struct { uint8_t iv[ETS_DS_IV_LEN]; @@ -31,9 +47,16 @@ typedef struct { uint32_t expected_results[NUM_RESULTS][DS_MAX_BITS/32]; } encrypt_testcase_t; -// Generated header (components/esp32s2/test/gen_digital_signature_tests.py) defines +// Generated header digital_signature_test_cases_.h (by gen_digital_signature_tests.py) defines // NUM_HMAC_KEYS, test_hmac_keys, NUM_MESSAGES, NUM_CASES, test_messages[], test_cases[] -#include "digital_signature_test_cases.h" +// Some adaptations were made: removed the 512 bit case and changed RSA lengths to the enums from esp_ds.h +#if DS_MAX_BITS == 4096 +#define RSA_LEN (ESP_DS_RSA_4096) +#include "digital_signature_test_cases_4096.h" +#elif DS_MAX_BITS == 3072 +#define RSA_LEN (ESP_DS_RSA_3072) +#include "digital_signature_test_cases_3072.h" +#endif _Static_assert(NUM_RESULTS == NUM_MESSAGES, "expected_results size should be the same as NUM_MESSAGES in generated header"); @@ -81,16 +104,15 @@ TEST_CASE("Digital Signature Parameter Encryption", "[hw_crypto] [ds]") esp_ds_data_t result = { }; esp_ds_p_data_t p_data; - memcpy(p_data.Y, t->p_data.Y, ESP_DS_SIGNATURE_MAX_BIT_LEN/8); - memcpy(p_data.M, t->p_data.M, ESP_DS_SIGNATURE_MAX_BIT_LEN/8); - memcpy(p_data.Rb, t->p_data.Rb, ESP_DS_SIGNATURE_MAX_BIT_LEN/8); + memcpy(p_data.Y, t->p_data.Y, DS_MAX_BITS/8); + memcpy(p_data.M, t->p_data.M, DS_MAX_BITS/8); + memcpy(p_data.Rb, t->p_data.Rb, DS_MAX_BITS/8); p_data.M_prime = t->p_data.M_prime; p_data.length = t->p_data.length; esp_err_t r = esp_ds_encrypt_params(&result, t->iv, &p_data, test_hmac_keys[t->hmac_key_idx]); printf("Encrypting test case %d done\n", i); - TEST_ASSERT_EQUAL(ESP_OK, r); TEST_ASSERT_EQUAL(t->p_data.length, result.rsa_length); TEST_ASSERT_EQUAL_HEX8_ARRAY(t->iv, result.iv, ETS_DS_IV_LEN); @@ -101,7 +123,7 @@ TEST_CASE("Digital Signature Parameter Encryption", "[hw_crypto] [ds]") TEST_CASE("Digital Signature start Invalid message", "[hw_crypto] [ds]") { esp_ds_data_t ds_data = { }; - ds_data.rsa_length = ESP_DS_RSA_3072; + ds_data.rsa_length = RSA_LEN; esp_ds_context_t *ctx; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(NULL, &ds_data, HMAC_KEY1, &ctx)); @@ -118,7 +140,7 @@ TEST_CASE("Digital Signature start Invalid data", "[hw_crypto] [ds]") TEST_CASE("Digital Signature start Invalid context", "[hw_crypto] [ds]") { esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; + ds_data.rsa_length = RSA_LEN; const char *message = "test"; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY1, NULL)); @@ -145,7 +167,7 @@ TEST_CASE("Digital Signature RSA length too long", "[hw_crypto] [ds]") TEST_CASE("Digital Signature start HMAC key out of range", "[hw_crypto] [ds]") { esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; + ds_data.rsa_length = RSA_LEN; esp_ds_context_t *ctx; const char *message = "test"; @@ -170,7 +192,7 @@ TEST_CASE("Digital Signature finish Invalid context", "[hw_crypto] [ds]") TEST_CASE("Digital Signature Blocking Invalid message", "[hw_crypto] [ds]") { esp_ds_data_t ds_data = { }; - ds_data.rsa_length = ESP_DS_RSA_3072; + ds_data.rsa_length = RSA_LEN; uint8_t signature_data [128 * 4]; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(NULL, &ds_data, HMAC_KEY1, signature_data)); @@ -187,7 +209,7 @@ TEST_CASE("Digital Signature Blocking Invalid data", "[hw_crypto] [ds]") TEST_CASE("Digital Signature Blocking Invalid signature ptr", "[hw_crypto] [ds]") { esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; + ds_data.rsa_length = RSA_LEN; const char *message = "test"; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY1, NULL)); @@ -226,17 +248,26 @@ TEST_CASE("Digital Signature Blocking HMAC key out of range", "[hw_crypto] [ds]" #if CONFIG_IDF_ENV_FPGA -// Burn eFuse blocks 1, 2 and 3. Block 0 is used for HMAC tests already. static void burn_hmac_keys(void) { printf("Burning %d HMAC keys to efuse...\n", NUM_HMAC_KEYS); for (int i = 0; i < NUM_HMAC_KEYS; i++) { // TODO: vary the purpose across the keys ets_efuse_purpose_t purpose = ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE; - ets_efuse_write_key(ETS_EFUSE_BLOCK_KEY1 + i, - purpose, - test_hmac_keys[i], 32); + + // starting from block 1, block 0 occupied with HMAC upstream test key + int __attribute__((unused)) ets_status = ets_efuse_write_key(ETS_EFUSE_BLOCK_KEY1 + i, + purpose, + test_hmac_keys[i], 32); +#if CONFIG_IDF_TARGET_ESP32S2 + if (ets_status == ESP_OK) { + printf("written DS test key to block [%d]!\n", ETS_EFUSE_BLOCK_KEY1 + i); + } else { + printf("writing DS test key to block [%d] failed, maybe written already\n", ETS_EFUSE_BLOCK_KEY1 + i); + } +#endif } +#if CONFIG_IDF_TARGET_ESP32C3 /* verify the keys are what we expect (possibly they're already burned, doesn't matter but they have to match) */ uint8_t block_compare[32]; for (int i = 0; i < NUM_HMAC_KEYS; i++) { @@ -244,6 +275,7 @@ static void burn_hmac_keys(void) memcpy(block_compare, (void *)ets_efuse_get_read_register_address(ETS_EFUSE_BLOCK_KEY1 + i), 32); TEST_ASSERT_EQUAL_HEX8_ARRAY(test_hmac_keys[i], block_compare, 32); } +#endif } // This test uses the HMAC_KEY0 eFuse key which hasn't been burned by burn_hmac_keys(). @@ -251,12 +283,16 @@ static void burn_hmac_keys(void) TEST_CASE("Digital Signature wrong HMAC key purpose (FPGA only)", "[hw_crypto] [ds]") { esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; + ds_data.rsa_length = RSA_LEN; esp_ds_context_t *ctx; const char *message = "test"; // HMAC fails in that case because it checks for the correct purpose +#if CONFIG_IDF_TARGET_ESP32S2 + TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_start_sign(message, &ds_data, HMAC_KEY0, &ctx)); +#elif CONFIG_IDF_TARGET_ESP32C3 TEST_ASSERT_EQUAL(ESP32C3_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_start_sign(message, &ds_data, HMAC_KEY0, &ctx)); +#endif } // This test uses the HMAC_KEY0 eFuse key which hasn't been burned by burn_hmac_keys(). @@ -264,12 +300,16 @@ TEST_CASE("Digital Signature wrong HMAC key purpose (FPGA only)", "[hw_crypto] [ TEST_CASE("Digital Signature Blocking wrong HMAC key purpose (FPGA only)", "[hw_crypto] [ds]") { esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; + ds_data.rsa_length = RSA_LEN; const char *message = "test"; uint8_t signature_data [128 * 4]; // HMAC fails in that case because it checks for the correct purpose +#if CONFIG_IDF_TARGET_ESP32S2 + TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_sign(message, &ds_data, HMAC_KEY0, signature_data)); +#elif CONFIG_IDF_TARGET_ESP32C3 TEST_ASSERT_EQUAL(ESP32C3_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_sign(message, &ds_data, HMAC_KEY0, signature_data)); +#endif } TEST_CASE("Digital Signature Operation (FPGA only)", "[hw_crypto] [ds]") @@ -291,6 +331,7 @@ TEST_CASE("Digital Signature Operation (FPGA only)", "[hw_crypto] [ds]") printf(" ... message %d\n", j); esp_ds_context_t *esp_ds_ctx; + esp_err_t ds_r = esp_ds_start_sign(test_messages[j], &ds_data, t->hmac_key_idx + 1, @@ -302,8 +343,9 @@ TEST_CASE("Digital Signature Operation (FPGA only)", "[hw_crypto] [ds]") TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_results[j], signature, sizeof(signature)); } - +#if CONFIG_IDF_TARGET_ESP32C3 ets_hmac_invalidate_downstream(ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE); +#endif } } @@ -322,12 +364,24 @@ TEST_CASE("Digital Signature Blocking Operation (FPGA only)", "[hw_crypto] [ds]" ds_data.rsa_length = t->p_data.length; uint8_t signature[DS_MAX_BITS/8] = { 0 }; +#if CONFIG_IDF_TARGET_ESP32S2 + esp_ds_context_t *esp_ds_ctx; + esp_err_t ds_r = esp_ds_start_sign(test_messages[0], + &ds_data, + t->hmac_key_idx + 1, + &esp_ds_ctx); + TEST_ASSERT_EQUAL(ESP_OK, ds_r); + + ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); + TEST_ASSERT_EQUAL(ESP_OK, ds_r); +#elif CONFIG_IDF_TARGET_ESP32C3 esp_err_t ds_r = esp_ds_sign(test_messages[0], &ds_data, t->hmac_key_idx + 1, signature); TEST_ASSERT_EQUAL(ESP_OK, ds_r); +#endif TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_results[0], signature, sizeof(signature)); } @@ -356,7 +410,11 @@ TEST_CASE("Digital Signature Invalid Data (FPGA only)", "[hw_crypto] [ds]") esp_err_t ds_r = esp_ds_start_sign(test_messages[0], &ds_data, t->hmac_key_idx + 1, &esp_ds_ctx); TEST_ASSERT_EQUAL(ESP_OK, ds_r); ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); +#if CONFIG_IDF_TARGET_ESP32S2 + TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); +#elif CONFIG_IDF_TARGET_ESP32C3 TEST_ASSERT_EQUAL(ESP32C3_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); +#endif TEST_ASSERT_EQUAL_HEX8_ARRAY(zero, signature, DS_MAX_BITS/8); ds_data.iv[bit / 8] ^= 1 << (bit % 8); @@ -372,7 +430,11 @@ TEST_CASE("Digital Signature Invalid Data (FPGA only)", "[hw_crypto] [ds]") esp_err_t ds_r = esp_ds_start_sign(test_messages[0], &ds_data, t->hmac_key_idx + 1, &esp_ds_ctx); TEST_ASSERT_EQUAL(ESP_OK, ds_r); ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); +#if CONFIG_IDF_TARGET_ESP32S2 + TEST_ASSERT_EQUAL(ESP_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); +#elif CONFIG_IDF_TARGET_ESP32C3 TEST_ASSERT_EQUAL(ESP32C3_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); +#endif TEST_ASSERT_EQUAL_HEX8_ARRAY(zero, signature, DS_MAX_BITS/8); ds_data.c[bit / 8] ^= 1 << (bit % 8); @@ -380,3 +442,4 @@ TEST_CASE("Digital Signature Invalid Data (FPGA only)", "[hw_crypto] [ds]") } #endif // CONFIG_IDF_ENV_FPGA +#endif // SOC_DIG_SIGN_SUPPORTED diff --git a/components/esp32s2/test/test_hmac.c b/components/esp_hw_support/test/test_hmac.c similarity index 99% rename from components/esp32s2/test/test_hmac.c rename to components/esp_hw_support/test/test_hmac.c index 6a4c2c75e8..85ce63c54e 100644 --- a/components/esp32s2/test/test_hmac.c +++ b/components/esp_hw_support/test/test_hmac.c @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "esp_hmac.h" #include "unity.h" #include "esp_efuse.h" #include "esp_efuse_table.h" #include "esp_log.h" +#if SOC_HMAC_SUPPORTED +#include "esp_hmac.h" + #if CONFIG_IDF_ENV_FPGA #include "esp32s2/rom/efuse.h" @@ -1033,3 +1035,5 @@ TEST_CASE("HMAC key out of range", "[hw_crypto]") } #endif // CONFIG_IDF_ENV_FPGA + +#endif // SOC_HMAC_SUPPORTED diff --git a/components/hal/include/hal/sha_types.h b/components/hal/include/hal/sha_types.h index 275ca60c63..547124b5ce 100644 --- a/components/hal/include/hal/sha_types.h +++ b/components/hal/include/hal/sha_types.h @@ -19,25 +19,26 @@ /* Use enum from rom for backwards compatibility */ #if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/sha.h" -typedef enum SHA_TYPE esp_sha_type; #elif CONFIG_IDF_TARGET_ESP32S2 #include "esp32s2/rom/sha.h" -typedef SHA_TYPE esp_sha_type; #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/sha.h" -typedef SHA_TYPE esp_sha_type; #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/sha.h" -typedef SHA_TYPE esp_sha_type; #elif CONFIG_IDF_TARGET_ESP32H2 #include "esp32h2/rom/sha.h" -typedef SHA_TYPE esp_sha_type; #endif #ifdef __cplusplus extern "C" { #endif +/* Use enum from rom for backwards compatibility */ +#if CONFIG_IDF_TARGET_ESP32 +typedef enum SHA_TYPE esp_sha_type; +#else +typedef SHA_TYPE esp_sha_type; +#endif #ifdef __cplusplus } diff --git a/components/esp32/test/test_aes_sha_rsa.c b/components/mbedtls/test/test_aes_sha_rsa.c.bak similarity index 100% rename from components/esp32/test/test_aes_sha_rsa.c rename to components/mbedtls/test/test_aes_sha_rsa.c.bak diff --git a/components/esp32/test/test_sha.c b/components/mbedtls/test/test_sha.c similarity index 89% rename from components/esp32/test/test_sha.c rename to components/mbedtls/test/test_sha.c index 627ee1a085..063cdcf0a6 100644 --- a/components/esp32/test/test_sha.c +++ b/components/mbedtls/test/test_sha.c @@ -7,19 +7,31 @@ #include #include #include "esp_types.h" -#include "esp32/clk.h" #include "esp_log.h" -#include "esp_timer.h" +#include "ccomp_timer.h" #include "esp_heap_caps.h" #include "idf_performance.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/clk.h" +#elif CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/clk.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/clk.h" +#endif + +#include "soc/soc_caps.h" + #include "unity.h" #include "test_utils.h" #include "mbedtls/sha1.h" #include "mbedtls/sha256.h" + +#if SOC_SHA_SUPPORT_SHA512 #include "mbedtls/sha512.h" +#endif + #include "sha/sha_parallel_engine.h" -#include "ccomp_timer.h" /* Note: Most of the SHA functions are called as part of mbedTLS, so are tested as part of mbedTLS tests. Only esp_sha() is different. @@ -32,9 +44,14 @@ TEST_CASE("Test esp_sha()", "[hw_crypto]") const size_t BUFFER_SZ = 32 * 1024 + 6; // NB: not an exact multiple of SHA block size int64_t elapsed; - uint32_t us_sha1, us_sha512; + uint32_t us_sha1; uint8_t sha1_result[20] = { 0 }; + +#if SOC_SHA_SUPPORT_SHA512 + uint32_t us_sha512; uint8_t sha512_result[64] = { 0 }; +#endif + void *buffer = heap_caps_malloc(BUFFER_SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); TEST_ASSERT_NOT_NULL(buffer); memset(buffer, 0xEE, BUFFER_SZ); @@ -42,6 +59,7 @@ TEST_CASE("Test esp_sha()", "[hw_crypto]") const uint8_t sha1_expected[20] = { 0xc7, 0xbb, 0xd3, 0x74, 0xf2, 0xf6, 0x20, 0x86, 0x61, 0xf4, 0x50, 0xd5, 0xf5, 0x18, 0x44, 0xcc, 0x7a, 0xb7, 0xa5, 0x4a }; +#if SOC_SHA_SUPPORT_SHA512 const uint8_t sha512_expected[64] = { 0xc7, 0x7f, 0xda, 0x8c, 0xb3, 0x58, 0x14, 0x8a, 0x52, 0x3b, 0x46, 0x04, 0xc0, 0x85, 0xc5, 0xf0, 0x46, 0x64, 0x14, 0xd5, 0x96, 0x7a, 0xa2, 0x80, @@ -50,6 +68,7 @@ TEST_CASE("Test esp_sha()", "[hw_crypto]") 0x35, 0x5e, 0x35, 0x57, 0x76, 0x22, 0x74, 0xd8, 0x1e, 0x07, 0xc6, 0xa2, 0x9e, 0x3b, 0x65, 0x75, 0x80, 0x7d, 0xe6, 0x6e, 0x47, 0x61, 0x2c, 0x94 }; +#endif ccomp_timer_start(); esp_sha(SHA1, buffer, BUFFER_SZ, sha1_result); @@ -58,6 +77,7 @@ TEST_CASE("Test esp_sha()", "[hw_crypto]") us_sha1 = elapsed; ESP_LOGI(TAG, "esp_sha() 32KB SHA1 in %u us", us_sha1); +#if SOC_SHA_SUPPORT_SHA512 ccomp_timer_start(); esp_sha(SHA2_512, buffer, BUFFER_SZ, sha512_result); elapsed = ccomp_timer_stop(); @@ -65,11 +85,15 @@ TEST_CASE("Test esp_sha()", "[hw_crypto]") us_sha512 = elapsed; ESP_LOGI(TAG, "esp_sha() 32KB SHA512 in %u us", us_sha512); +#endif free(buffer); TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA1_32KB, "%dus", us_sha1); + +#if SOC_SHA_SUPPORT_SHA512 TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA512_32KB, "%dus", us_sha512); +#endif } TEST_CASE("Test esp_sha() function with long input", "[hw_crypto]") @@ -80,8 +104,11 @@ TEST_CASE("Test esp_sha() function with long input", "[hw_crypto]") uint8_t sha1_mbedtls[20] = { 0 }; uint8_t sha256_espsha[32] = { 0 }; uint8_t sha256_mbedtls[32] = { 0 }; + +#if SOC_SHA_SUPPORT_SHA512 uint8_t sha512_espsha[64] = { 0 }; uint8_t sha512_mbedtls[64] = { 0 }; +#endif const size_t LEN = 1024 * 1024; @@ -101,13 +128,17 @@ TEST_CASE("Test esp_sha() function with long input", "[hw_crypto]") r = mbedtls_sha256_ret(ptr, LEN, sha256_mbedtls, 0); TEST_ASSERT_EQUAL(0, r); +#if SOC_SHA_SUPPORT_SHA512 esp_sha(SHA2_512, ptr, LEN, sha512_espsha); r = mbedtls_sha512_ret(ptr, LEN, sha512_mbedtls, 0); TEST_ASSERT_EQUAL(0, r); +#endif TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha1_espsha, sha1_mbedtls, sizeof(sha1_espsha), "SHA1 results should match"); TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha256_espsha, sha256_mbedtls, sizeof(sha256_espsha), "SHA256 results should match"); +#if SOC_SHA_SUPPORT_SHA512 TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha512_espsha, sha512_mbedtls, sizeof(sha512_espsha), "SHA512 results should match"); +#endif } diff --git a/docs/doxygen/Doxyfile_esp32c3 b/docs/doxygen/Doxyfile_esp32c3 index 17262969ea..df3e780e9e 100644 --- a/docs/doxygen/Doxyfile_esp32c3 +++ b/docs/doxygen/Doxyfile_esp32c3 @@ -1,4 +1,4 @@ INPUT += \ $(IDF_PATH)/components/driver/esp32c3/include/driver/temp_sensor.h \ - $(IDF_PATH)/components/esp32s2/include/esp_ds.h \ - $(IDF_PATH)/components/esp32c3/include/esp_hmac.h + $(IDF_PATH)/components/esp_hw_support/include/soc/esp32c3/esp_ds.h \ + $(IDF_PATH)/components/esp_hw_support/include/soc/esp32c3/esp_hmac.h diff --git a/docs/doxygen/Doxyfile_esp32s2 b/docs/doxygen/Doxyfile_esp32s2 index afdeb2d6fc..f71db98952 100644 --- a/docs/doxygen/Doxyfile_esp32s2 +++ b/docs/doxygen/Doxyfile_esp32s2 @@ -7,8 +7,8 @@ INPUT += \ $(IDF_PATH)/components/driver/esp32s2/include/driver/temp_sensor.h \ $(IDF_PATH)/components/soc/$(IDF_TARGET)/include/soc/touch_sensor_channel.h \ $(IDF_PATH)/components/driver/$(IDF_TARGET)/include/driver/touch_sensor.h \ - $(IDF_PATH)/components/esp32s2/include/esp_hmac.h \ - $(IDF_PATH)/components/esp32s2/include/esp_ds.h \ + $(IDF_PATH)/components/esp_hw_support/include/soc/esp32s2/esp_ds.h \ + $(IDF_PATH)/components/esp_hw_support/include/soc/esp32s2/esp_hmac.h \ $(IDF_PATH)/components/ulp/include/esp32s2/ulp_riscv.h \ $(IDF_PATH)/components/ulp/include/$(IDF_TARGET)/ulp.h \ $(IDF_PATH)/components/touch_element/include/touch_element/touch_element.h \ diff --git a/tools/ci/mypy_ignore_list.txt b/tools/ci/mypy_ignore_list.txt index 0d575c3477..65bce5e72d 100644 --- a/tools/ci/mypy_ignore_list.txt +++ b/tools/ci/mypy_ignore_list.txt @@ -1,9 +1,10 @@ components/app_update/otatool.py components/efuse/efuse_table_gen.py components/efuse/test_efuse_host/efuse_tests.py -components/esp32s2/test/gen_digital_signature_tests.py components/esp_local_ctrl/python/esp_local_ctrl_pb2.py components/esp_netif/test_apps/component_ut_test.py +components/esp_hw_support/test/gen_digital_signature_tests.py +components/espcoredump/corefile/elf.py components/espcoredump/corefile/gdb.py components/espcoredump/test/test_espcoredump.py components/lwip/weekend_test/net_suite_test.py From 452bfda367296286df0ccde407fba8ac567378f4 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Fri, 19 Mar 2021 14:30:56 +0800 Subject: [PATCH 03/17] esp32: move dport_access --- components/esp32/CMakeLists.txt | 1 - components/esp32c3/CMakeLists.txt | 5 ++--- components/esp32s2/CMakeLists.txt | 3 +-- components/esp32s3/CMakeLists.txt | 1 + components/esp_hw_support/component.mk | 2 +- .../include/soc}/esp32/dport_access.h | 0 .../include/soc}/esp32c3/dport_access.h | 0 .../include/soc}/esp32s2/dport_access.h | 2 ++ .../include/soc}/esp32s3/dport_access.h | 2 ++ components/esp_hw_support/port/esp32/CMakeLists.txt | 4 ++++ .../{ => esp_hw_support/port}/esp32/dport_access.c | 0 components/esp_hw_support/port/esp32c3/CMakeLists.txt | 3 ++- .../{ => esp_hw_support/port}/esp32c3/dport_access.c | 0 components/esp_hw_support/port/esp32s2/CMakeLists.txt | 3 ++- .../{ => esp_hw_support/port}/esp32s2/dport_access.c | 0 components/esp_hw_support/port/esp32s3/CMakeLists.txt | 1 + .../{ => esp_hw_support/port}/esp32s3/dport_access.c | 0 components/{esp32 => esp_hw_support}/test/test_dport.c | 6 ++++++ .../test/test_dport_xt_highint5.S | 6 +++++- .../test/{test_aes_sha_rsa.c.bak => test_aes_sha_rsa.c} | 9 +++++++-- 20 files changed, 36 insertions(+), 12 deletions(-) rename components/{esp32/include => esp_hw_support/include/soc}/esp32/dport_access.h (100%) rename components/{esp32c3/include => esp_hw_support/include/soc}/esp32c3/dport_access.h (100%) rename components/{esp32s2/include => esp_hw_support/include/soc}/esp32s2/dport_access.h (98%) rename components/{esp32s3/include => esp_hw_support/include/soc}/esp32s3/dport_access.h (98%) rename components/{ => esp_hw_support/port}/esp32/dport_access.c (100%) rename components/{ => esp_hw_support/port}/esp32c3/dport_access.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/dport_access.c (100%) rename components/{ => esp_hw_support/port}/esp32s3/dport_access.c (100%) rename components/{esp32 => esp_hw_support}/test/test_dport.c (99%) rename components/{esp32 => esp_hw_support}/test/test_dport_xt_highint5.S (96%) rename components/mbedtls/test/{test_aes_sha_rsa.c.bak => test_aes_sha_rsa.c} (99%) diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 03b6385ead..fc666157a0 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -13,7 +13,6 @@ else() # Regular app build set(srcs "cache_sram_mmu.c" - "dport_access.c" "esp_himem.c" "spiram.c" "spiram_psram.c") diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index eda76c3379..91b5c84222 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -11,7 +11,7 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(srcs "dport_access.c") + set(srcs) set(include_dirs "include") set(requires driver efuse soc riscv) #unfortunately rom/uart uses SOC registers directly @@ -36,8 +36,7 @@ else() target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.project.ld.in" PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32c3.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") - - target_link_libraries(${COMPONENT_LIB} PUBLIC gcc) + target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index c229ea1ddc..eacfb4da22 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -11,8 +11,7 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(srcs "dport_access.c" - "spiram.c" + set(srcs "spiram.c" "spiram_psram.c") set(include_dirs "include") diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index d07f001ae7..1b161c0606 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -14,6 +14,7 @@ else() set(srcs "dport_access.c" "spiram.c" + "spiram_psram.c" "spi_timing_config.c") set(include_dirs "include") diff --git a/components/esp_hw_support/component.mk b/components/esp_hw_support/component.mk index 5a670db3bb..47a4f18c80 100644 --- a/components/esp_hw_support/component.mk +++ b/components/esp_hw_support/component.mk @@ -3,7 +3,7 @@ COMPONENT_ADD_INCLUDEDIRS := . include port/$(IDF_TARGET)/ include/soc port/$(ID COMPONENT_ADD_LDFRAGMENTS := linker.lf ifdef IS_BOOTLOADER_BUILD -COMPONENT_OBJEXCLUDE += clk_ctrl_os.o mac_addr.o sp_async_memcpy.o intr_alloc.o sleep_modes.o regi2c_ctrl.o +COMPONENT_OBJEXCLUDE += clk_ctrl_os.o mac_addr.o esp_async_memcpy.o intr_alloc.o sleep_modes.o regi2c_ctrl.o port/$(IDF_TARGET)/dport_access.o endif COMPONENT_OBJEXCLUDE += esp_async_memcpy.o diff --git a/components/esp32/include/esp32/dport_access.h b/components/esp_hw_support/include/soc/esp32/dport_access.h similarity index 100% rename from components/esp32/include/esp32/dport_access.h rename to components/esp_hw_support/include/soc/esp32/dport_access.h diff --git a/components/esp32c3/include/esp32c3/dport_access.h b/components/esp_hw_support/include/soc/esp32c3/dport_access.h similarity index 100% rename from components/esp32c3/include/esp32c3/dport_access.h rename to components/esp_hw_support/include/soc/esp32c3/dport_access.h diff --git a/components/esp32s2/include/esp32s2/dport_access.h b/components/esp_hw_support/include/soc/esp32s2/dport_access.h similarity index 98% rename from components/esp32s2/include/esp32s2/dport_access.h rename to components/esp_hw_support/include/soc/esp32s2/dport_access.h index ffb43c07a5..6ba6fd6555 100644 --- a/components/esp32s2/include/esp32s2/dport_access.h +++ b/components/esp_hw_support/include/soc/esp32s2/dport_access.h @@ -15,6 +15,8 @@ #ifndef _ESP_DPORT_ACCESS_H_ #define _ESP_DPORT_ACCESS_H_ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/components/esp32s3/include/esp32s3/dport_access.h b/components/esp_hw_support/include/soc/esp32s3/dport_access.h similarity index 98% rename from components/esp32s3/include/esp32s3/dport_access.h rename to components/esp_hw_support/include/soc/esp32s3/dport_access.h index 96f9363b28..f3f7007a9c 100644 --- a/components/esp32s3/include/esp32s3/dport_access.h +++ b/components/esp_hw_support/include/soc/esp32s3/dport_access.h @@ -15,6 +15,8 @@ #ifndef _ESP_DPORT_ACCESS_H_ #define _ESP_DPORT_ACCESS_H_ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/components/esp_hw_support/port/esp32/CMakeLists.txt b/components/esp_hw_support/port/esp32/CMakeLists.txt index 2bbd509c18..7e2acd0226 100644 --- a/components/esp_hw_support/port/esp32/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32/CMakeLists.txt @@ -11,5 +11,9 @@ set(srcs "rtc_wdt.c" "chip_info.c") +if(NOT BOOTLOADER_BUILD) + list(APPEND srcs "dport_access.c") +endif() + add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") diff --git a/components/esp32/dport_access.c b/components/esp_hw_support/port/esp32/dport_access.c similarity index 100% rename from components/esp32/dport_access.c rename to components/esp_hw_support/port/esp32/dport_access.c diff --git a/components/esp_hw_support/port/esp32c3/CMakeLists.txt b/components/esp_hw_support/port/esp32c3/CMakeLists.txt index 5b93a6e004..f72abaac20 100644 --- a/components/esp_hw_support/port/esp32c3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32c3/CMakeLists.txt @@ -13,7 +13,8 @@ if(NOT BOOTLOADER_BUILD) "memprot.c" "esp_hmac.c" "esp_crypto_lock.c" - "esp_ds.c") + "esp_ds.c" + "dport_access.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32c3/dport_access.c b/components/esp_hw_support/port/esp32c3/dport_access.c similarity index 100% rename from components/esp32c3/dport_access.c rename to components/esp_hw_support/port/esp32c3/dport_access.c diff --git a/components/esp_hw_support/port/esp32s2/CMakeLists.txt b/components/esp_hw_support/port/esp32s2/CMakeLists.txt index e379a61cb2..b5417ccecf 100644 --- a/components/esp_hw_support/port/esp32s2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s2/CMakeLists.txt @@ -18,7 +18,8 @@ if(NOT BOOTLOADER_BUILD) "memprot.c" "esp_hmac.c" "esp_crypto_lock.c" - "esp_ds.c") + "esp_ds.c" + "dport_access.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s2/dport_access.c b/components/esp_hw_support/port/esp32s2/dport_access.c similarity index 100% rename from components/esp32s2/dport_access.c rename to components/esp_hw_support/port/esp32s2/dport_access.c diff --git a/components/esp_hw_support/port/esp32s3/CMakeLists.txt b/components/esp_hw_support/port/esp32s3/CMakeLists.txt index 6f12e969ea..13d812c00e 100644 --- a/components/esp_hw_support/port/esp32s3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s3/CMakeLists.txt @@ -14,6 +14,7 @@ set(srcs if(NOT BOOTLOADER_BUILD) list(APPEND srcs "../async_memcpy_impl_gdma.c" + "dport_access.c" "esp_crypto_lock.c" "memprot.c") endif() diff --git a/components/esp32s3/dport_access.c b/components/esp_hw_support/port/esp32s3/dport_access.c similarity index 100% rename from components/esp32s3/dport_access.c rename to components/esp_hw_support/port/esp32s3/dport_access.c diff --git a/components/esp32/test/test_dport.c b/components/esp_hw_support/test/test_dport.c similarity index 99% rename from components/esp32/test/test_dport.c rename to components/esp_hw_support/test/test_dport.c index 36172dbbc0..039e183b8c 100644 --- a/components/esp32/test/test_dport.c +++ b/components/esp_hw_support/test/test_dport.c @@ -3,6 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 #include #include #include "xtensa/core-macros.h" @@ -26,6 +29,7 @@ #include "esp_intr_alloc.h" #include "driver/timer.h" + #define MHZ (1000000) static volatile bool exit_flag; static bool dport_test_result; @@ -501,3 +505,5 @@ TEST_CASE("Check pre-read workaround DPORT and Hi-interrupt (2)", "[esp32]") run_tasks("accessAPB", accessAPB, "accessDPORT3", accessDPORT3, 10000); } #endif // CONFIG_FREERTOS_UNICORE + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_dport_xt_highint5.S b/components/esp_hw_support/test/test_dport_xt_highint5.S similarity index 96% rename from components/esp32/test/test_dport_xt_highint5.S rename to components/esp_hw_support/test/test_dport_xt_highint5.S index 7a603a5462..223a2a8924 100644 --- a/components/esp32/test/test_dport_xt_highint5.S +++ b/components/esp_hw_support/test/test_dport_xt_highint5.S @@ -1,9 +1,11 @@ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 #include #include #include #include "freertos/xtensa_context.h" #include "esp_private/panic_reason.h" -#include "sdkconfig.h" #include "soc/soc.h" #include "soc/dport_reg.h" @@ -76,3 +78,5 @@ xt_highint5: .global ld_include_test_dport_xt_highint5 ld_include_test_dport_xt_highint5: #endif // CONFIG_FREERTOS_UNICORE + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/mbedtls/test/test_aes_sha_rsa.c.bak b/components/mbedtls/test/test_aes_sha_rsa.c similarity index 99% rename from components/mbedtls/test/test_aes_sha_rsa.c.bak rename to components/mbedtls/test/test_aes_sha_rsa.c index 2f27750543..e1d26d8b5d 100644 --- a/components/mbedtls/test/test_aes_sha_rsa.c.bak +++ b/components/mbedtls/test/test_aes_sha_rsa.c @@ -6,8 +6,11 @@ #include #include #include -#include "esp_types.h" +#include +#if CONFIG_IDF_TARGET_ESP32 + +#include "esp_types.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" @@ -20,10 +23,10 @@ #include "soc/dport_reg.h" #include "soc/rtc.h" #include "esp_log.h" -#include "mbedtls/sha256.h" #include "sha/sha_parallel_engine.h" #include "aes/esp_aes.h" #include "mbedtls/rsa.h" +#include "mbedtls/sha256.h" static const char *TAG = "test"; static volatile bool exit_flag = false; @@ -289,3 +292,5 @@ TEST_CASE("Test shared using AES SHA RSA", "[hw_crypto]") vSemaphoreDelete(exit_sema[i]); } } + +#endif // CONFIG_IDF_TARGET_ESP32 From 844af01eb418365244db3eb48df5c93b72bf7997 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Fri, 19 Mar 2021 15:54:30 +0800 Subject: [PATCH 04/17] esp32: move spiram, himem --- components/esp32/CMakeLists.txt | 31 +-- components/esp32/Makefile.projbuild | 22 --- components/esp32s2/CMakeLists.txt | 5 +- components/esp32s2/include/esp_spiram.h | 85 -------- .../esp32s2/test/test_spiram_cache_flush.c | 182 ------------------ components/esp32s3/CMakeLists.txt | 13 +- components/esp32s3/include/esp_spiram.h | 90 --------- components/esp_hw_support/CMakeLists.txt | 26 ++- components/esp_hw_support/Makefile.projbuild | 19 ++ components/esp_hw_support/component.mk | 12 +- .../include/soc}/esp32/himem.h | 0 .../include/soc}/esp32/spiram.h | 5 +- .../include/soc}/esp32s2/spiram.h | 0 .../include/soc}/esp32s3/spiram.h | 0 .../include/soc}/esp_himem.h | 0 .../include/soc}/esp_spiram.h | 0 .../esp_hw_support/port/esp32/CMakeLists.txt | 6 +- .../port}/esp32/cache_sram_mmu.c | 0 .../port}/esp32/esp_himem.c | 0 .../{ => esp_hw_support/port}/esp32/spiram.c | 0 .../port}/esp32/spiram_psram.c | 0 .../port}/esp32/spiram_psram.h | 8 + .../port/esp32s2/CMakeLists.txt | 4 +- .../port}/esp32s2/spiram.c | 0 .../port}/esp32s2/spiram_psram.c | 0 .../port}/esp32s2/spiram_psram.h | 0 .../port/esp32s3/CMakeLists.txt | 10 +- .../port}/esp32s3/opiram_psram.c | 0 .../port}/esp32s3/spiram.c | 0 .../port}/esp32s3/spiram_psram.c | 0 .../port}/esp32s3/spiram_psram.h | 0 .../project_include.cmake | 0 .../test/test_4mpsram.c | 4 + .../test/test_himem.c | 4 + .../test/test_spiram_cache_flush.c | 1 - components/spi_flash/CMakeLists.txt | 4 +- .../esp32s3/mspi_timing_tuning_configs.h | 0 .../esp32s3/spi_timing_config.c | 2 +- .../esp32s3/spi_timing_config.h | 2 +- docs/doxygen/Doxyfile_esp32 | 2 +- 40 files changed, 99 insertions(+), 438 deletions(-) delete mode 100644 components/esp32s2/include/esp_spiram.h delete mode 100644 components/esp32s2/test/test_spiram_cache_flush.c delete mode 100644 components/esp32s3/include/esp_spiram.h create mode 100644 components/esp_hw_support/Makefile.projbuild rename components/{esp32/include => esp_hw_support/include/soc}/esp32/himem.h (100%) rename components/{esp32/include => esp_hw_support/include/soc}/esp32/spiram.h (99%) rename components/{esp32s2/include => esp_hw_support/include/soc}/esp32s2/spiram.h (100%) rename components/{esp32s3/include => esp_hw_support/include/soc}/esp32s3/spiram.h (100%) rename components/{esp32/include => esp_hw_support/include/soc}/esp_himem.h (100%) rename components/{esp32/include => esp_hw_support/include/soc}/esp_spiram.h (100%) rename components/{ => esp_hw_support/port}/esp32/cache_sram_mmu.c (100%) rename components/{ => esp_hw_support/port}/esp32/esp_himem.c (100%) rename components/{ => esp_hw_support/port}/esp32/spiram.c (100%) rename components/{ => esp_hw_support/port}/esp32/spiram_psram.c (100%) rename components/{ => esp_hw_support/port}/esp32/spiram_psram.h (96%) rename components/{ => esp_hw_support/port}/esp32s2/spiram.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/spiram_psram.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/spiram_psram.h (100%) rename components/{ => esp_hw_support/port}/esp32s3/opiram_psram.c (100%) rename components/{ => esp_hw_support/port}/esp32s3/spiram.c (100%) rename components/{ => esp_hw_support/port}/esp32s3/spiram_psram.c (100%) rename components/{ => esp_hw_support/port}/esp32s3/spiram_psram.h (100%) rename components/{esp32 => esp_hw_support}/project_include.cmake (100%) rename components/{esp32 => esp_hw_support}/test/test_4mpsram.c (97%) rename components/{esp32 => esp_hw_support}/test/test_himem.c (98%) rename components/{esp32 => esp_hw_support}/test/test_spiram_cache_flush.c (99%) rename components/{esp32s3/include => spi_flash}/esp32s3/mspi_timing_tuning_configs.h (100%) rename components/{ => spi_flash}/esp32s3/spi_timing_config.c (99%) rename components/{esp32s3/include => spi_flash}/esp32s3/spi_timing_config.h (99%) diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index fc666157a0..26cf178354 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -11,12 +11,6 @@ if(BOOTLOADER_BUILD) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") else() # Regular app build - set(srcs - "cache_sram_mmu.c" - "esp_himem.c" - "spiram.c" - "spiram_psram.c") - set(include_dirs "include") set(requires driver efuse soc xtensa) #unfortunately rom/uart uses SOC registers directly @@ -40,7 +34,7 @@ else() PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") - target_link_libraries(${COMPONENT_LIB} PUBLIC gcc) + target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) @@ -57,27 +51,4 @@ else() add_custom_target(esp32_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld) add_dependencies(${COMPONENT_LIB} esp32_linker_script) - if(CONFIG_SPIRAM_CACHE_WORKAROUND) - # Note: Adding as a PUBLIC compile option here causes this option to propagate to all - # components that depend on esp32. - # - # To handle some corner cases, the same flag is set in project_include.cmake - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) - # also, make sure we link with this option so correct toolchain libs are pulled in - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) - # set strategy selected - # note that we don't need to set link options as the library linked is independent of this - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) - endif() - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) - endif() - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) - endif() - endif() endif() diff --git a/components/esp32/Makefile.projbuild b/components/esp32/Makefile.projbuild index 476cead53e..1c82617738 100644 --- a/components/esp32/Makefile.projbuild +++ b/components/esp32/Makefile.projbuild @@ -1,25 +1,3 @@ -# Enable psram cache bug workaround in compiler if selected - -ifdef CONFIG_SPIRAM_CACHE_WORKAROUND -SPIRAM_CACHE_WORKAROUND_FLAGS = -mfix-esp32-psram-cache-issue - -ifdef CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST -SPIRAM_CACHE_WORKAROUND_FLAGS += -mfix-esp32-psram-cache-strategy=dupldst -endif -ifdef CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW -SPIRAM_CACHE_WORKAROUND_FLAGS += -mfix-esp32-psram-cache-strategy=memw -endif -ifdef CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS -SPIRAM_CACHE_WORKAROUND_FLAGS += -mfix-esp32-psram-cache-strategy=nops -endif - -CFLAGS+=$(SPIRAM_CACHE_WORKAROUND_FLAGS) -CXXFLAGS+=$(SPIRAM_CACHE_WORKAROUND_FLAGS) -LDFLAGS+=$(SPIRAM_CACHE_WORKAROUND_FLAGS) -endif - - - # Enable dynamic esp_timer overflow value if building unit tests ifneq ("$(filter esp32,$(TEST_COMPONENTS_LIST))","") CPPFLAGS += -DESP_TIMER_DYNAMIC_OVERFLOW_VAL diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index eacfb4da22..b4eb259028 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -11,9 +11,6 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(srcs "spiram.c" - "spiram_psram.c") - set(include_dirs "include") set(requires driver efuse xtensa) @@ -39,7 +36,7 @@ else() PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32s2.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") - target_link_libraries(${COMPONENT_LIB} PUBLIC gcc) + target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) diff --git a/components/esp32s2/include/esp_spiram.h b/components/esp32s2/include/esp_spiram.h deleted file mode 100644 index b02335d66d..0000000000 --- a/components/esp32s2/include/esp_spiram.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD -// -// 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 __ESP_SPIRAM_H -#define __ESP_SPIRAM_H - -#include -#include -#include "esp_err.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Initialize spiram interface/hardware. Normally called from cpu_start.c. - * - * @return ESP_OK on success - */ -esp_err_t esp_spiram_init(void); - -/** - * @brief Configure Cache/MMU for access to external SPI RAM. - * - * Normally this function is called from cpu_start, if CONFIG_SPIRAM_BOOT_INIT - * option is enabled. Applications which need to enable SPI RAM at run time - * can disable CONFIG_SPIRAM_BOOT_INIT, and call this function later. - * - * @attention this function must be called with flash cache disabled. - */ -void esp_spiram_init_cache(void); - - -/** - * @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and - * (in case of a dual-core system) the app CPU is online. This test overwrites the - * memory with crap, so do not call after e.g. the heap allocator has stored important - * stuff in SPI RAM. - * - * @return true on success, false on failed memory test - */ -bool esp_spiram_test(void); - - -/** - * @brief Add the initialized SPI RAM to the heap allocator. - */ -esp_err_t esp_spiram_add_to_heapalloc(void); - - -/** - * @brief Get the size of the attached SPI RAM chip selected in menuconfig - * - * @return Size in bytes, or 0 if no external RAM chip support compiled in. - */ -size_t esp_spiram_get_size(void); - - -/** - * @brief Force a writeback of the data in the SPI RAM cache. This is to be called whenever - * cache is disabled, because disabling cache on the ESP32 discards the data in the SPI - * RAM cache. - * - * This is meant for use from within the SPI flash code. - */ -void esp_spiram_writeback_cache(void); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/components/esp32s2/test/test_spiram_cache_flush.c b/components/esp32s2/test/test_spiram_cache_flush.c deleted file mode 100644 index fe89a7f52f..0000000000 --- a/components/esp32s2/test/test_spiram_cache_flush.c +++ /dev/null @@ -1,182 +0,0 @@ -/* -This code tests the interaction between PSRAM and SPI flash routines. -*/ - -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "freertos/semphr.h" -#include "freertos/queue.h" -#include "freertos/xtensa_api.h" -#include "unity.h" -#include "soc/dport_reg.h" -#include "soc/io_mux_reg.h" -#include -#include -#include -#include -#include "esp_heap_caps.h" -#include "esp_spi_flash.h" -#include "esp_partition.h" -#include "test_utils.h" - -#if CONFIG_SPIRAM - -#if CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC -#define USE_CAPS_ALLOC 1 -#endif // CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC - -#define TSTSZ (16*1024) - -#if !CONFIG_FREERTOS_UNICORE - -volatile static int res[2], err[2]; - -void tstMem(void *arg) { - volatile unsigned char *mem=(volatile unsigned char*)arg; - int p=0; - while(1) { - for (int i=0; i -#include -#include "esp_err.h" - -/** - * @brief Initialize spiram interface/hardware. Normally called from cpu_start.c. - * - * @return ESP_OK on success - */ -esp_err_t esp_spiram_init(void); - -/** - * @brief Configure Cache/MMU for access to external SPI RAM. - * - * Normally this function is called from cpu_start, if CONFIG_SPIRAM_BOOT_INIT - * option is enabled. Applications which need to enable SPI RAM at run time - * can disable CONFIG_SPIRAM_BOOT_INIT, and call this function later. - * - * @attention this function must be called with flash cache disabled. - */ -void esp_spiram_init_cache(void); - - -/** - * @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and - * (in case of a dual-core system) the app CPU is online. This test overwrites the - * memory with crap, so do not call after e.g. the heap allocator has stored important - * stuff in SPI RAM. - * - * @return true on success, false on failed memory test - */ -bool esp_spiram_test(void); - - -/** - * @brief Add the initialized SPI RAM to the heap allocator. - */ -esp_err_t esp_spiram_add_to_heapalloc(void); - - -/** - * @brief Get the size of the attached SPI RAM chip selected in menuconfig - * - * @return Size in bytes, or 0 if no external RAM chip support compiled in. - */ -size_t esp_spiram_get_size(void); - - -/** - * @brief Force a writeback of the data in the SPI RAM cache. This is to be called whenever - * cache is disabled, because disabling cache on the ESP32 discards the data in the SPI - * RAM cache. - * - * This is meant for use from within the SPI flash code. - */ -void esp_spiram_writeback_cache(void); - - - -/** - * @brief Reserve a pool of internal memory for specific DMA/internal allocations - * - * @param size Size of reserved pool in bytes - * - * @return - * - ESP_OK on success - * - ESP_ERR_NO_MEM when no memory available for pool - */ -esp_err_t esp_spiram_reserve_dma_pool(size_t size); - - -#endif diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index 7be6d6e18d..e29aa2f143 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -6,7 +6,7 @@ if(${target} STREQUAL "esp32") list(APPEND requires efuse) endif() -set(priv_requires efuse) +set(priv_requires efuse bootloader_support spi_flash) set(srcs "compare_set.c" "cpu_util.c") if(NOT BOOTLOADER_BUILD) @@ -33,3 +33,27 @@ idf_component_register(SRCS ${srcs} idf_build_get_property(target IDF_TARGET) add_subdirectory(port/${target}) + +if(CONFIG_SPIRAM_CACHE_WORKAROUND AND NOT BOOTLOADER_BUILD) + # Note: Adding as a PUBLIC compile option here causes this option to propagate to all + # components that depend on esp32. + # + # To handle some corner cases, the same flag is set in project_include.cmake + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) + # also, make sure we link with this option so correct toolchain libs are pulled in + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) + # set strategy selected + # note that we don't need to set link options as the library linked is independent of this + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) + endif() + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) + endif() + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) + endif() +endif() diff --git a/components/esp_hw_support/Makefile.projbuild b/components/esp_hw_support/Makefile.projbuild new file mode 100644 index 0000000000..6b69fb23c4 --- /dev/null +++ b/components/esp_hw_support/Makefile.projbuild @@ -0,0 +1,19 @@ +# Enable psram cache bug workaround in compiler if selected + +ifdef CONFIG_SPIRAM_CACHE_WORKAROUND +SPIRAM_CACHE_WORKAROUND_FLAGS = -mfix-esp32-psram-cache-issue + +ifdef CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST +SPIRAM_CACHE_WORKAROUND_FLAGS += -mfix-esp32-psram-cache-strategy=dupldst +endif +ifdef CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW +SPIRAM_CACHE_WORKAROUND_FLAGS += -mfix-esp32-psram-cache-strategy=memw +endif +ifdef CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS +SPIRAM_CACHE_WORKAROUND_FLAGS += -mfix-esp32-psram-cache-strategy=nops +endif + +CFLAGS+=$(SPIRAM_CACHE_WORKAROUND_FLAGS) +CXXFLAGS+=$(SPIRAM_CACHE_WORKAROUND_FLAGS) +LDFLAGS+=$(SPIRAM_CACHE_WORKAROUND_FLAGS) +endif diff --git a/components/esp_hw_support/component.mk b/components/esp_hw_support/component.mk index 47a4f18c80..5876fe64d8 100644 --- a/components/esp_hw_support/component.mk +++ b/components/esp_hw_support/component.mk @@ -3,7 +3,17 @@ COMPONENT_ADD_INCLUDEDIRS := . include port/$(IDF_TARGET)/ include/soc port/$(ID COMPONENT_ADD_LDFRAGMENTS := linker.lf ifdef IS_BOOTLOADER_BUILD -COMPONENT_OBJEXCLUDE += clk_ctrl_os.o mac_addr.o esp_async_memcpy.o intr_alloc.o sleep_modes.o regi2c_ctrl.o port/$(IDF_TARGET)/dport_access.o +COMPONENT_OBJEXCLUDE += clk_ctrl_os.o \ + intr_alloc.o \ + sleep_modes.o \ + esp_async_memcpy.o \ + mac_addr.o \ + regi2c_ctrl.o \ + port/$(IDF_TARGET)/dport_access.o \ + port/$(IDF_TARGET)/cache_sram_mmu.o \ + port/$(IDF_TARGET)/esp_himem.o \ + port/$(IDF_TARGET)/spiram.o \ + port/$(IDF_TARGET)/spiram_psram.o endif COMPONENT_OBJEXCLUDE += esp_async_memcpy.o diff --git a/components/esp32/include/esp32/himem.h b/components/esp_hw_support/include/soc/esp32/himem.h similarity index 100% rename from components/esp32/include/esp32/himem.h rename to components/esp_hw_support/include/soc/esp32/himem.h diff --git a/components/esp32/include/esp32/spiram.h b/components/esp_hw_support/include/soc/esp32/spiram.h similarity index 99% rename from components/esp32/include/esp32/spiram.h rename to components/esp_hw_support/include/soc/esp32/spiram.h index 91b26ee4a4..e58712d1fa 100644 --- a/components/esp32/include/esp32/spiram.h +++ b/components/esp_hw_support/include/soc/esp32/spiram.h @@ -108,9 +108,8 @@ esp_err_t esp_spiram_reserve_dma_pool(size_t size); */ bool esp_spiram_is_initialized(void); - -#endif - #ifdef __cplusplus } #endif + +#endif // __ESP_SPIRAM_H diff --git a/components/esp32s2/include/esp32s2/spiram.h b/components/esp_hw_support/include/soc/esp32s2/spiram.h similarity index 100% rename from components/esp32s2/include/esp32s2/spiram.h rename to components/esp_hw_support/include/soc/esp32s2/spiram.h diff --git a/components/esp32s3/include/esp32s3/spiram.h b/components/esp_hw_support/include/soc/esp32s3/spiram.h similarity index 100% rename from components/esp32s3/include/esp32s3/spiram.h rename to components/esp_hw_support/include/soc/esp32s3/spiram.h diff --git a/components/esp32/include/esp_himem.h b/components/esp_hw_support/include/soc/esp_himem.h similarity index 100% rename from components/esp32/include/esp_himem.h rename to components/esp_hw_support/include/soc/esp_himem.h diff --git a/components/esp32/include/esp_spiram.h b/components/esp_hw_support/include/soc/esp_spiram.h similarity index 100% rename from components/esp32/include/esp_spiram.h rename to components/esp_hw_support/include/soc/esp_spiram.h diff --git a/components/esp_hw_support/port/esp32/CMakeLists.txt b/components/esp_hw_support/port/esp32/CMakeLists.txt index 7e2acd0226..fe3ffda477 100644 --- a/components/esp_hw_support/port/esp32/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32/CMakeLists.txt @@ -12,7 +12,11 @@ set(srcs "chip_info.c") if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "dport_access.c") + list(APPEND srcs "cache_sram_mmu.c" + "dport_access.c" + "esp_himem.c" + "spiram.c" + "spiram_psram.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32/cache_sram_mmu.c b/components/esp_hw_support/port/esp32/cache_sram_mmu.c similarity index 100% rename from components/esp32/cache_sram_mmu.c rename to components/esp_hw_support/port/esp32/cache_sram_mmu.c diff --git a/components/esp32/esp_himem.c b/components/esp_hw_support/port/esp32/esp_himem.c similarity index 100% rename from components/esp32/esp_himem.c rename to components/esp_hw_support/port/esp32/esp_himem.c diff --git a/components/esp32/spiram.c b/components/esp_hw_support/port/esp32/spiram.c similarity index 100% rename from components/esp32/spiram.c rename to components/esp_hw_support/port/esp32/spiram.c diff --git a/components/esp32/spiram_psram.c b/components/esp_hw_support/port/esp32/spiram_psram.c similarity index 100% rename from components/esp32/spiram_psram.c rename to components/esp_hw_support/port/esp32/spiram_psram.c diff --git a/components/esp32/spiram_psram.h b/components/esp_hw_support/port/esp32/spiram_psram.h similarity index 96% rename from components/esp32/spiram_psram.h rename to components/esp_hw_support/port/esp32/spiram_psram.h index ad2ba2cf14..263fb924dc 100644 --- a/components/esp32/spiram_psram.h +++ b/components/esp_hw_support/port/esp32/spiram_psram.h @@ -11,6 +11,10 @@ #include "esp_err.h" #include "sdkconfig.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { PSRAM_CACHE_F80M_S40M = 0, PSRAM_CACHE_F40M_S40M, @@ -59,4 +63,8 @@ psram_size_t psram_get_size(void); */ esp_err_t psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vaddrmode); +#ifdef __cplusplus +} +#endif + #endif diff --git a/components/esp_hw_support/port/esp32s2/CMakeLists.txt b/components/esp_hw_support/port/esp32s2/CMakeLists.txt index b5417ccecf..5254de95a4 100644 --- a/components/esp_hw_support/port/esp32s2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s2/CMakeLists.txt @@ -19,7 +19,9 @@ if(NOT BOOTLOADER_BUILD) "esp_hmac.c" "esp_crypto_lock.c" "esp_ds.c" - "dport_access.c") + "dport_access.c" + "spiram.c" + "spiram_psram.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s2/spiram.c b/components/esp_hw_support/port/esp32s2/spiram.c similarity index 100% rename from components/esp32s2/spiram.c rename to components/esp_hw_support/port/esp32s2/spiram.c diff --git a/components/esp32s2/spiram_psram.c b/components/esp_hw_support/port/esp32s2/spiram_psram.c similarity index 100% rename from components/esp32s2/spiram_psram.c rename to components/esp_hw_support/port/esp32s2/spiram_psram.c diff --git a/components/esp32s2/spiram_psram.h b/components/esp_hw_support/port/esp32s2/spiram_psram.h similarity index 100% rename from components/esp32s2/spiram_psram.h rename to components/esp_hw_support/port/esp32s2/spiram_psram.h diff --git a/components/esp_hw_support/port/esp32s3/CMakeLists.txt b/components/esp_hw_support/port/esp32s3/CMakeLists.txt index 13d812c00e..5d65ede6e6 100644 --- a/components/esp_hw_support/port/esp32s3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s3/CMakeLists.txt @@ -16,7 +16,15 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "../async_memcpy_impl_gdma.c" "dport_access.c" "esp_crypto_lock.c" - "memprot.c") + "memprot.c" + "spiram.c") + + if(CONFIG_SPIRAM_MODE_QUAD) + list(APPEND srcs "spiram_psram.c") + elseif(CONFIG_SPIRAM_MODE_OCT) + list(APPEND srcs "opiram_psram.c") + endif() + endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s3/opiram_psram.c b/components/esp_hw_support/port/esp32s3/opiram_psram.c similarity index 100% rename from components/esp32s3/opiram_psram.c rename to components/esp_hw_support/port/esp32s3/opiram_psram.c diff --git a/components/esp32s3/spiram.c b/components/esp_hw_support/port/esp32s3/spiram.c similarity index 100% rename from components/esp32s3/spiram.c rename to components/esp_hw_support/port/esp32s3/spiram.c diff --git a/components/esp32s3/spiram_psram.c b/components/esp_hw_support/port/esp32s3/spiram_psram.c similarity index 100% rename from components/esp32s3/spiram_psram.c rename to components/esp_hw_support/port/esp32s3/spiram_psram.c diff --git a/components/esp32s3/spiram_psram.h b/components/esp_hw_support/port/esp32s3/spiram_psram.h similarity index 100% rename from components/esp32s3/spiram_psram.h rename to components/esp_hw_support/port/esp32s3/spiram_psram.h diff --git a/components/esp32/project_include.cmake b/components/esp_hw_support/project_include.cmake similarity index 100% rename from components/esp32/project_include.cmake rename to components/esp_hw_support/project_include.cmake diff --git a/components/esp32/test/test_4mpsram.c b/components/esp_hw_support/test/test_4mpsram.c similarity index 97% rename from components/esp32/test/test_4mpsram.c rename to components/esp_hw_support/test/test_4mpsram.c index 4f4d96049e..6b15262e8e 100644 --- a/components/esp32/test/test_4mpsram.c +++ b/components/esp_hw_support/test/test_4mpsram.c @@ -9,6 +9,8 @@ #include "driver/spi_common_internal.h" #include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 + static const char TAG[] = "test_psram"; #ifdef CONFIG_SPIRAM @@ -98,3 +100,5 @@ they will not pass this test at 80MHz. test_spi_bus_occupy(-1); } #endif + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_himem.c b/components/esp_hw_support/test/test_himem.c similarity index 98% rename from components/esp32/test/test_himem.c rename to components/esp_hw_support/test/test_himem.c index 72b0c81867..c8ac371284 100644 --- a/components/esp32/test/test_himem.c +++ b/components/esp_hw_support/test/test_himem.c @@ -14,6 +14,8 @@ #include "sdkconfig.h" #include "esp32/himem.h" +#if CONFIG_IDF_TARGET_ESP32 + #if CONFIG_SPIRAM_BANKSWITCH_ENABLE //Fill memory with pseudo-random data generated from the given seed. @@ -107,3 +109,5 @@ TEST_CASE("high psram memory test", "[himem]") #endif + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_spiram_cache_flush.c b/components/esp_hw_support/test/test_spiram_cache_flush.c similarity index 99% rename from components/esp32/test/test_spiram_cache_flush.c rename to components/esp_hw_support/test/test_spiram_cache_flush.c index 0982913f38..4820cd7f14 100644 --- a/components/esp32/test/test_spiram_cache_flush.c +++ b/components/esp_hw_support/test/test_spiram_cache_flush.c @@ -13,7 +13,6 @@ This code tests the interaction between PSRAM and SPI flash routines. #include "freertos/task.h" #include "freertos/semphr.h" #include "freertos/queue.h" -#include "freertos/xtensa_api.h" #include "unity.h" #include #include diff --git a/components/spi_flash/CMakeLists.txt b/components/spi_flash/CMakeLists.txt index 2a8b11c0ec..d7e9f1634f 100644 --- a/components/spi_flash/CMakeLists.txt +++ b/components/spi_flash/CMakeLists.txt @@ -82,7 +82,9 @@ else() endif() if(CONFIG_IDF_TARGET_ESP32S3) - list(APPEND srcs "spi_flash_timing_tuning.c") + list(APPEND srcs + "esp32s3/spi_timing_config.c" + "spi_flash_timing_tuning.c") endif() # New implementation after IDF v4.0 diff --git a/components/esp32s3/include/esp32s3/mspi_timing_tuning_configs.h b/components/spi_flash/esp32s3/mspi_timing_tuning_configs.h similarity index 100% rename from components/esp32s3/include/esp32s3/mspi_timing_tuning_configs.h rename to components/spi_flash/esp32s3/mspi_timing_tuning_configs.h diff --git a/components/esp32s3/spi_timing_config.c b/components/spi_flash/esp32s3/spi_timing_config.c similarity index 99% rename from components/esp32s3/spi_timing_config.c rename to components/spi_flash/esp32s3/spi_timing_config.c index 079493e856..ef496e68cb 100644 --- a/components/esp32s3/spi_timing_config.c +++ b/components/spi_flash/esp32s3/spi_timing_config.c @@ -11,7 +11,7 @@ #include "esp_types.h" #include "esp_log.h" #include "soc/spi_mem_reg.h" -#include "esp32s3/spi_timing_config.h" +#include "spi_timing_config.h" #define OPI_PSRAM_SYNC_READ 0x0000 #define OPI_PSRAM_SYNC_WRITE 0x8080 diff --git a/components/esp32s3/include/esp32s3/spi_timing_config.h b/components/spi_flash/esp32s3/spi_timing_config.h similarity index 99% rename from components/esp32s3/include/esp32s3/spi_timing_config.h rename to components/spi_flash/esp32s3/spi_timing_config.h index de9462d779..0c94b2e718 100644 --- a/components/esp32s3/include/esp32s3/spi_timing_config.h +++ b/components/spi_flash/esp32s3/spi_timing_config.h @@ -9,7 +9,7 @@ #include "esp_flash_partitions.h" #include "esp32s3/rom/spi_flash.h" #include "esp32s3/rom/opi_flash.h" -#include "esp32s3/mspi_timing_tuning_configs.h" +#include "mspi_timing_tuning_configs.h" #ifdef __cplusplus extern "C" { diff --git a/docs/doxygen/Doxyfile_esp32 b/docs/doxygen/Doxyfile_esp32 index 37d4a3a444..53f16c43fe 100644 --- a/docs/doxygen/Doxyfile_esp32 +++ b/docs/doxygen/Doxyfile_esp32 @@ -8,5 +8,5 @@ INPUT += \ $(IDF_PATH)/components/soc/$(IDF_TARGET)/include/soc/rtc_io_channel.h \ $(IDF_PATH)/components/soc/$(IDF_TARGET)/include/soc/touch_sensor_channel.h \ $(IDF_PATH)/components/driver/$(IDF_TARGET)/include/driver/touch_sensor.h \ - $(IDF_PATH)/components/esp32/include/esp32/himem.h \ + $(IDF_PATH)/components/esp_hw_support/include/soc/esp32/himem.h \ $(IDF_PATH)/components/ulp/include/$(IDF_TARGET)/ulp.h From 7c22cccb9c9108a7a95a344098a168ee28b7c64d Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Fri, 19 Mar 2021 20:03:13 +0800 Subject: [PATCH 05/17] esp32: cleanup build script --- components/app_trace/test/CMakeLists.txt | 2 +- components/app_update/CMakeLists.txt | 2 +- components/app_update/esp_ota_ops.c | 2 - components/console/CMakeLists.txt | 3 +- components/esp32/CMakeLists.txt | 34 +++++---------- components/esp32/Makefile.projbuild | 4 -- components/esp32c3/CMakeLists.txt | 41 +++++-------------- components/esp32s2/CMakeLists.txt | 34 +++++---------- components/esp32s3/CMakeLists.txt | 40 +++++------------- components/esp_hw_support/CMakeLists.txt | 3 +- components/esp_hw_support/test/CMakeLists.txt | 2 +- components/esp_pm/CMakeLists.txt | 1 + components/esp_ringbuf/test/CMakeLists.txt | 2 +- components/esp_system/CMakeLists.txt | 2 +- components/esp_system/test/CMakeLists.txt | 2 +- components/freertos/CMakeLists.txt | 2 +- components/freertos/test/CMakeLists.txt | 3 +- components/hal/CMakeLists.txt | 1 + components/mbedtls/CMakeLists.txt | 10 ++++- components/newlib/test/CMakeLists.txt | 2 +- components/spi_flash/CMakeLists.txt | 2 +- components/spi_flash/test/CMakeLists.txt | 2 +- components/ulp/test/CMakeLists.txt | 2 +- components/usb/CMakeLists.txt | 3 +- components/vfs/CMakeLists.txt | 3 +- make/project.mk | 1 - .../components/test_utils/CMakeLists.txt | 2 +- 27 files changed, 75 insertions(+), 132 deletions(-) diff --git a/components/app_trace/test/CMakeLists.txt b/components/app_trace/test/CMakeLists.txt index f2df0fd7cc..dc24ac276d 100644 --- a/components/app_trace/test/CMakeLists.txt +++ b/components/app_trace/test/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." - PRIV_REQUIRES cmock) + PRIV_REQUIRES cmock driver) diff --git a/components/app_update/CMakeLists.txt b/components/app_update/CMakeLists.txt index 2fcd57b434..e6329224e6 100644 --- a/components/app_update/CMakeLists.txt +++ b/components/app_update/CMakeLists.txt @@ -2,7 +2,7 @@ idf_component_register(SRCS "esp_ota_ops.c" "esp_app_desc.c" INCLUDE_DIRS "include" REQUIRES spi_flash partition_table bootloader_support - PRIV_REQUIRES esptool_py) + PRIV_REQUIRES esptool_py efuse) # esp_app_desc structure is added as an undefined symbol because otherwise the # linker will ignore this structure as it has no other files depending on it. diff --git a/components/app_update/esp_ota_ops.c b/components/app_update/esp_ota_ops.c index ed2368fa74..b834702d86 100644 --- a/components/app_update/esp_ota_ops.c +++ b/components/app_update/esp_ota_ops.c @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include "esp_err.h" #include "esp_partition.h" diff --git a/components/console/CMakeLists.txt b/components/console/CMakeLists.txt index f7bdeef25a..6fddca7f61 100644 --- a/components/console/CMakeLists.txt +++ b/components/console/CMakeLists.txt @@ -4,4 +4,5 @@ idf_component_register(SRCS "commands.c" "argtable3/argtable3.c" "linenoise/linenoise.c" INCLUDE_DIRS "." - REQUIRES vfs) + REQUIRES vfs + PRIV_REQUIRES driver) diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 26cf178354..d92d8c60ea 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -3,29 +3,20 @@ if(NOT "${target}" STREQUAL "esp32") return() endif() -idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) +if(NOT BOOTLOADER_BUILD) + # [refactor-todo] propagate these requirements for compatibility + # remove in the future + set(legacy_reqs driver efuse soc) +endif() -if(BOOTLOADER_BUILD) - # For bootloader, all we need from esp32 is headers - idf_component_register(INCLUDE_DIRS include REQUIRES xtensa) - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") -else() - # Regular app build - set(include_dirs "include") +idf_component_register(INCLUDE_DIRS include + REQUIRES xtensa "${legacy_reqs}" + REQUIRED_IDF_TARGETS esp32) - set(requires driver efuse soc xtensa) #unfortunately rom/uart uses SOC registers directly - - # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. - # esp_timer is added here because cpu_start.c uses esp_timer - set(priv_requires app_trace app_update bootloader_support esp_system log mbedtls nvs_flash pthread - spi_flash vfs espcoredump esp_common perfmon esp_timer esp_ipc esp_pm) - - idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - REQUIRES "${requires}" - PRIV_REQUIRES "${priv_requires}" - REQUIRED_IDF_TARGETS esp32) +target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") +if(NOT BOOTLOADER_BUILD) + idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld") # Process the template file through the linker script generation mechanism, and use the output for linking the @@ -34,8 +25,6 @@ else() PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") - target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) # Preprocess esp32.ld linker script to include configuration, becomes esp32_out.ld @@ -50,5 +39,4 @@ else() add_custom_target(esp32_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld) add_dependencies(${COMPONENT_LIB} esp32_linker_script) - endif() diff --git a/components/esp32/Makefile.projbuild b/components/esp32/Makefile.projbuild index 1c82617738..a38caa46f9 100644 --- a/components/esp32/Makefile.projbuild +++ b/components/esp32/Makefile.projbuild @@ -1,7 +1,3 @@ -# Enable dynamic esp_timer overflow value if building unit tests -ifneq ("$(filter esp32,$(TEST_COMPONENTS_LIST))","") -CPPFLAGS += -DESP_TIMER_DYNAMIC_OVERFLOW_VAL -endif ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.project.ld.in ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(realpath $(BUILD_DIR_BASE)/esp32) diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index 91b5c84222..72e19a9e49 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -1,34 +1,21 @@ idf_build_get_property(target IDF_TARGET) -idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) if(NOT "${target}" STREQUAL "esp32c3") return() endif() -if(BOOTLOADER_BUILD) - # For bootloader, all we need from esp32c3 is headers - idf_component_register(INCLUDE_DIRS include REQUIRES riscv) - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") -else() - # Regular app build +if(NOT BOOTLOADER_BUILD) + # [refactor-todo] propagate these requirements for compatibility + # remove in the future + set(legacy_reqs driver efuse soc) +endif() - set(srcs) - set(include_dirs "include") +idf_component_register(INCLUDE_DIRS include + REQUIRES riscv "${legacy_reqs}" + REQUIRED_IDF_TARGETS esp32c3) - set(requires driver efuse soc riscv) #unfortunately rom/uart uses SOC registers directly - - # driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t - # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. - # esp_timer is added here because cpu_start.c uses esp_timer - set(priv_requires - app_trace app_update bootloader_support log mbedtls nvs_flash - pthread spi_flash vfs espcoredump esp_common esp_timer) - - idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - REQUIRES "${requires}" - PRIV_REQUIRES "${priv_requires}" - REQUIRED_IDF_TARGETS esp32c3) +target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") +if(NOT BOOTLOADER_BUILD) target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32c3_out.ld") # Process the template file through the linker script generation mechanism, and use the output for linking the @@ -36,8 +23,6 @@ else() target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.project.ld.in" PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32c3.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") - target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) # Preprocess esp32c3.ld linker script to include configuration, becomes esp32c3_out.ld @@ -52,10 +37,4 @@ else() add_custom_target(esp32c3_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32c3_out.ld) add_dependencies(${COMPONENT_LIB} esp32c3_linker_script) - - # disable stack protection in files which are involved in initialization of that feature - set_source_files_properties( - cpu_start.c - PROPERTIES COMPILE_FLAGS - -fno-stack-protector) endif() diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index b4eb259028..7d5dc8b896 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -1,32 +1,22 @@ idf_build_get_property(target IDF_TARGET) -idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) if(NOT "${target}" STREQUAL "esp32s2") return() endif() -if(BOOTLOADER_BUILD) - # For bootloader, all we need from esp32s2 is headers - idf_component_register(INCLUDE_DIRS include REQUIRES xtensa) - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") -else() - # Regular app build +if(NOT BOOTLOADER_BUILD) + # [refactor-todo] propagate these requirements for compatibility + # remove in the future + set(legacy_reqs driver efuse soc) +endif() - set(include_dirs "include") +idf_component_register(INCLUDE_DIRS include + REQUIRES xtensa "${legacy_reqs}" + REQUIRED_IDF_TARGETS esp32s2) - set(requires driver efuse xtensa) - - # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. - # esp_timer is added here because cpu_start.c uses esp_timer - set(priv_requires - app_trace app_update bootloader_support esp_system log mbedtls nvs_flash - pthread spi_flash vfs espcoredump esp_common esp_timer) - - idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - REQUIRES "${requires}" - PRIV_REQUIRES "${priv_requires}" - REQUIRED_IDF_TARGETS esp32s2) +target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") +if(NOT BOOTLOADER_BUILD) + idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32s2_out.ld") # Process the template file through the linker script generation mechanism, and use the output for linking the @@ -36,8 +26,6 @@ else() PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32s2.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") - target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) # Preprocess esp32s2.ld linker script to include configuration, becomes esp32s2_out.ld diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index 1c35a62bf0..e5f908dd94 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -1,32 +1,22 @@ idf_build_get_property(target IDF_TARGET) -idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) - if(NOT "${target}" STREQUAL "esp32s3") return() endif() -if(BOOTLOADER_BUILD) - # For bootloader, all we need from esp32s3 is headers - idf_component_register(INCLUDE_DIRS include REQUIRES xtensa) - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s3.peripherals.ld") -else() - # Regular app build - set(include_dirs "include") +if(NOT BOOTLOADER_BUILD) + # [refactor-todo] propagate these requirements for compatibility + # remove in the future + set(legacy_reqs driver efuse soc) +endif() - set(requires driver efuse soc xtensa) #unfortunately rom/uart uses SOC registers directly +idf_component_register(INCLUDE_DIRS include + REQUIRES xtensa "${legacy_reqs}" + REQUIRED_IDF_TARGETS esp32s3) - # driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t - # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. - # esp_timer is added here because cpu_start.c uses esp_timer - set(priv_requires app_trace app_update bootloader_support log mbedtls nvs_flash pthread - spi_flash vfs espcoredump esp_common perfmon esp_timer esp_ipc) - - idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - REQUIRES "${requires}" - PRIV_REQUIRES "${priv_requires}" - REQUIRED_IDF_TARGETS esp32s3) +target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s3.peripherals.ld") +if(NOT BOOTLOADER_BUILD) + idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32s3_out.ld") # Process the template file through the linker script generation mechanism, and use the output for linking the @@ -35,8 +25,6 @@ else() PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32s3.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s3.peripherals.ld") - target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) # Preprocess esp32s3.ld linker script to include configuration, becomes esp32s3_out.ld @@ -51,10 +39,4 @@ else() add_custom_target(esp32s3_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32s3_out.ld) add_dependencies(${COMPONENT_LIB} esp32s3_linker_script) - - # disable stack protection in files which are involved in initialization of that feature - set_source_files_properties( - cpu_start.c - PROPERTIES COMPILE_FLAGS - -fno-stack-protector) endif() diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index e29aa2f143..a142d030e0 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -2,6 +2,7 @@ idf_build_get_property(target IDF_TARGET) set(priv_requires efuse) set(requires soc) +set(priv_requires efuse bootloader_support spi_flash) if(${target} STREQUAL "esp32") list(APPEND requires efuse) endif() @@ -28,7 +29,7 @@ idf_component_register(SRCS ${srcs} INCLUDE_DIRS include include/soc include/soc/${target} PRIV_INCLUDE_DIRS port/include REQUIRES ${requires} - PRIV_REQUIRES ${priv_requires} + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS linker.lf) idf_build_get_property(target IDF_TARGET) diff --git a/components/esp_hw_support/test/CMakeLists.txt b/components/esp_hw_support/test/CMakeLists.txt index 9e246cfaaa..bc0b3bc550 100644 --- a/components/esp_hw_support/test/CMakeLists.txt +++ b/components/esp_hw_support/test/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "${include_dirs}" - PRIV_REQUIRES cmock test_utils esp_hw_support) + PRIV_REQUIRES cmock test_utils esp_hw_support driver efuse) diff --git a/components/esp_pm/CMakeLists.txt b/components/esp_pm/CMakeLists.txt index b802986ec1..5c68058e97 100644 --- a/components/esp_pm/CMakeLists.txt +++ b/components/esp_pm/CMakeLists.txt @@ -1,3 +1,4 @@ idf_component_register(SRCS "pm_locks.c" "pm_trace.c" "pm_impl.c" INCLUDE_DIRS include + PRIV_REQUIRES esp_system driver LDFRAGMENTS linker.lf) diff --git a/components/esp_ringbuf/test/CMakeLists.txt b/components/esp_ringbuf/test/CMakeLists.txt index ed052cc07f..8014c0498c 100644 --- a/components/esp_ringbuf/test/CMakeLists.txt +++ b/components/esp_ringbuf/test/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." - PRIV_REQUIRES cmock test_utils) + PRIV_REQUIRES cmock test_utils esp_ringbuf driver) diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index fcc0d458f3..424b95b2e5 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -38,7 +38,7 @@ else() # should be removable once using component init functions # link-time registration is used. esp_pm app_update nvs_flash pthread app_trace esp_gdbstub - espcoredump esp_phy + espcoredump esp_phy efuse LDFRAGMENTS "linker.lf" "app.lf") add_subdirectory(port) diff --git a/components/esp_system/test/CMakeLists.txt b/components/esp_system/test/CMakeLists.txt index 3229228ad3..6dfdf703ae 100644 --- a/components/esp_system/test/CMakeLists.txt +++ b/components/esp_system/test/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRC_DIRS . PRIV_INCLUDE_DIRS . - PRIV_REQUIRES unity test_utils) + PRIV_REQUIRES unity test_utils driver) diff --git a/components/freertos/CMakeLists.txt b/components/freertos/CMakeLists.txt index 632e63cbe1..a91ad72674 100644 --- a/components/freertos/CMakeLists.txt +++ b/components/freertos/CMakeLists.txt @@ -69,7 +69,7 @@ idf_component_register(SRCS "${srcs}" PRIV_INCLUDE_DIRS ${private_include_dirs} LDFRAGMENTS linker.lf REQUIRES ${required_components} - PRIV_REQUIRES soc) + PRIV_REQUIRES soc esp_pm) idf_component_get_property(COMPONENT_DIR freertos COMPONENT_DIR) idf_component_set_property(freertos ORIG_INCLUDE_PATH "${COMPONENT_DIR}/include/freertos/") diff --git a/components/freertos/test/CMakeLists.txt b/components/freertos/test/CMakeLists.txt index fe5e7e2b29..12d6eed56c 100644 --- a/components/freertos/test/CMakeLists.txt +++ b/components/freertos/test/CMakeLists.txt @@ -1,4 +1,3 @@ idf_component_register(SRC_DIRS . PRIV_INCLUDE_DIRS . - PRIV_REQUIRES cmock test_utils esp_ipc - ) + PRIV_REQUIRES cmock test_utils esp_ipc driver) diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index e7a87605b0..b298d44ae8 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -118,6 +118,7 @@ idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${includes} PRIV_INCLUDE_DIRS ${priv_include} REQUIRES soc + PRIV_REQUIRES ${target} LDFRAGMENTS linker.lf) if(CONFIG_HAL_DEFAULT_ASSERTION_LEVEL EQUAL 1) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index e7a26f0ff3..7ea847fdab 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -1,10 +1,16 @@ idf_build_get_property(idf_target IDF_TARGET) idf_build_get_property(python PYTHON) +set(priv_requires soc esp_hw_support) + +if(NOT BOOTLOADER_BUILD) + list(APPEND priv_requires esp_pm) +endif() + idf_component_register(SRCS "esp_crt_bundle/esp_crt_bundle.c" INCLUDE_DIRS "port/include" "mbedtls/include" "esp_crt_bundle/include" REQUIRES lwip - PRIV_REQUIRES esp_pm soc + PRIV_REQUIRES "${priv_requires}" ) if(CONFIG_MBEDTLS_CERTIFICATE_BUNDLE) @@ -183,6 +189,8 @@ if(CONFIG_MBEDTLS_HARDWARE_MPI) endif() set_property(TARGET mbedcrypto APPEND PROPERTY LINK_INTERFACE_LIBRARIES mbedtls) +set_property(TARGET mbedcrypto APPEND PROPERTY LINK_LIBRARIES idf::driver idf::${target}) +set_property(TARGET mbedcrypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES idf::driver idf::${target}) # Link mbedtls libraries to component library target_link_libraries(${COMPONENT_LIB} PUBLIC ${mbedtls_targets}) diff --git a/components/newlib/test/CMakeLists.txt b/components/newlib/test/CMakeLists.txt index ed052cc07f..1300b7e02b 100644 --- a/components/newlib/test/CMakeLists.txt +++ b/components/newlib/test/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." - PRIV_REQUIRES cmock test_utils) + PRIV_REQUIRES cmock test_utils driver) diff --git a/components/spi_flash/CMakeLists.txt b/components/spi_flash/CMakeLists.txt index d7e9f1634f..573c6698eb 100644 --- a/components/spi_flash/CMakeLists.txt +++ b/components/spi_flash/CMakeLists.txt @@ -105,7 +105,7 @@ else() "spi_flash_os_func_noos.c") list(APPEND srcs ${cache_srcs}) - set(priv_requires bootloader_support app_update soc esp_ipc) + set(priv_requires bootloader_support app_update soc esp_ipc driver) endif() idf_component_register(SRCS "${srcs}" diff --git a/components/spi_flash/test/CMakeLists.txt b/components/spi_flash/test/CMakeLists.txt index 75be8a44c9..d3deebf4fa 100644 --- a/components/spi_flash/test/CMakeLists.txt +++ b/components/spi_flash/test/CMakeLists.txt @@ -5,4 +5,4 @@ endif() idf_component_register(SRC_DIRS "." EXCLUDE_SRCS "${exclude_srcs}" PRIV_INCLUDE_DIRS "." - PRIV_REQUIRES cmock test_utils spi_flash bootloader_support app_update) + PRIV_REQUIRES cmock test_utils spi_flash bootloader_support app_update driver) diff --git a/components/ulp/test/CMakeLists.txt b/components/ulp/test/CMakeLists.txt index d800757fd2..d4a231f314 100644 --- a/components/ulp/test/CMakeLists.txt +++ b/components/ulp/test/CMakeLists.txt @@ -3,7 +3,7 @@ if(IDF_TARGET STREQUAL "esp32s3") endif() idf_component_register(SRC_DIRS ${IDF_TARGET} PRIV_INCLUDE_DIRS . -PRIV_REQUIRES cmock ulp soc esp_common) +PRIV_REQUIRES cmock ulp soc esp_common driver) if(IDF_TARGET STREQUAL "esp32") set(ulp_sources "ulp/test_jumps_esp32.S") diff --git a/components/usb/CMakeLists.txt b/components/usb/CMakeLists.txt index ea23fc0e07..0145f81e2a 100644 --- a/components/usb/CMakeLists.txt +++ b/components/usb/CMakeLists.txt @@ -7,4 +7,5 @@ endif() idf_component_register(SRCS "hcd.c" INCLUDE_DIRS "" - PRIV_INCLUDE_DIRS "private_include") + PRIV_INCLUDE_DIRS "private_include" + PRIV_REQUIRES hal driver) diff --git a/components/vfs/CMakeLists.txt b/components/vfs/CMakeLists.txt index 5f78214121..d49ebcf8ac 100644 --- a/components/vfs/CMakeLists.txt +++ b/components/vfs/CMakeLists.txt @@ -2,7 +2,8 @@ idf_component_register(SRCS "vfs.c" "vfs_eventfd.c" "vfs_uart.c" "vfs_semihost.c" - INCLUDE_DIRS include) + INCLUDE_DIRS include + PRIV_REQUIRES driver) if(CONFIG_ESP_CONSOLE_USB_CDC) target_sources(${COMPONENT_LIB} PRIVATE "vfs_cdcacm.c") diff --git a/make/project.mk b/make/project.mk index 0aae810805..96692537cb 100644 --- a/make/project.mk +++ b/make/project.mk @@ -354,7 +354,6 @@ IDF_VER := $(shell echo "$(IDF_VER_T)" | cut -c 1-31) # Set default LDFLAGS EXTRA_LDFLAGS ?= LDFLAGS ?= -nostdlib \ - -u call_user_start_cpu0 \ $(EXTRA_LDFLAGS) \ -Wl,--gc-sections \ -Wl,-static \ diff --git a/tools/unit-test-app/components/test_utils/CMakeLists.txt b/tools/unit-test-app/components/test_utils/CMakeLists.txt index a950bfa82d..50e9fa6de1 100644 --- a/tools/unit-test-app/components/test_utils/CMakeLists.txt +++ b/tools/unit-test-app/components/test_utils/CMakeLists.txt @@ -20,4 +20,4 @@ idf_component_register(SRCS ${srcs} INCLUDE_DIRS include PRIV_INCLUDE_DIRS private_include REQUIRES spi_flash idf_test cmock - PRIV_REQUIRES perfmon esp_ipc) + PRIV_REQUIRES perfmon esp_ipc driver) From fddc0b67994a282dd21eabd33dd545613e462dbb Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Tue, 6 Apr 2021 20:38:34 +0800 Subject: [PATCH 06/17] esp32: move remaining tests --- components/esp32/test/CMakeLists.txt | 7 ------- components/esp32/test/component.mk | 8 -------- components/esp32c3/test/CMakeLists.txt | 9 --------- components/esp32c3/test/component.mk | 4 ---- components/esp32s2/test/CMakeLists.txt | 6 ------ components/esp32s2/test/component.mk | 4 ---- components/esp_hw_support/test/CMakeLists.txt | 2 ++ components/esp_hw_support/test/component.mk | 2 +- components/{esp32 => esp_hw_support}/test/test_ahb_arb.c | 6 ++++++ .../{esp32 => esp_hw_support}/test/test_ahb_arb_asm.S | 6 ++++++ components/{esp32 => esp_hw_support}/test/test_fastbus.c | 5 +++++ .../{esp32 => esp_hw_support}/test/test_fastbus_asm.S | 6 ++++++ components/{esp32 => esp_hw_support}/test/test_fp.c | 6 ++++++ components/{esp32 => esp_hw_support}/test/test_tsens.c | 7 +++++++ .../{esp32 => esp_hw_support}/test/test_unal_dma.c | 6 ++++++ components/{esp32 => esp_system}/test/test_backtrace.c | 5 +++++ 16 files changed, 50 insertions(+), 39 deletions(-) delete mode 100644 components/esp32/test/CMakeLists.txt delete mode 100644 components/esp32/test/component.mk delete mode 100644 components/esp32c3/test/CMakeLists.txt delete mode 100644 components/esp32c3/test/component.mk delete mode 100644 components/esp32s2/test/CMakeLists.txt delete mode 100644 components/esp32s2/test/component.mk rename components/{esp32 => esp_hw_support}/test/test_ahb_arb.c (99%) rename components/{esp32 => esp_hw_support}/test/test_ahb_arb_asm.S (90%) rename components/{esp32 => esp_hw_support}/test/test_fastbus.c (97%) rename components/{esp32 => esp_hw_support}/test/test_fastbus_asm.S (91%) rename components/{esp32 => esp_hw_support}/test/test_fp.c (98%) rename components/{esp32 => esp_hw_support}/test/test_tsens.c (91%) rename components/{esp32 => esp_hw_support}/test/test_unal_dma.c (98%) rename components/{esp32 => esp_system}/test/test_backtrace.c (99%) diff --git a/components/esp32/test/CMakeLists.txt b/components/esp32/test/CMakeLists.txt deleted file mode 100644 index 7c26dc0ace..0000000000 --- a/components/esp32/test/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -if(IDF_TARGET STREQUAL "esp32") - idf_component_register(SRC_DIRS . - PRIV_INCLUDE_DIRS . - PRIV_REQUIRES cmock test_utils mbedtls ulp esp_common - ) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") -endif() diff --git a/components/esp32/test/component.mk b/components/esp32/test/component.mk deleted file mode 100644 index b68857397e..0000000000 --- a/components/esp32/test/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -#Component Makefile -# - -COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive \ - -u ld_include_test_dport_xt_highint5 \ - -COMPONENT_SRCDIRS := . diff --git a/components/esp32c3/test/CMakeLists.txt b/components/esp32c3/test/CMakeLists.txt deleted file mode 100644 index 068a0a8549..0000000000 --- a/components/esp32c3/test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -if(IDF_TARGET STREQUAL "esp32c3") - idf_component_register(SRC_DIRS . - INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} - REQUIRES unity test_utils esp_common mbedtls - ) - - idf_build_set_property(COMPILE_DEFINITIONS "-DESP_TIMER_DYNAMIC_OVERFLOW_VAL" APPEND) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") -endif() diff --git a/components/esp32c3/test/component.mk b/components/esp32c3/test/component.mk deleted file mode 100644 index d2183390cc..0000000000 --- a/components/esp32c3/test/component.mk +++ /dev/null @@ -1,4 +0,0 @@ -# -# Component Makefile (not used for tests, but CI checks test parity between GNU Make & CMake) -# -COMPONENT_CONFIG_ONLY := 1 diff --git a/components/esp32s2/test/CMakeLists.txt b/components/esp32s2/test/CMakeLists.txt deleted file mode 100644 index ef9c05cd50..0000000000 --- a/components/esp32s2/test/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -if(IDF_TARGET STREQUAL "esp32s2") - idf_component_register(SRC_DIRS . - PRIV_INCLUDE_DIRS . - PRIV_REQUIRES cmock test_utils nvs_flash mbedtls ulp esp_common - ) -endif() diff --git a/components/esp32s2/test/component.mk b/components/esp32s2/test/component.mk deleted file mode 100644 index a2f7dc1797..0000000000 --- a/components/esp32s2/test/component.mk +++ /dev/null @@ -1,4 +0,0 @@ -# -# Component Makefile -# -COMPONENT_CONFIG_ONLY := 1 diff --git a/components/esp_hw_support/test/CMakeLists.txt b/components/esp_hw_support/test/CMakeLists.txt index bc0b3bc550..943d1e3102 100644 --- a/components/esp_hw_support/test/CMakeLists.txt +++ b/components/esp_hw_support/test/CMakeLists.txt @@ -1,3 +1,5 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "${include_dirs}" PRIV_REQUIRES cmock test_utils esp_hw_support driver efuse) + + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") diff --git a/components/esp_hw_support/test/component.mk b/components/esp_hw_support/test/component.mk index 2efee8e81c..342bed67fe 100644 --- a/components/esp_hw_support/test/component.mk +++ b/components/esp_hw_support/test/component.mk @@ -1,3 +1,3 @@ COMPONENT_SRCDIRS := . -COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive +COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive -u ld_include_test_dport_xt_highint5 diff --git a/components/esp32/test/test_ahb_arb.c b/components/esp_hw_support/test/test_ahb_arb.c similarity index 99% rename from components/esp32/test/test_ahb_arb.c rename to components/esp_hw_support/test/test_ahb_arb.c index f4ccfbe37b..65bea41cbc 100644 --- a/components/esp32/test/test_ahb_arb.c +++ b/components/esp_hw_support/test/test_ahb_arb.c @@ -4,6 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 + #include #include #include @@ -292,3 +296,5 @@ TEST_CASE("S32C1I vs AHB test (needs I2S)", "[hw][ignore]") vTaskDelete(th[i]); } } + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_ahb_arb_asm.S b/components/esp_hw_support/test/test_ahb_arb_asm.S similarity index 90% rename from components/esp32/test/test_ahb_arb_asm.S rename to components/esp_hw_support/test/test_ahb_arb_asm.S index 1e9214c199..981fc3cac4 100644 --- a/components/esp32/test/test_ahb_arb_asm.S +++ b/components/esp_hw_support/test/test_ahb_arb_asm.S @@ -1,3 +1,7 @@ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 + /* This little bit of code is executed in-place by one CPU, but copied to a different memory region by the other CPU. Make sure it stays position-independent. @@ -49,3 +53,5 @@ unlockloop: bne a3, a6, unlockloop retw + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_fastbus.c b/components/esp_hw_support/test/test_fastbus.c similarity index 97% rename from components/esp32/test/test_fastbus.c rename to components/esp_hw_support/test/test_fastbus.c index d3cbd6c289..2f03a39193 100644 --- a/components/esp32/test/test_fastbus.c +++ b/components/esp_hw_support/test/test_fastbus.c @@ -3,6 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 #include @@ -134,3 +137,5 @@ TEST_CASE("Fast I/O bus test", "[hw][ignore]") } xt_ints_off(1 << ETS_UART0_INUM); } + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_fastbus_asm.S b/components/esp_hw_support/test/test_fastbus_asm.S similarity index 91% rename from components/esp32/test/test_fastbus_asm.S rename to components/esp_hw_support/test/test_fastbus_asm.S index 1ced09fcf7..ccef358e21 100644 --- a/components/esp32/test/test_fastbus_asm.S +++ b/components/esp_hw_support/test/test_fastbus_asm.S @@ -1,3 +1,7 @@ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 + /* This little bit of code is executed in-place by one CPU, but copied to a different memory region by the other CPU. Make sure it stays position-independent. @@ -30,3 +34,5 @@ predout: j back //loop again out: retw //and we are done + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_fp.c b/components/esp_hw_support/test/test_fp.c similarity index 98% rename from components/esp32/test/test_fp.c rename to components/esp_hw_support/test/test_fp.c index 67996edbdc..774eb6cdde 100644 --- a/components/esp32/test/test_fp.c +++ b/components/esp_hw_support/test/test_fp.c @@ -3,6 +3,10 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 + #include #include #include "soc/cpu.h" @@ -272,3 +276,5 @@ TEST_CASE("floating point square root performance", "[fp]") TEST_PERFORMANCE_LESS_THAN(CYCLES_PER_SQRT, "%d cycles", cycles); } + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_tsens.c b/components/esp_hw_support/test/test_tsens.c similarity index 91% rename from components/esp32/test/test_tsens.c rename to components/esp_hw_support/test/test_tsens.c index 938bfa2436..0eb016bc3b 100644 --- a/components/esp32/test/test_tsens.c +++ b/components/esp_hw_support/test/test_tsens.c @@ -3,6 +3,10 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 + #include #include "unity.h" #include "esp_rom_sys.h" @@ -23,3 +27,6 @@ TEST_CASE("can control TSENS using registers", "[rtc][ignore]") int res = GET_PERI_REG_BITS2(SENS_SAR_SLAVE_ADDR3_REG, SENS_TSENS_OUT, SENS_TSENS_OUT_S); printf("res=%d\n", res); } + + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_unal_dma.c b/components/esp_hw_support/test/test_unal_dma.c similarity index 98% rename from components/esp32/test/test_unal_dma.c rename to components/esp_hw_support/test/test_unal_dma.c index 37e80a0330..c0f02a5434 100644 --- a/components/esp32/test/test_unal_dma.c +++ b/components/esp_hw_support/test/test_unal_dma.c @@ -3,6 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 #include #include @@ -202,3 +205,6 @@ TEST_CASE("Unaligned DMA test (needs I2S)", "[hw][ignore]") dmaMemcpy(src, dest + 1, 2048 + 2); TEST_ASSERT(mymemcmp(src, dest + 1, 2048) == 0); } + + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_backtrace.c b/components/esp_system/test/test_backtrace.c similarity index 99% rename from components/esp32/test/test_backtrace.c rename to components/esp_system/test/test_backtrace.c index 65fada5e7d..12018b4078 100644 --- a/components/esp32/test/test_backtrace.c +++ b/components/esp_system/test/test_backtrace.c @@ -10,6 +10,9 @@ */ #include #include "unity.h" + +#if __XTENSA__ + #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/xtensa_api.h" @@ -88,3 +91,5 @@ TEST_CASE("Test backtrace with a ROM function", "[reset_reason][reset=StoreProhi ets_install_putc1(&write_char_crash); esp_rom_printf("foo"); } + +#endif From b06dba78239ff8aa2c334bacc47685b0a161a7b1 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Thu, 8 Apr 2021 10:27:21 +0800 Subject: [PATCH 07/17] esp32: move app linker scripts --- components/esp32/CMakeLists.txt | 26 ---------- components/esp32/Makefile.projbuild | 6 --- components/esp32/component.mk | 32 +----------- components/esp32c3/CMakeLists.txt | 24 --------- components/esp32s2/CMakeLists.txt | 27 ---------- components/esp32s3/CMakeLists.txt | 26 ---------- components/esp_hw_support/CMakeLists.txt | 49 +++++++++++-------- components/esp_system/CMakeLists.txt | 1 + components/esp_system/Makefile.projbuild | 9 ++++ components/esp_system/component.mk | 28 +++++++++++ .../ld/esp32/memory.ld.in} | 0 .../ld/esp32/sections.ld.in} | 0 .../ld/esp32c3/memory.ld.in} | 0 .../ld/esp32c3/sections.ld.in} | 0 .../ld/esp32s2/memory.ld.in} | 0 .../ld/esp32s2/sections.ld.in} | 0 .../ld/esp32s3/memory.ld.in} | 0 .../ld/esp32s3/sections.ld.in} | 0 components/esp_system/ld/ld.cmake | 32 ++++++++++++ tools/ci/test_build_system.sh | 2 +- tools/ci/test_build_system_cmake.sh | 12 ++--- 21 files changed, 107 insertions(+), 167 deletions(-) delete mode 100644 components/esp32/Makefile.projbuild create mode 100644 components/esp_system/Makefile.projbuild rename components/{esp32/ld/esp32.ld => esp_system/ld/esp32/memory.ld.in} (100%) rename components/{esp32/ld/esp32.project.ld.in => esp_system/ld/esp32/sections.ld.in} (100%) rename components/{esp32c3/ld/esp32c3.ld => esp_system/ld/esp32c3/memory.ld.in} (100%) rename components/{esp32c3/ld/esp32c3.project.ld.in => esp_system/ld/esp32c3/sections.ld.in} (100%) rename components/{esp32s2/ld/esp32s2.ld => esp_system/ld/esp32s2/memory.ld.in} (100%) rename components/{esp32s2/ld/esp32s2.project.ld.in => esp_system/ld/esp32s2/sections.ld.in} (100%) rename components/{esp32s3/ld/esp32s3.ld => esp_system/ld/esp32s3/memory.ld.in} (100%) rename components/{esp32s3/ld/esp32s3.project.ld.in => esp_system/ld/esp32s3/sections.ld.in} (100%) create mode 100644 components/esp_system/ld/ld.cmake diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index d92d8c60ea..27442c948c 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -14,29 +14,3 @@ idf_component_register(INCLUDE_DIRS include REQUIRED_IDF_TARGETS esp32) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") - -if(NOT BOOTLOADER_BUILD) - idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld") - - # Process the template file through the linker script generation mechanism, and use the output for linking the - # final binary - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32.project.ld.in" - PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32.project.ld") - - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") - - idf_build_get_property(config_dir CONFIG_DIR) - # Preprocess esp32.ld linker script to include configuration, becomes esp32_out.ld - set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld) - add_custom_command( - OUTPUT esp32_out.ld - COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32_out.ld -I ${config_dir} ${LD_DIR}/esp32.ld - MAIN_DEPENDENCY ${LD_DIR}/esp32.ld - DEPENDS ${sdkconfig_header} - COMMENT "Generating linker script..." - VERBATIM) - - add_custom_target(esp32_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld) - add_dependencies(${COMPONENT_LIB} esp32_linker_script) -endif() diff --git a/components/esp32/Makefile.projbuild b/components/esp32/Makefile.projbuild deleted file mode 100644 index a38caa46f9..0000000000 --- a/components/esp32/Makefile.projbuild +++ /dev/null @@ -1,6 +0,0 @@ -ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.project.ld.in -ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(realpath $(BUILD_DIR_BASE)/esp32) - -# Target to generate linker script generator from fragments presented by each of -# the components -$(eval $(call ldgen_process_template, $(ESP32_LINKER_SCRIPT_TEMPLATE), $(ESP32_LINKER_SCRIPT_OUTPUT_DIR)/esp32.project.ld)) diff --git a/components/esp32/component.mk b/components/esp32/component.mk index 779221c83f..2132712504 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -2,33 +2,5 @@ # Component Makefile # -COMPONENT_SRCDIRS := . - -#Linker scripts used to link the final application. -#Warning: These linker scripts are only used when the normal app is compiled; the bootloader -#specifies its own scripts. -LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.peripherals.ld - -#ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the -#linker will ignore panic_highint_hdl.S as it has no other files depending on any -#symbols in it. -COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH)/ld \ - -T esp32_out.ld \ - -u ld_include_panic_highint_hdl \ - $(addprefix -T ,$(LINKER_SCRIPTS)) \ - -# final linking of project ELF depends on all binary libraries, and -# all linker scripts (except esp32_out.ld, as this is code generated here.) -COMPONENT_ADD_LINKER_DEPS := $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \ - $(COMPONENT_BUILD_DIR)/esp32.project.ld - -# Preprocess esp32.ld linker script into esp32_out.ld -# -# The library doesn't really depend on esp32_out.ld, but it -# saves us from having to add the target to a Makefile.projbuild -$(COMPONENT_LIBRARY): esp32_out.ld - -esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h - $(CC) -I ../include -C -P -x c -E $< -o $@ - -COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld +COMPONENT_ADD_LINKER_DEPS := $(COMPONENT_PATH) ld/esp32.peripherals.ld +COMPONENT_ADD_LDFLAGS := -T $(COMPONENT_PATH)/ld/esp32.peripherals.ld diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index 72e19a9e49..a0577f4dcd 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -14,27 +14,3 @@ idf_component_register(INCLUDE_DIRS include REQUIRED_IDF_TARGETS esp32c3) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") - -if(NOT BOOTLOADER_BUILD) - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32c3_out.ld") - - # Process the template file through the linker script generation mechanism, and use the output for linking the - # final binary - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.project.ld.in" - PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32c3.project.ld") - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") - - idf_build_get_property(config_dir CONFIG_DIR) - # Preprocess esp32c3.ld linker script to include configuration, becomes esp32c3_out.ld - set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld) - add_custom_command( - OUTPUT esp32c3_out.ld - COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32c3_out.ld -I ${config_dir} ${LD_DIR}/esp32c3.ld - MAIN_DEPENDENCY ${LD_DIR}/esp32c3.ld - DEPENDS ${sdkconfig_header} - COMMENT "Generating linker script..." - VERBATIM) - - add_custom_target(esp32c3_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32c3_out.ld) - add_dependencies(${COMPONENT_LIB} esp32c3_linker_script) -endif() diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index 7d5dc8b896..81c68f82de 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -14,30 +14,3 @@ idf_component_register(INCLUDE_DIRS include REQUIRED_IDF_TARGETS esp32s2) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") - -if(NOT BOOTLOADER_BUILD) - idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32s2_out.ld") - - # Process the template file through the linker script generation mechanism, and use the output for linking the - # final binary - target_linker_script(${COMPONENT_LIB} INTERFACE - "${CMAKE_CURRENT_LIST_DIR}/ld/esp32s2.project.ld.in" - PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32s2.project.ld") - - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") - - idf_build_get_property(config_dir CONFIG_DIR) - # Preprocess esp32s2.ld linker script to include configuration, becomes esp32s2_out.ld - set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld) - add_custom_command( - OUTPUT esp32s2_out.ld - COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32s2_out.ld -I ${config_dir} ${LD_DIR}/esp32s2.ld - MAIN_DEPENDENCY ${LD_DIR}/esp32s2.ld - DEPENDS ${sdkconfig_header} - COMMENT "Generating linker script..." - VERBATIM) - - add_custom_target(esp32s2_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32s2_out.ld) - add_dependencies(${COMPONENT_LIB} esp32s2_linker_script) -endif() diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index e5f908dd94..6e30552c1a 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -14,29 +14,3 @@ idf_component_register(INCLUDE_DIRS include REQUIRED_IDF_TARGETS esp32s3) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s3.peripherals.ld") - -if(NOT BOOTLOADER_BUILD) - idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32s3_out.ld") - - # Process the template file through the linker script generation mechanism, and use the output for linking the - # final binary - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32s3.project.ld.in" - PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32s3.project.ld") - - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s3.peripherals.ld") - - idf_build_get_property(config_dir CONFIG_DIR) - # Preprocess esp32s3.ld linker script to include configuration, becomes esp32s3_out.ld - set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld) - add_custom_command( - OUTPUT esp32s3_out.ld - COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32s3_out.ld -I ${config_dir} ${LD_DIR}/esp32s3.ld - MAIN_DEPENDENCY ${LD_DIR}/esp32s3.ld - DEPENDS ${sdkconfig_header} - COMMENT "Generating linker script..." - VERBATIM) - - add_custom_target(esp32s3_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32s3_out.ld) - add_dependencies(${COMPONENT_LIB} esp32s3_linker_script) -endif() diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index a142d030e0..df16921b75 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -35,26 +35,33 @@ idf_component_register(SRCS ${srcs} idf_build_get_property(target IDF_TARGET) add_subdirectory(port/${target}) -if(CONFIG_SPIRAM_CACHE_WORKAROUND AND NOT BOOTLOADER_BUILD) - # Note: Adding as a PUBLIC compile option here causes this option to propagate to all - # components that depend on esp32. - # - # To handle some corner cases, the same flag is set in project_include.cmake - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) - # also, make sure we link with this option so correct toolchain libs are pulled in - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) - # set strategy selected - # note that we don't need to set link options as the library linked is independent of this - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) - endif() - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) - endif() - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) +if(NOT BOOTLOADER_BUILD) + + if(CONFIG_SPIRAM_CACHE_WORKAROUND) + # Note: Adding as a PUBLIC compile option here causes this option to propagate to all + # components that depend on esp32. + # + # To handle some corner cases, the same flag is set in project_include.cmake + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) + # also, make sure we link with this option so correct toolchain libs are pulled in + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) + # set strategy selected + # note that we don't need to set link options as the library linked is independent of this + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) + endif() + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) + endif() + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) + endif() endif() + + set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/sleep_modes.c" PROPERTIES + COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") + endif() diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index 424b95b2e5..b99447fbc3 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -58,6 +58,7 @@ else() PROPERTIES COMPILE_FLAGS -fno-stack-protector) + include(${CMAKE_CURRENT_LIST_DIR}/ld/ld.cmake) endif() if(CONFIG_IDF_ENV_FPGA) diff --git a/components/esp_system/Makefile.projbuild b/components/esp_system/Makefile.projbuild new file mode 100644 index 0000000000..45209aa293 --- /dev/null +++ b/components/esp_system/Makefile.projbuild @@ -0,0 +1,9 @@ +ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32/sections.ld.in +ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(BUILD_DIR_BASE)/esp_system/ld +ESP32_SECTIONS_LINKER_SCRIPT := $(ESP32_LINKER_SCRIPT_OUTPUT_DIR)/sections.ld + +# Target to generate linker script generator from fragments presented by each of +# the components +$(eval $(call ldgen_process_template, $(ESP32_LINKER_SCRIPT_TEMPLATE), $(ESP32_SECTIONS_LINKER_SCRIPT))) + +$(APP_ELF): $(ESP32_SECTIONS_LINKER_SCRIPT) diff --git a/components/esp_system/component.mk b/components/esp_system/component.mk index 07bc231bb4..6f603f880b 100644 --- a/components/esp_system/component.mk +++ b/components/esp_system/component.mk @@ -28,4 +28,32 @@ include $(COMPONENT_PATH)/port/soc/$(SOC_NAME)/component.mk # disable stack protection in files which are involved in initialization of that feature startup.o stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS)) + +ld_input := $(COMPONENT_PATH)/ld/esp32/memory.ld.in +ld_output := $(COMPONENT_BUILD_DIR)/ld/memory.ld + +sections_ld := $(COMPONENT_BUILD_DIR)/ld/sections.ld + +#Linker scripts used to link the final application. +#Warning: These linker scripts are only used when the normal app is compiled; the bootloader +#specifies its own scripts. +LINKER_SCRIPTS += $(ld_output) $(sections_ld) + +#ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the +#linker will ignore panic_highint_hdl.S as it has no other files depending on any +#symbols in it. +COMPONENT_ADD_LDFLAGS += -u ld_include_panic_highint_hdl \ + $(addprefix -T ,$(LINKER_SCRIPTS)) \ + +# Preprocess memory.ld.in linker script into memory.ld +# +# The library doesn't really depend on memory.ld, but it +# saves us from having to add the target to a Makefile.projbuild +$(COMPONENT_LIBRARY): $(ld_output) + +$(ld_output): $(ld_input) ../include/sdkconfig.h + mkdir -p $(COMPONENT_BUILD_DIR)/ld + $(CC) -I ../include -C -P -x c -E $< -o $@ + +COMPONENT_EXTRA_CLEAN := $(ld_output) $(sections_ld) endif diff --git a/components/esp32/ld/esp32.ld b/components/esp_system/ld/esp32/memory.ld.in similarity index 100% rename from components/esp32/ld/esp32.ld rename to components/esp_system/ld/esp32/memory.ld.in diff --git a/components/esp32/ld/esp32.project.ld.in b/components/esp_system/ld/esp32/sections.ld.in similarity index 100% rename from components/esp32/ld/esp32.project.ld.in rename to components/esp_system/ld/esp32/sections.ld.in diff --git a/components/esp32c3/ld/esp32c3.ld b/components/esp_system/ld/esp32c3/memory.ld.in similarity index 100% rename from components/esp32c3/ld/esp32c3.ld rename to components/esp_system/ld/esp32c3/memory.ld.in diff --git a/components/esp32c3/ld/esp32c3.project.ld.in b/components/esp_system/ld/esp32c3/sections.ld.in similarity index 100% rename from components/esp32c3/ld/esp32c3.project.ld.in rename to components/esp_system/ld/esp32c3/sections.ld.in diff --git a/components/esp32s2/ld/esp32s2.ld b/components/esp_system/ld/esp32s2/memory.ld.in similarity index 100% rename from components/esp32s2/ld/esp32s2.ld rename to components/esp_system/ld/esp32s2/memory.ld.in diff --git a/components/esp32s2/ld/esp32s2.project.ld.in b/components/esp_system/ld/esp32s2/sections.ld.in similarity index 100% rename from components/esp32s2/ld/esp32s2.project.ld.in rename to components/esp_system/ld/esp32s2/sections.ld.in diff --git a/components/esp32s3/ld/esp32s3.ld b/components/esp_system/ld/esp32s3/memory.ld.in similarity index 100% rename from components/esp32s3/ld/esp32s3.ld rename to components/esp_system/ld/esp32s3/memory.ld.in diff --git a/components/esp32s3/ld/esp32s3.project.ld.in b/components/esp_system/ld/esp32s3/sections.ld.in similarity index 100% rename from components/esp32s3/ld/esp32s3.project.ld.in rename to components/esp_system/ld/esp32s3/sections.ld.in diff --git a/components/esp_system/ld/ld.cmake b/components/esp_system/ld/ld.cmake new file mode 100644 index 0000000000..93376b69c1 --- /dev/null +++ b/components/esp_system/ld/ld.cmake @@ -0,0 +1,32 @@ +# For each supported target, a memory.ld.in and sections.ld.in is processed and dictate the +# memory layout of the app. +# +# memory.ld.in goes through the preprocessor +# sections.ld.in goes through linker script generator + +idf_build_get_property(target IDF_TARGET) +idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) + +set(ld_input "${CMAKE_CURRENT_LIST_DIR}/${target}/memory.ld.in") +set(ld_output "${CMAKE_CURRENT_BINARY_DIR}/ld/memory.ld") +target_linker_script(${COMPONENT_LIB} INTERFACE "${ld_output}") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ld") + +# Process the template file through the linker script generation mechanism, and use the output for linking the +# final binary +target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/${target}/sections.ld.in" + PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/sections.ld") + +idf_build_get_property(config_dir CONFIG_DIR) +# Preprocess memory.ld.in linker script to include configuration, becomes memory.ld +add_custom_command( + OUTPUT ${ld_output} + COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o ${ld_output} -I ${config_dir} ${ld_input} + MAIN_DEPENDENCY ${ld_input} + DEPENDS ${sdkconfig_header} + COMMENT "Generating memory.ld linker script..." + VERBATIM) + +add_custom_target(memory_ld DEPENDS ${ld_output}) +add_dependencies(${COMPONENT_LIB} memory_ld) diff --git a/tools/ci/test_build_system.sh b/tools/ci/test_build_system.sh index 88e17bf5e1..948cdb84fe 100755 --- a/tools/ci/test_build_system.sh +++ b/tools/ci/test_build_system.sh @@ -160,7 +160,7 @@ function run_tests() print_status "Touching app-only template ld file should only re-link app" take_build_snapshot - touch ${IDF_PATH}/components/esp32/ld/esp32.project.ld.in + touch ${IDF_PATH}/components/esp_system/ld/esp32/sections.ld.in make assert_rebuilt ${APP_BINS} assert_not_rebuilt ${BOOTLOADER_BINS} diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index ce349765f8..8eda08f8a7 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -210,23 +210,23 @@ function run_tests() print_status "Updating app-only ld file should only re-link app" take_build_snapshot - cp ${IDF_PATH}/components/esp32/ld/esp32.project.ld.in . + cp ${IDF_PATH}/components/esp_system/ld/esp32/sections.ld.in . sleep 1 # ninja may ignore if the timestamp delta is too low - echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp32/ld/esp32.project.ld.in + echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp_system/ld/esp32/sections.ld.in idf.py build || failure "Failed to rebuild with modified linker script" assert_rebuilt ${APP_BINS} assert_not_rebuilt ${BOOTLOADER_BINS} - mv esp32.project.ld.in ${IDF_PATH}/components/esp32/ld/ + mv sections.ld.in ${IDF_PATH}/components/esp_system/ld/esp32 print_status "Updating ld file should only re-link app" take_build_snapshot - cp ${IDF_PATH}/components/esp32/ld/esp32.ld . + cp ${IDF_PATH}/components/esp_system/ld/esp32/memory.ld . sleep 1 # ninja may ignore if the timestamp delta is too low - echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp32/ld/esp32.ld + echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp_system/ld/esp32/memory.ld.in idf.py build || failure "Failed to rebuild with modified linker script" assert_rebuilt ${APP_BINS} assert_not_rebuilt ${BOOTLOADER_BINS} - mv esp32.ld ${IDF_PATH}/components/esp32/ld/ + mv memory.ld ${IDF_PATH}/components/esp_system/ld/esp32/ print_status "Updating fragment file should only re-link app" # only app linker script is generated by tool for now take_build_snapshot From 867f13c6b77dbc8e9352f27a33bb281f43b2a041 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 18 Jun 2021 10:51:43 +1000 Subject: [PATCH 08/17] tests gen_digital_signature_tests: Fix mypy issues --- .../test/gen_digital_signature_tests.py | 11 ++++++----- tools/ci/mypy_ignore_list.txt | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/esp_hw_support/test/gen_digital_signature_tests.py b/components/esp_hw_support/test/gen_digital_signature_tests.py index 9e50c10466..d9ceee5476 100644 --- a/components/esp_hw_support/test/gen_digital_signature_tests.py +++ b/components/esp_hw_support/test/gen_digital_signature_tests.py @@ -8,11 +8,12 @@ import struct from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa +from cryptography.hazmat.primitives.asymmetric.rsa import _modinv as modinv # type: ignore from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.utils import int_to_bytes -def number_as_bignum_words(number): +def number_as_bignum_words(number): # type: (int) -> str """ Given a number, format result as a C array of words (little-endian, same as ESP32 RSA peripheral or mbedTLS) @@ -24,17 +25,17 @@ def number_as_bignum_words(number): return '{ ' + ', '.join(result) + ' }' -def number_as_bytes(number, pad_bits=None): +def number_as_bytes(number, pad_bits=None): # type: (int, int) -> bytes """ Given a number, format as a little endian array of bytes """ - result = int_to_bytes(number)[::-1] + result = int_to_bytes(number)[::-1] # type: bytes while pad_bits is not None and len(result) < (pad_bits // 8): result += b'\x00' return result -def bytes_as_char_array(b): +def bytes_as_char_array(b): # type: (bytes) -> str """ Given a sequence of bytes, format as a char array """ @@ -96,7 +97,7 @@ with open('digital_signature_test_cases.h', 'w') as f: rr = 1 << (key_size * 2) rinv = rr % pub_numbers.n - mprime = - rsa._modinv(M, 1 << 32) + mprime = - modinv(M, 1 << 32) mprime &= 0xFFFFFFFF length = key_size // 32 - 1 diff --git a/tools/ci/mypy_ignore_list.txt b/tools/ci/mypy_ignore_list.txt index 65bce5e72d..84c2132cd0 100644 --- a/tools/ci/mypy_ignore_list.txt +++ b/tools/ci/mypy_ignore_list.txt @@ -3,7 +3,6 @@ components/efuse/efuse_table_gen.py components/efuse/test_efuse_host/efuse_tests.py components/esp_local_ctrl/python/esp_local_ctrl_pb2.py components/esp_netif/test_apps/component_ut_test.py -components/esp_hw_support/test/gen_digital_signature_tests.py components/espcoredump/corefile/elf.py components/espcoredump/corefile/gdb.py components/espcoredump/test/test_espcoredump.py From f0471b18b293536d8e57394743b5a4eaac485abe Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 6 Jul 2021 17:29:05 +1000 Subject: [PATCH 09/17] esp32h2: Move from target component to esp_hw_support (new structure) --- components/esp32h2/CMakeLists.txt | 70 +--- components/esp32h2/test/CMakeLists.txt | 9 - components/esp32h2/test/component.mk | 4 - .../test/digital_signature_test_cases.h | 166 -------- components/esp32h2/test/test_ds.c | 382 ------------------ components/esp32h2/test/test_sha.c | 80 ---- .../include/soc}/esp32h2/dport_access.h | 0 .../include/soc/esp32h2}/esp_crypto_lock.h | 0 .../include/soc/esp32h2}/esp_ds.h | 0 .../include/soc/esp32h2}/esp_hmac.h | 0 .../include/soc}/esp32h2/memprot.h | 1 + .../port/esp32h2/CMakeLists.txt | 12 +- .../port}/esp32h2/dport_access.c | 0 .../port}/esp32h2/esp_crypto_lock.c | 0 .../port}/esp32h2/esp_ds.c | 0 .../port}/esp32h2/esp_hmac.c | 0 .../port}/esp32h2/memprot.c | 0 .../ld/esp32h2/memory.ld.in} | 0 .../ld/esp32h2/sections.ld.in} | 0 19 files changed, 17 insertions(+), 707 deletions(-) delete mode 100644 components/esp32h2/test/CMakeLists.txt delete mode 100644 components/esp32h2/test/component.mk delete mode 100644 components/esp32h2/test/digital_signature_test_cases.h delete mode 100644 components/esp32h2/test/test_ds.c delete mode 100644 components/esp32h2/test/test_sha.c rename components/{esp32h2/include => esp_hw_support/include/soc}/esp32h2/dport_access.h (100%) rename components/{esp32h2/include => esp_hw_support/include/soc/esp32h2}/esp_crypto_lock.h (100%) rename components/{esp32h2/include => esp_hw_support/include/soc/esp32h2}/esp_ds.h (100%) rename components/{esp32h2/include => esp_hw_support/include/soc/esp32h2}/esp_hmac.h (100%) rename components/{esp32h2/include => esp_hw_support/include/soc}/esp32h2/memprot.h (99%) rename components/{ => esp_hw_support/port}/esp32h2/dport_access.c (100%) rename components/{ => esp_hw_support/port}/esp32h2/esp_crypto_lock.c (100%) rename components/{ => esp_hw_support/port}/esp32h2/esp_ds.c (100%) rename components/{ => esp_hw_support/port}/esp32h2/esp_hmac.c (100%) rename components/{ => esp_hw_support/port}/esp32h2/memprot.c (100%) rename components/{esp32h2/ld/esp32h2.ld => esp_system/ld/esp32h2/memory.ld.in} (100%) rename components/{esp32h2/ld/esp32h2.project.ld.in => esp_system/ld/esp32h2/sections.ld.in} (100%) diff --git a/components/esp32h2/CMakeLists.txt b/components/esp32h2/CMakeLists.txt index faeb758285..3c29e6a62c 100644 --- a/components/esp32h2/CMakeLists.txt +++ b/components/esp32h2/CMakeLists.txt @@ -1,66 +1,16 @@ idf_build_get_property(target IDF_TARGET) -idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) if(NOT "${target}" STREQUAL "esp32h2") return() endif() -if(BOOTLOADER_BUILD) - # For bootloader, all we need from esp32h2 is headers - idf_component_register(INCLUDE_DIRS include REQUIRES riscv) - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32h2.peripherals.ld") -else() - # Regular app build - - set(srcs "dport_access.c" - "esp_hmac.c" - "esp_ds.c" - "esp_crypto_lock.c" - "memprot.c") - set(include_dirs "include") - - set(requires driver efuse soc riscv) #unfortunately rom/uart uses SOC registers directly - - # driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t - # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. - # esp_timer is added here because cpu_start.c uses esp_timer - set(priv_requires - app_trace app_update bootloader_support log mbedtls nvs_flash - pthread spi_flash vfs espcoredump esp_common esp_timer) - - idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - REQUIRES "${requires}" - PRIV_REQUIRES "${priv_requires}" - REQUIRED_IDF_TARGETS esp32h2) - - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32h2_out.ld") - - # Process the template file through the linker script generation mechanism, and use the output for linking the - # final binary - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32h2.project.ld.in" - PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32h2.project.ld") - target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32h2.peripherals.ld") - - target_link_libraries(${COMPONENT_LIB} PUBLIC gcc) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") - - idf_build_get_property(config_dir CONFIG_DIR) - # Preprocess esp32h2.ld linker script to include configuration, becomes esp32h2_out.ld - set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld) - add_custom_command( - OUTPUT esp32h2_out.ld - COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32h2_out.ld -I ${config_dir} ${LD_DIR}/esp32h2.ld - MAIN_DEPENDENCY ${LD_DIR}/esp32h2.ld - DEPENDS ${sdkconfig_header} - COMMENT "Generating linker script..." - VERBATIM) - - add_custom_target(esp32h2_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32h2_out.ld) - add_dependencies(${COMPONENT_LIB} esp32h2_linker_script) - - # disable stack protection in files which are involved in initialization of that feature - set_source_files_properties( - cpu_start.c - PROPERTIES COMPILE_FLAGS - -fno-stack-protector) +if(NOT BOOTLOADER_BUILD) + # [refactor-todo] propagate these requirements for compatibility + # remove in the future + set(legacy_reqs driver efuse soc) endif() + +idf_component_register(INCLUDE_DIRS include + REQUIRES riscv "${legacy_reqs}" + REQUIRED_IDF_TARGETS esp32h2) + +target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32h2.peripherals.ld") diff --git a/components/esp32h2/test/CMakeLists.txt b/components/esp32h2/test/CMakeLists.txt deleted file mode 100644 index 78352046b0..0000000000 --- a/components/esp32h2/test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -if(IDF_TARGET STREQUAL "esp32h2") - idf_component_register(SRC_DIRS . - INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} - REQUIRES unity test_utils esp_common mbedtls - ) - - idf_build_set_property(COMPILE_DEFINITIONS "-DESP_TIMER_DYNAMIC_OVERFLOW_VAL" APPEND) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") -endif() diff --git a/components/esp32h2/test/component.mk b/components/esp32h2/test/component.mk deleted file mode 100644 index d2183390cc..0000000000 --- a/components/esp32h2/test/component.mk +++ /dev/null @@ -1,4 +0,0 @@ -# -# Component Makefile (not used for tests, but CI checks test parity between GNU Make & CMake) -# -COMPONENT_CONFIG_ONLY := 1 diff --git a/components/esp32h2/test/digital_signature_test_cases.h b/components/esp32h2/test/digital_signature_test_cases.h deleted file mode 100644 index c3f792a703..0000000000 --- a/components/esp32h2/test/digital_signature_test_cases.h +++ /dev/null @@ -1,166 +0,0 @@ -/* File generated by gen_digital_signature_tests.py */ - -#define NUM_HMAC_KEYS 3 - -static const uint8_t test_hmac_keys[NUM_HMAC_KEYS][32] = { - { 0xe9, 0x6b, 0xb6, 0x8c, 0xdf, 0x02, 0xb3, 0xbb, 0x30, 0x6e, 0x3e, 0xde, 0x4d, 0x06, 0xd5, 0xa6, 0x5a, 0x1e, 0x22, 0x72, 0x60, 0x51, 0xf2, 0xdc, 0x3e, 0x1a, 0x97, 0xbd, 0x85, 0x9e, 0x1f, 0x4b }, - { 0x2a, 0x0d, 0x2e, 0x90, 0xd3, 0xd8, 0xb5, 0x90, 0xbb, 0xad, 0xc1, 0x4b, 0x97, 0x17, 0xc8, 0xb0, 0x4a, 0x5d, 0xb0, 0x33, 0xcc, 0xcf, 0x1d, 0xb7, 0x1d, 0x54, 0x59, 0x4b, 0x65, 0x77, 0xca, 0x31 }, - { 0x17, 0xd2, 0xac, 0x49, 0xd0, 0x02, 0x4f, 0xa8, 0x50, 0x68, 0x4f, 0x26, 0x07, 0xab, 0xa4, 0xf2, 0x7a, 0x55, 0x93, 0xa9, 0xd8, 0xf3, 0xf4, 0x8d, 0x66, 0x1a, 0xd9, 0x47, 0x05, 0x8c, 0x3d, 0xc5 }, -}; - -#define NUM_MESSAGES 10 - -static const uint32_t test_messages[NUM_MESSAGES][3072/32] = { - // Message 0 - { 0x61a4307a, 0xb5212a2d, 0x8ce4edab, 0x41aee467, 0xbb0f04e1, 0xc401caba, 0xc15314af, 0xa77dd076, 0x40737bcc, 0xdc2337b4, 0x960d5e6e, 0x246f04cd, 0xa797ced0, 0xb190f869, 0x2265d916, 0xed9b5a7c, 0x8b517b85, 0xfbb2f9b6, 0x1e9dac5c, 0x1d11f51f, 0x711c4768, 0x3673409e, 0x7d53947a, 0x394b4c1e, 0xa104f8dd, 0x052b1228, 0x1d2fdf2d, 0x4adae364, 0xbe6e9af4, 0x1464ab12, 0x21b893d7, 0xa86b0b4a, 0xadd9f352, 0x7cf85150, 0x81ed50e1, 0x9f222ba3, 0x3e7c11e8, 0xd33968dd, 0xad0a2bc4, 0x99d821ba, 0x766254d6, 0x374f7b9d, 0x1b42bfc4, 0x4056202b, 0x9f99ade0, 0x64992ccf, 0x83b63a2c, 0xc258dcda, 0xdfcfba84, 0x1838733e, 0xd4ecd0f1, 0x3bce6ed0, 0xa2e9cd31, 0x4dfc7fa3, 0x2ddcf100, 0xcdb55d7f, 0x4471fc6b, 0x61bd72ce, 0xb03c1b39, 0xda9819fe, 0x24867d1e, 0x11d5f0be, 0x8dc55f04, 0xfe2324bc, 0x6baaa09a, 0x917df79b, 0xa7e15752, 0x66b2fb81, 0x35645306, 0x79e9dc02, 0x46db9117, 0x5ad04c28, 0x168399cd, 0x6f840a76, 0x9b312a32, 0x12457c89, 0x67381a7d, 0x1e6b4553, 0x2f0565c3, 0xaff56d33, 0x31b11b26, 0xc7a0a0f6, 0xe7621c2f, 0x73682d12, 0x2d66bffd, 0x0f987b3a, 0xb8e160c0, 0xc9938786, 0x10f5c069, 0x466d6b2a, 0x7707751d, 0x09a13317, 0x0b38216c, 0x357c2702, 0x992ca210, 0x6b243a1f }, - // Message 1 - { 0xd42ba4c2, 0xb72ba863, 0xf8a41113, 0x6bb4083a, 0x47f6f6de, 0x5dbe9651, 0x9d73e657, 0x81162f15, 0x09fca18e, 0xa74f5812, 0xbae98d6f, 0x2ff600dd, 0x983c0943, 0x3592cb5c, 0x81522349, 0x5641adda, 0x0207b8a7, 0xa17e00e5, 0xc826e303, 0xca0a8485, 0xb3c2998e, 0x086ff876, 0x2fcbfe2e, 0xf7089b8c, 0x8663f17d, 0x50a0387d, 0x2de358c1, 0xcfaf96d2, 0x8939037b, 0x14745d7f, 0x1ab6f3c6, 0x72dfbcfe, 0x931983a3, 0x1a336770, 0x5051932c, 0x5917b474, 0x03b7cdd9, 0x8e5d0641, 0x138881c2, 0xe369136f, 0x96281950, 0xe3c47787, 0xae0009db, 0x9b3b5127, 0x38a5189b, 0xf6ad7f13, 0x3786a34a, 0x6ef328a6, 0x3777aa66, 0x22a9bde2, 0x4e9717bb, 0xbb642837, 0x5a188508, 0x5728e9ff, 0xdce1bc9f, 0x55300b1e, 0x64820e38, 0xa21607d0, 0x7c7745f2, 0xdfb33bdf, 0xef386298, 0x0ba814ac, 0xb6a14369, 0x810f036e, 0xe78a321b, 0x23d4a745, 0x73a99f61, 0x2638d9b6, 0x11ab8653, 0x75c6739b, 0x1a8dcd5a, 0x7d7c168b, 0x7e2da09c, 0x84c82b0a, 0x7db3fad2, 0xb253751e, 0x1b5c5741, 0xb76c407a, 0xdeadf688, 0x47844f16, 0x42de3462, 0x462feadb, 0xeadf6987, 0x86a75e14, 0xcc225702, 0x746a1aa9, 0x879d526e, 0x93bfce3e, 0xa5ce21dc, 0xf7339d30, 0xe2a5ef53, 0xaff1baf1, 0x5990e0c4, 0xa3469c61, 0x0a6955d2, 0x9e4c5662 }, - // Message 2 - { 0x2f4095ca, 0x8efe451c, 0x7da3dfb1, 0x7345ee0e, 0xec6f3731, 0x7a0c52c1, 0xba9fdd4c, 0x6c92569c, 0x908189ce, 0x57a5d1ab, 0xacde22f1, 0x4e142237, 0xcbad527c, 0x82285cf2, 0x465e0d1b, 0xe1da157a, 0x9d97cecc, 0x99aee64c, 0xe5bb298b, 0x1e92985c, 0xb6cff476, 0x80249bf9, 0x96cf733d, 0x282a6055, 0x550d73b2, 0x7bb152fb, 0x9b408e06, 0x959a573f, 0x8d0cd0b6, 0x9fd0bf0f, 0xdcdc263b, 0xab2dd3c0, 0xf11ade9f, 0x5b9cad6c, 0x7b97b69c, 0xa794737f, 0x479259b6, 0x137703df, 0x6579045d, 0x66836a98, 0xf53ab66f, 0x6c94f3ac, 0x4d809db5, 0x42c875d4, 0x3a4fb6ce, 0x712bb0ce, 0xf4c70c20, 0xfb637da4, 0xb8bc930c, 0x7aec739a, 0x7e12fa26, 0x693409b4, 0xd677a39d, 0x75f1d20d, 0xd02599fb, 0x12c66e6e, 0x40fc6f76, 0x8680a9e2, 0xa634cbe1, 0x84315b4f, 0x552af83c, 0x2e03d541, 0x209487ca, 0x232acc4e, 0x625cbae5, 0x96671538, 0x9a93a5ee, 0x4e3f94c4, 0x5e10627d, 0x427738b7, 0xc3de7dce, 0x52d78deb, 0x28c0542b, 0x2b806fff, 0xf378ea2c, 0xde81e1a1, 0x505bdd67, 0xc59decea, 0xdbc2be17, 0x2ac69402, 0xb61bd2f2, 0x77b8e289, 0xf2183444, 0x6d2000a9, 0xaadd9a42, 0x31d5779f, 0xf5f2d425, 0x7d40e97f, 0xf7856359, 0x7e470cdc, 0x24734042, 0x12e2ddf4, 0xf01a797c, 0xdc4baefc, 0x4a7c042b, 0x7396067e }, - // Message 3 - { 0x917e5082, 0x13f64a35, 0x5e2270c2, 0xef2f8a79, 0xd210f3ba, 0x726f0e6b, 0x9dfe4069, 0xc1a11cc4, 0x1abd4ee9, 0xd7838339, 0xcccb8ad0, 0xaf3c82f1, 0x7f472e18, 0x9a8d8c28, 0x63aee513, 0xb4a33ddd, 0xc87813b9, 0xe88dc9f7, 0x681226c2, 0x5faa8a1a, 0xbaec0aac, 0xf47933f7, 0x784083d2, 0x12e06efc, 0xc57e7cc5, 0x16574609, 0x3ce4e167, 0x3e78f75e, 0xdb9dce1b, 0xaf865934, 0x610268f4, 0xce4279d3, 0xb51e6d56, 0x9738e007, 0xc2206e8f, 0x0c536b7e, 0x6fd1f9ea, 0x248eeb3c, 0x2bae513e, 0x8e8dd6fd, 0xd954c182, 0xae05b6a6, 0x9db3cc95, 0x8275bfdb, 0xf2727628, 0x24772152, 0x8e66cebc, 0x99846119, 0x09769bc5, 0xf097c12d, 0x5895ae15, 0x77113cde, 0x1ecdbe69, 0x62368adb, 0x715239ab, 0x4f33390c, 0xe73ba79c, 0x433c7b9f, 0xb994555f, 0x9dd7d3d7, 0x30e166c5, 0x42c1a712, 0x213376b6, 0x909eb93c, 0x428e8cc7, 0xdf0a4d1c, 0xf3c1564a, 0xd564bdda, 0xb43d7bfc, 0x2e5c60b2, 0x3ea8aa24, 0xfb3cf719, 0x78a57cf0, 0x60ed7608, 0x5ebbc190, 0x131216dc, 0x838b7b71, 0x03b95f01, 0x0ff925b3, 0x4a2cd710, 0xdcbe06b5, 0x2b5ec2d3, 0xdb0d240c, 0x8a1cdeaf, 0xed4de87c, 0x60479fdb, 0xf09531e0, 0x71c379eb, 0xb1d1218d, 0xeb732ba7, 0x7288e278, 0x3a02ee89, 0xd0165697, 0xc191ba5e, 0xe7453137, 0x488a087f }, - // Message 4 - { 0xdb9ccaa7, 0x101c5cff, 0xefc0eea1, 0xf9e22fd6, 0x2c09bc6d, 0x66520e52, 0x7da40463, 0x70de90ba, 0xa62ce3e1, 0x9a3fdb72, 0x067d95f1, 0x88ee7925, 0xfd393999, 0x08caf7ca, 0x06b09412, 0xe91e79f3, 0xf5e1357a, 0x3517bf29, 0x23f7bbc0, 0xa91489a8, 0x6b2de727, 0x9fcf3874, 0x04bd8abe, 0xf2db587e, 0x441d949a, 0x3cf2117e, 0x89b0f140, 0x8e669231, 0x2b303ce4, 0x9da0b7e8, 0x70b544ac, 0x99184be5, 0x8faa6790, 0x68a74c57, 0x4dfbf323, 0x8ad801ab, 0x2e01aefa, 0x6f18867c, 0x8cdc221a, 0x96d9441f, 0xb0d24aaf, 0xb757fb28, 0x1b6fc477, 0x8a995bf3, 0x2479ca42, 0x7592128f, 0x2c7cd48a, 0xc5234043, 0x9f74abc8, 0x0c97652a, 0x3607328c, 0xe83532d8, 0xb8f6f974, 0x6c31a52a, 0x3cd0c8d3, 0xe1589046, 0xa6c89031, 0xa49bf26b, 0x44042d46, 0xb04ebfb3, 0x4b7b9c89, 0xfada8863, 0xce3efd26, 0x3853508a, 0x10950750, 0x414342e0, 0x06aaacc7, 0xf272f1eb, 0x8edc53ae, 0xea5ecd67, 0x0eed9fa1, 0x847cc975, 0x2297295c, 0x9b2bcd4b, 0x7a4bf31f, 0x15052c86, 0x02d3df12, 0x31f26ec6, 0xd4211f29, 0x1a971126, 0x078fe6b0, 0xffc2a7f8, 0x662718dd, 0xc443497c, 0xb68ae26b, 0x71ebc3b6, 0xf3b01818, 0x6a0a1081, 0xdae6fd77, 0xb2378d84, 0x3b5a6f5a, 0xe4eee13c, 0x6aec9bcd, 0xabf2f290, 0x811d26f7, 0xcddf9619 }, - // Message 5 - { 0x514bc7ba, 0xec9e2313, 0x9009fa0f, 0x3f6b2d80, 0x4269ea0b, 0xe3c94974, 0xda55e172, 0x2dbdef26, 0x8b51ccf8, 0xa38ea841, 0x90277332, 0xd1324248, 0xb27d4f19, 0xd42fb058, 0x57365f75, 0x223269b4, 0x0ddf88a6, 0x7b34dfd5, 0xf68e657a, 0x1b48e3f6, 0x978ebb87, 0x47cbe8a8, 0xd43465d0, 0x26e98bd3, 0x2b8cd579, 0x40457d8b, 0x98ece830, 0xac71ecc2, 0xabd77ae2, 0x23d7189f, 0x0cb3f24e, 0xfb5410e9, 0x363da25c, 0xcf07f7b6, 0xf19d26ab, 0xcf014f57, 0xa7b5be5a, 0xb63eecb8, 0xb0e91511, 0x3d21a5b3, 0x1113fb8f, 0x0dcb9293, 0xd13bcfd9, 0xdfddc856, 0xdb5265b8, 0xa0eceb45, 0xfa3ae3ed, 0xef940ebb, 0x5509e00b, 0x7d5cefc2, 0xb2377a00, 0x91459512, 0xb20dd7b7, 0x13c62ff0, 0x65c0293d, 0x0a2b320e, 0x3309dac7, 0x2de3c065, 0x6c16078e, 0xf7087e94, 0x8eae3339, 0xf044f4fb, 0x71a5e6a5, 0xc7345dad, 0xf5b284ec, 0xf6e64f4f, 0xd3ef5c6a, 0x0d051a21, 0xef8d2222, 0xd65a3862, 0xdfaed1b7, 0x10845a98, 0x121580b3, 0x3683ff2f, 0x718b6645, 0x29b8ad40, 0xb32c397a, 0x243e0c99, 0x016110d6, 0x82fcc51c, 0x7ee093d1, 0xba24cbb6, 0x294d9a43, 0xa4c672d1, 0xe199d6bb, 0xb828606f, 0x799521b8, 0xe63bd4c3, 0xca8bc401, 0xc1129f2a, 0xbbd59b4a, 0xf62dccc3, 0xd087a72b, 0x916f8bad, 0x05f80a48, 0xa9480b32 }, - // Message 6 - { 0x494c801a, 0xa09ccda5, 0xfd5cb1c2, 0x88a8c119, 0x1852fb99, 0x19c3e694, 0xb770300c, 0x81093aa0, 0xb987a3ab, 0x3672c0a9, 0xd8872294, 0xcd50e454, 0xd1e9e591, 0x0778a92c, 0xbada7e07, 0x730e6259, 0xadae6a0d, 0x440e2070, 0x08dad2fc, 0xf1a96af7, 0xe428b615, 0xd23e850a, 0xc7f9a60e, 0xd869daa0, 0x2b3c5fb8, 0x6664cbec, 0xd536e058, 0x2d377701, 0xe0e0e61e, 0x013c8780, 0xd2ba05f3, 0x9bc986cc, 0xf53bede9, 0x94f90e30, 0x9078cd05, 0x77c3fe5b, 0x38b2524b, 0xfc08a5ad, 0x43c2472c, 0x08e7091a, 0xfb00cdc5, 0xf57f7940, 0x54a949d1, 0xae121dea, 0x7a4d34a6, 0xc846b5d0, 0x107f5048, 0x2d813cd4, 0x751763ca, 0xf0d5beb8, 0x5f3ad34c, 0x20e8fc89, 0x522c0565, 0xb194d078, 0xd51ac55e, 0xee2985b0, 0x953eefec, 0x132f3a42, 0xa14f85e4, 0x46d27a84, 0x9790f7cd, 0x8aae4363, 0xe75f0459, 0xeb0b52d0, 0xd7dfcc60, 0xf8c1ea78, 0x195f61a0, 0x0f2218cd, 0xcf17bab6, 0x9c722da1, 0xf1f17460, 0x20f46606, 0x57223ec4, 0x449d58ca, 0xff071cb1, 0x50d0edf4, 0x2ed1158e, 0x99a06dcf, 0x4daaba52, 0x573a0d0d, 0x6c2fdd8b, 0xef355b86, 0x36745f16, 0x75c42a43, 0x566d8af8, 0x413ebf65, 0x5de5ea4d, 0xeaa02349, 0x0ea60c11, 0x3a779ea5, 0xdafe3ce0, 0xf28e6fb9, 0xba7e6fa2, 0x22c925fa, 0xb63e84fb, 0x74d93772 }, - // Message 7 - { 0x69f9ffe8, 0xd22f7c25, 0x79065655, 0xf09506f0, 0x0dcaada3, 0x190d979d, 0xa9e3d839, 0x56a52414, 0x48e21087, 0xf690f111, 0xd8e93abc, 0xbe911856, 0xe3b33a9a, 0x59035a1f, 0x59ba75db, 0x107e7069, 0x4dc0194c, 0x73a51c6b, 0x31cae97f, 0x31ba2b36, 0x9858ea6f, 0xc02382ff, 0x78ef5e5f, 0x540bc7e2, 0x46124c1c, 0x133cd8f3, 0x4268cf6f, 0xd03cc223, 0xf1369f9d, 0x5c2871ed, 0xa54c7a14, 0x06060e04, 0x0753412c, 0x89930b2c, 0xc3ea6dd3, 0xc2bef1aa, 0x9d6e1712, 0x9dfb04c2, 0xffc4f029, 0x844b9259, 0x61e085f8, 0x93489ab8, 0xc9179a28, 0x91aefe31, 0x440cce1b, 0xaffdb58c, 0xdd4c2396, 0x129bbc33, 0x1197fb6d, 0x71591bcc, 0x3c34583f, 0xfb7bcb45, 0x6a4b7055, 0x9439edcd, 0x403b8265, 0xf82a62ce, 0xe818f724, 0xd3bee15a, 0xeefde890, 0xc67633d4, 0xd5aee450, 0x4f2531ba, 0xbd9ae480, 0x676d8974, 0x7a6c66a5, 0x94c11dbd, 0x96185d05, 0xc8240d13, 0x3e2f71a8, 0xc0f48541, 0x58657c9c, 0x7117c02c, 0x81f97568, 0x3b9f9324, 0x126b1eec, 0x9c6afa89, 0xb7e0c2b0, 0x066a98b4, 0xa044889a, 0x37d75335, 0x4c4af22d, 0x13a966ef, 0xb2c9f746, 0x6a0238e8, 0x2f3650ea, 0x15255ebe, 0xcdc9219f, 0x57cc4731, 0x45b418dc, 0x689b83e6, 0x1f698a54, 0xf00fe258, 0xe665c56a, 0xb8913b96, 0x479bc689, 0xdbc22e55 }, - // Message 8 - { 0xf6276e70, 0x66175bff, 0x5352db45, 0x589ce506, 0x0f8821f5, 0xf08a7087, 0x508979d4, 0x5915500d, 0x96630de6, 0x014cd96f, 0xd48782dd, 0x5494ce5e, 0x2ee1fcfb, 0xab5ae079, 0x329ae541, 0xe09c757b, 0x74cb7c3d, 0x559bc3a7, 0x899be412, 0xb42bd267, 0x4fe60b17, 0x6acc9548, 0x571fcc95, 0x0420fab0, 0x982c7e9b, 0x204b3e31, 0x6e49f901, 0x66f66051, 0x0dcf227e, 0x54ca1e05, 0x2ece5977, 0xc98c4c54, 0x1999905b, 0x46a76b16, 0x9cce2830, 0x5fbd426f, 0x4aa54653, 0x559e5562, 0x9a484b54, 0x964e2b62, 0x1f2ce639, 0x7c308105, 0x483dfe3d, 0x5e8278d5, 0x9bfde6ab, 0x58a466e3, 0xcd3c33e2, 0xc5c68cd5, 0x8076bac7, 0x75d7ce6e, 0x01314880, 0x6a3ab61e, 0x09507c04, 0x2aad35f7, 0xe69895bf, 0x36b0e62c, 0x1534c2e1, 0xa192c033, 0x0534d073, 0xa26b9b81, 0xa776054b, 0xcf85a32a, 0xf2f76ef6, 0x3e9e5459, 0xb9073de2, 0x19b00868, 0x66fa788e, 0xaa151666, 0x2a1f9770, 0x45febf07, 0x35dfa9d2, 0x2c2c2364, 0x3d0f30e3, 0xa277a43d, 0xfa1d0296, 0x92a74586, 0x93234057, 0x34c73d7d, 0x48666cde, 0x8211d309, 0xad94ff6c, 0x182e45fb, 0xcfa79f8a, 0x2bc42037, 0x7ae67f1d, 0xacaeb046, 0x864dd151, 0x6520b840, 0x5eec3d72, 0x14e72fbd, 0x5baa6f5f, 0x27e4b1bc, 0x41aad9c0, 0x141a142f, 0xfd93c63d, 0xcfc1535a }, - // Message 9 - { 0x8dd5880e, 0x371a498f, 0x9c9add0d, 0xe0ea7d41, 0x4e681a70, 0xd89e0df2, 0x9514abee, 0xfae87315, 0xe837bca6, 0xefb89823, 0xfbd03997, 0x72ad1146, 0xd85eeaf1, 0x3e5937c4, 0xb289f36b, 0xe5ba0477, 0x941170c2, 0x29c4617e, 0x91a045b3, 0x8a39d1e1, 0x3bc8eccb, 0xf99a1c51, 0xf0a1013f, 0xa9c84292, 0xd1e408b9, 0x4da26c40, 0x6c779e64, 0x18d53c20, 0xea79910c, 0xe3f0e389, 0xfd5e7594, 0xf924df1a, 0x8fab41a1, 0xb33600c9, 0x27ceeefb, 0x05a78307, 0x9df2d704, 0x9532c917, 0xfefa2582, 0x08e96dd8, 0xd1c5d4f6, 0x27bef73f, 0x508bc2d6, 0xd60a4f64, 0xc1622da0, 0xbcbb3aeb, 0x46c744e7, 0xb5af204a, 0x737c5613, 0xcb0e4acd, 0xa87b8965, 0x7e9f690d, 0xe6ab511c, 0xd78db0ef, 0x8d2a1884, 0xf95e5133, 0x390da241, 0x3bc7d270, 0xbf649fe2, 0xfd7f7260, 0xd7bd94e2, 0x2d48ceef, 0xfa003bc0, 0xd2402937, 0x3086edd9, 0x87ac55e7, 0x2e222391, 0x6b46026e, 0xc565a1ad, 0x8a661112, 0xdda0ca66, 0x1ec8dd90, 0x471ad908, 0x72cc1e54, 0x35f4ba32, 0x0d6d07bf, 0xe71cdea3, 0x0f3620c3, 0x4132109c, 0xd768ec23, 0x4305a50f, 0xf4ed7e87, 0x8feded34, 0x806768cd, 0x36ab3075, 0xf857b88c, 0x75a2b697, 0xbdce1b38, 0x1155c510, 0x7c9d47ec, 0x2da88b4e, 0x8f255163, 0xc4e89a53, 0x99f8a3f9, 0xc14c117c, 0x8d432198 }, - }; - - - -#define NUM_CASES 5 - -static const encrypt_testcase_t test_cases[NUM_CASES] = { - { /* Case 0 */ - .iv = { 0x8c, 0x1e, 0x77, 0x16, 0x72, 0xde, 0x6d, 0x20, 0xc8, 0x7f, 0xaf, 0x73, 0xe0, 0x37, 0xc0, 0xfa }, - .p_data = { - .Y = { 0xcb5c62bd, 0xd53c02b1, 0x3ff33d74, 0x1200c344, 0x1d108bb7, 0x8ce3b02b, 0xd13c8ca8, 0x37f0a4d2, 0xbd5e2ba7, 0x16140ed0, 0x97e0e6d4, 0xc836e5d2, 0x09df3eb2, 0xf75921b9, 0x60c424b2, 0x5f29ac5f, 0x49b8713d, 0x4342a66a, 0x1bbc6329, 0x8f865f04, 0x5f5f6cd6, 0x1b233a09, 0x3d3d4b7f, 0x938e5a81, 0x02c343f6, 0x71c002c4, 0x4ad10fbf, 0x4f68429f, 0x68ea660c, 0xe4e9bfc8, 0x9a885e24, 0x22dc593a, 0x123509bd, 0xa8d8036c, 0x5a1ee67a, 0x577524cc, 0x1578f6e9, 0xac7b122a, 0x45e75817, 0xd33d73bd, 0xfd8caa5f, 0x3dd84eac, 0xcb21e71c, 0xb6df0faa, 0xb7c2b2cb, 0x5a35badc, 0x506a1282, 0xa23779cc, 0x1939e0d8, 0x89ac87f8, 0x396cc952, 0x21102ece, 0x1e84e5e3, 0x0dedaa06, 0xc6a0cac1, 0x35f934c8, 0xc139d9de, 0x8db949b9, 0xd26fbd54, 0x866c7375, 0xc542b4ca, 0x9de85700, 0x47ceb667, 0x9048c459, 0x2d60f706, 0xff980fe9, 0xb2bc5851, 0x14233375, 0x78e4a2b1, 0xc4503859, 0x6abe5255, 0xcca9ea15, 0x9f9f3377, 0xa0ecf4bf, 0x8c93078f, 0x6585711a, 0x2f3a0069, 0xb419fa34, 0xafadcf0b, 0xe575d179, 0xf865674c, 0x762cc0ba, 0xee40bf05, 0x196a5562, 0xd46fa34e, 0xeb7169da, 0x6893b021, 0x7a4ba5e4, 0x17acd406, 0x29ee794a, 0x6d097841, 0x34833d52, 0xaba7728c, 0xa2b178b2, 0x572415e2, 0xae9d2ed6 }, - .M = { 0xa7c8dae9, 0x71a084ba, 0xc46ffe34, 0x8c4ce331, 0x3f8606aa, 0x13823ea1, 0x79b9b2d6, 0x7fb2ed35, 0x1c75a92a, 0x76cbdbe2, 0xa00a4b52, 0xbbbd1697, 0x42b94063, 0xf5729322, 0xc836cdc0, 0x5a102597, 0x28dd02bd, 0x6d1649f2, 0x6374b255, 0x87f5d4d5, 0xd982d456, 0x6805284d, 0x90e3dfa0, 0xc14ea883, 0x369118c1, 0x12d6dbb0, 0x1bd106c8, 0xe9c145e2, 0x55574baf, 0x7fae64cb, 0x7c7829d7, 0xf19706f6, 0x9d7cd9a0, 0xfe5d7592, 0xf5057fe5, 0x3c24c781, 0x6d71749d, 0x0f4b3737, 0xc1136ea8, 0x15d3a3e0, 0xec5b80b3, 0x77973840, 0xb32dfcc1, 0x7f9dabf3, 0xa06a36dd, 0xa9a03bef, 0x7a606b52, 0xebd0936e, 0xabe211e7, 0x28b6df1f, 0x6f9b2092, 0x1be829fd, 0x3694097c, 0x0dc7cf28, 0xb73bf1df, 0xe6fb9628, 0x37351f75, 0xa61d0558, 0xba4c504c, 0x99196a13, 0x66b9ab4f, 0xabf2f08b, 0x4690e911, 0x86f7eeb0, 0x7986318a, 0xee525553, 0x8add40d6, 0x39d97958, 0x9bf0ebf8, 0x6f22c0f9, 0x9598e2a0, 0xf4709b61, 0x5016506a, 0x97d8127e, 0x023ff5d9, 0x71ace674, 0xc4e8333f, 0x99229a97, 0x80b48469, 0xb7687043, 0x5c0e7f79, 0xb7bc5d93, 0x5e504759, 0xffcfe533, 0xf254e419, 0x97212c42, 0x84fad815, 0xc8f7fcff, 0x9afbce0c, 0x898d1dd8, 0xe0ef661c, 0x5bf211b6, 0x76957689, 0xf58f1cfa, 0xeed49187, 0xb8572ec1 }, - .Rb = { 0x0b0c0a87, 0x07b0c5bc, 0x7be65940, 0xca7a734a, 0xbfc8755c, 0xa60e7eda, 0xd51cf3a5, 0x72d93c93, 0x72b0b01b, 0x6edc70c5, 0x192bdc52, 0xece987d8, 0xf3bd040f, 0x6f207f51, 0x50fb8317, 0xde12f201, 0xc5c4d0e5, 0x9a10baec, 0x13346985, 0xac32b264, 0x26db361b, 0xd9a19acc, 0x4ba7c94c, 0xde1ed00f, 0xaebf5e7e, 0xba0f20cd, 0x72f98543, 0x46f58f13, 0x0256c157, 0x1061058a, 0x17fcf0b0, 0x6ed62849, 0x8824c840, 0x1ad89a36, 0x62d01765, 0x7a74e8b1, 0x8e9c9fc1, 0x0cd312bb, 0x8e9792a1, 0x139fca5a, 0x14244d65, 0xcf734148, 0x336ecd8d, 0x52ce8c79, 0xa0b00234, 0xeb55c35c, 0x628c54ea, 0x2f2f5422, 0x7edbfc76, 0x43648965, 0xe04dce82, 0x13571757, 0x35b910fa, 0xc6d47cb0, 0x372430a8, 0x6be40069, 0x8553cc57, 0x5ab4a818, 0x9a234115, 0xba12e97e, 0x12302dee, 0x375f38c1, 0x3f797af3, 0x7419b1ba, 0xd8a692d0, 0x17a82e77, 0x19516428, 0xfdd32e14, 0xc0ce5186, 0xb5f01ce4, 0xcba43ead, 0xb740ffea, 0x3733443e, 0x06929405, 0x402bcbbb, 0x49fb85aa, 0x0a6d4e67, 0x02e6f076, 0xdf554141, 0xdebcc8c9, 0x563c65c9, 0x76c3d2bd, 0x64accd63, 0x83b3818d, 0x56ecce2f, 0x6ab3bc17, 0x6f616fc6, 0xf6b90a98, 0x305e988d, 0xd74bde1a, 0x987e3a31, 0x02454625, 0x8e9b7930, 0x1c1e1282, 0x508abff4, 0x09156acb }, - .M_prime = 0x734c62a7, - .length = 95, // 3072 bit - }, - .expected_c = { 0x79, 0x0a, 0x62, 0xe5, 0xd4, 0x1d, 0xee, 0xc4, 0x99, 0xbf, 0xce, 0xd8, 0x89, 0x16, 0xbc, 0xa7, 0x09, 0x62, 0x48, 0xd1, 0x69, 0xbc, 0xd5, 0x0c, 0xb9, 0x62, 0x2d, 0x9f, 0x32, 0x15, 0x6f, 0xef, 0x87, 0x7b, 0xcc, 0xab, 0x6c, 0xf3, 0xd2, 0x52, 0x3d, 0x49, 0xfc, 0x99, 0x36, 0x3f, 0x61, 0xc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xc2, 0xdb, 0xd0, 0x84, 0x46, 0x0d, 0x71, 0x1d, 0xb7, 0xc5, 0x42, 0x9a, 0x62, 0x76, 0xdd, 0x22, 0x7c, 0xad, 0x18, 0xc3, 0xa2, 0x8c, 0x3f, 0x53, 0xcd, 0x36, 0xa9, 0x2f, 0x00, 0x15, 0xf2, 0xb9, 0x6a, 0x19, 0x5d, 0x09, 0xe1, 0x2d, 0x39, 0x52, 0x42, 0xbf, 0xfd, 0x6a, 0xc3, 0x27 }, - .hmac_key_idx = 1, - // results of message array encrypted with these keys - .expected_results = { - // Message 0 - { 0x0152da3a, 0x762a3fb4, 0xbe18cd88, 0x3d967ed4, 0x5b51fe39, 0xd688fd48, 0x216459bb, 0xf15f9b19, 0xed7e7a43, 0xb59e8bf9, 0xddcf8efa, 0x8974a335, 0xa6d9f07d, 0xd290dfbb, 0x20fa81e5, 0xfb87a847, 0xbbf4ea09, 0xde3efe67, 0x1158d712, 0x966753a8, 0xafb2bef2, 0x969edb98, 0x379f3714, 0xbe0f2773, 0x5c044d39, 0x16b3d605, 0xc792f51a, 0xf693960a, 0xbd7417b7, 0x59f4a22e, 0xada4823d, 0x4c74246d, 0x25a5f973, 0xd7e1dbe7, 0x6e816a19, 0x7bcbb461, 0x9011a1ac, 0x2952b70b, 0xc8d8666b, 0x2a04c3f7, 0xfa147ccf, 0xe9459bd7, 0xe408d45e, 0xd468b0c0, 0xf415e1e7, 0x334447e5, 0x8bebf8a1, 0x6a63ed9b, 0x0714a200, 0x686bb29e, 0x36ff6788, 0xc1dc1d69, 0x11583bd8, 0x6c39ef9b, 0xa92fa313, 0xf550b0eb, 0xa1a156ff, 0x80d7e7b2, 0xcde26f16, 0x22efc91e, 0xdf15a305, 0x3c6f8e9d, 0xc1b917f1, 0x0a990e14, 0x1241d963, 0x84324a11, 0x293de186, 0x3397810a, 0x734a3412, 0x720cf85f, 0xdaa30a9a, 0xa9f264bf, 0xcc70302f, 0xc658df8e, 0x21ded10b, 0xee91e6ec, 0x036c322d, 0x6cbe3667, 0x5319bc7b, 0x65acbb71, 0x428909ad, 0xe5a7e82d, 0xddd4c6b7, 0x4c6386f5, 0xb9ab70c5, 0xcaea7aa7, 0xcc13e5c4, 0x7b8e2a2e, 0x1fdaac8b, 0x2705b4f2, 0xa9b52c45, 0xd48a48b3, 0xd73295ac, 0x87b8dd20, 0x1f06402b, 0x765f9413 }, // Message 1 - { 0x8077eb25, 0xc62c9c39, 0xbbcc7919, 0xfbfafb2d, 0xd982d6d4, 0x4b977932, 0x4a8b5e13, 0xbcecd12b, 0xbf5a6672, 0xdeca4148, 0xe1893c41, 0xdda9da85, 0x3e478184, 0x9347e998, 0xf91cb596, 0x9664403e, 0xa9af3d0e, 0xe8d4174a, 0x1337d4e4, 0x2f9abb33, 0xb555944e, 0xf13ed7f9, 0x0c452217, 0xe3645109, 0x700695bd, 0xff8be175, 0xa3bab12a, 0xdbbcb8a4, 0x649d8c07, 0xd893e155, 0xbee8794d, 0xd764d2e2, 0xbad59a02, 0x125b1fe4, 0x9868d2ff, 0xb566a3fe, 0x529fb57a, 0xccf451ff, 0xc9d1fbf6, 0xec04749d, 0x125fe6c8, 0x8b32df5b, 0x5b873af1, 0x70ddae64, 0xf6f2c57e, 0x6ddf32b0, 0x5f83a7d6, 0xeb398393, 0xdb51e800, 0xebff95bb, 0x6cab049d, 0xcd3f5f6b, 0x3d441da1, 0x634b1c3d, 0x4dd51125, 0xdaa05beb, 0x93463e72, 0xfac8212b, 0xf1d6c8dc, 0x8b355695, 0x4a705864, 0x3aaf7a11, 0x104d5e39, 0xc86c818d, 0x43077ee7, 0x3cbecedc, 0x2b86d315, 0xd5cbdba2, 0x45de03d0, 0xe6476a9b, 0x0155eae7, 0x96e9d7f3, 0xac879021, 0x4da64539, 0x362cf772, 0x98048ddd, 0x5d280243, 0xe9c86210, 0x07d0ba70, 0x4b64ccff, 0xaa6d6a29, 0x0900d999, 0x15930af3, 0x1278e322, 0x1f677625, 0x7a5bc43b, 0x42c7b5e3, 0x49d63815, 0xc9329722, 0xa5a64ce7, 0x64b5c1bb, 0x7d151b58, 0xebd4f665, 0x14ca6c0b, 0x819a6b2e, 0xb72dfc7c }, // Message 2 - { 0x558e22e3, 0xd8edebfb, 0x38cc66ce, 0x2e6cbd80, 0x2ec77f97, 0x6bcec9e2, 0x91661ddc, 0x80e32b38, 0x1f94bf8b, 0x6157a4a5, 0xd100e201, 0x81fffff4, 0xddbb9eee, 0x09fedb2f, 0x47fe3ee5, 0xb427bc06, 0x2d10a486, 0x12a7784d, 0xafa90127, 0x126b18ff, 0x1a050f33, 0xe499ff25, 0x746f6018, 0x803401ca, 0x3e5d290d, 0xba3f3534, 0xc881eb09, 0xf3deacd3, 0xe8da79da, 0x6ef25f62, 0x302d510b, 0x6460e529, 0x4aac9523, 0xc13f91a0, 0xbb4ff974, 0xd5c68ace, 0x1d07f6f0, 0x16caf5a9, 0xaa357735, 0x0e500544, 0xf888c7d9, 0xec671fc1, 0xb1a504bd, 0xa79ed820, 0x1ec78fed, 0x2db92ae9, 0xbe4833c5, 0x626adae7, 0x121fe1cf, 0x775a7881, 0x05cf904f, 0x1a68383b, 0xf679796d, 0x03f9a0cf, 0xd9b86d31, 0xc9112623, 0x01590134, 0xece0776d, 0xb995e4e2, 0x5f239fbd, 0xdf8d6c36, 0x80e0e042, 0xfbf57182, 0x52c264c5, 0x2f8268e2, 0xf3101f03, 0xc35237b8, 0xbe454c1d, 0xf12b7934, 0x44820788, 0xb5567721, 0x2b82b89a, 0x9025777f, 0x635a6c3d, 0x8da8efc4, 0x19ad36d6, 0xa9483b52, 0x2fe22d20, 0xd0cc5ae2, 0x799ec6ed, 0xf9c10037, 0x9056b2d3, 0xe9167d9f, 0x59e5ebf1, 0xbf1fcc16, 0x68e24b99, 0x9e514702, 0x0b1bda00, 0x8e7f26f9, 0x8a16423e, 0xf00a5c52, 0xb27420e1, 0xf7a75042, 0x28256923, 0x93a53d97, 0x593cc811 }, // Message 3 - { 0x58f14e9b, 0x3fba7d61, 0x7e56cf0a, 0x369f6bab, 0x1d562f95, 0xa5a16fc7, 0x8b8e78a4, 0x6a1fb20a, 0x427a1217, 0xe4f43fa5, 0x0bcbabea, 0x44e36fb5, 0xd7d09291, 0x8e589fa5, 0x723abb94, 0x90e765b1, 0x02a10201, 0xb4903db1, 0x0e7bcaad, 0x09a55b67, 0x7ca80a5a, 0x57856c50, 0x834a4547, 0xb5725470, 0x5d9db382, 0x6f653814, 0xa9c1d0d8, 0xc5e0972f, 0x10df3c95, 0xdac2a46e, 0x3574fe39, 0x15648781, 0x0a0784ce, 0xd14437f0, 0xebef4e4b, 0x0916cf82, 0x76d78cd9, 0x6ea3f595, 0x18b439a6, 0xb7229141, 0x5321d899, 0x34b02c77, 0x47ecdd63, 0xbc16e256, 0x360b6334, 0xe066a8b7, 0x9bede8cd, 0xe2f1bdf9, 0x9bb126cd, 0x09ac638e, 0x1ebeef58, 0x43a5d3c9, 0xfffe03ad, 0x683b60d0, 0x53f89ad4, 0x00b28ffd, 0x22a3acdc, 0xed9edac6, 0x600e298e, 0x73c8dada, 0x31f85658, 0x4acf41fa, 0x203d273d, 0x1977aa0e, 0xe7bebe57, 0x4ce59323, 0x22af2296, 0xec5b4f6a, 0x2ef02644, 0xb57f95f0, 0x4fade369, 0x8b3ccb6c, 0x859bfea0, 0x56515fbb, 0xe977fbd6, 0x4603afe6, 0xfc521d22, 0x8305f598, 0x9f53a6de, 0x9a50a8ea, 0x88904d85, 0x13a86af8, 0x92f029a1, 0x9ee876ad, 0xd731df69, 0xdf4b1f8a, 0x692c9413, 0x1d491c34, 0x28cad0fa, 0x62f6c20d, 0x2a18c38d, 0x4dc863b6, 0x59925352, 0x526cf074, 0xe00a7509, 0x4f74348d }, // Message 4 - { 0xecfe784b, 0xfa59d270, 0x5e4d4ac1, 0x0f0606f6, 0x8a99b1ee, 0x3fdfd931, 0xbfdab1ca, 0xa1b8750b, 0x213e5637, 0x0b6a3d12, 0xaab1ae85, 0x21152bba, 0x5bdfbdcb, 0x03a9fef9, 0x3c0f0cd9, 0x9325218a, 0x468cdb2a, 0x0a19b778, 0x09c9bfea, 0xb8141c74, 0xaa3746d8, 0x387a3742, 0xc0e4f644, 0x0c3e8166, 0x518aa2d1, 0x6b820e82, 0xe135a093, 0xce1aed91, 0x6ea1480f, 0x01b000dc, 0x730ee892, 0x356b8854, 0xc7129c58, 0xe1905c79, 0x149efc33, 0x1a4af6c8, 0x78efea46, 0xceeb6daa, 0xd9a93aba, 0xcf124636, 0x4681b414, 0x2dbd5a38, 0xa77427d4, 0xcd198cd4, 0x3454b3a5, 0xeaa21411, 0x5ea7f58b, 0xd24c4bcf, 0x2db53e3a, 0x95fe2f2a, 0x43f019e8, 0xbb3ab440, 0xf016ab58, 0xe44c835c, 0x0a7f26bc, 0x5c0f8b8e, 0x337f8206, 0x65071aa0, 0xd8296708, 0x499d520b, 0x20fa64fe, 0xc7edcc40, 0x32a24758, 0xde394108, 0x06bec3b0, 0xc6425bd0, 0xa839680b, 0x1638d3d1, 0x6597bbe2, 0xfc7efc5d, 0xf0799229, 0xadfdab6d, 0x687190cd, 0x40964550, 0xead3e3c7, 0x7c2a163c, 0x90410aa6, 0xb55d465a, 0xf1e02015, 0xbaec8b1c, 0xcac061ee, 0x1a5a0706, 0xf3196135, 0x86fb687d, 0x2201332d, 0xfaf7790a, 0x495c693e, 0x49f01065, 0x5c4c5f71, 0xb40e1f75, 0x2b97682d, 0xb4ea830b, 0xbbda4edf, 0xfe181687, 0x62ef95ad, 0x6b244434 }, // Message 5 - { 0x8df55d72, 0xdf8e36c2, 0xcd0a1de3, 0x90923396, 0x664c1177, 0x3f373a13, 0x84cc818c, 0xb31f28b0, 0x28107345, 0x792fde4f, 0x53392249, 0xf91d9e5b, 0x433b591e, 0xe47075e8, 0x49b7423c, 0x13543d22, 0x1010399f, 0x21dd53f5, 0x4b46fd0e, 0x8e5cb62a, 0xca52cf67, 0x029cb078, 0x3e9a66f4, 0x23c6f9a5, 0xa9bf7873, 0x9084b730, 0x6fe3b350, 0x8c0064a9, 0xc5bf52fd, 0x585902f1, 0x2f580c7f, 0x69bb7b7f, 0x463193fe, 0x1f6ddfb1, 0x0e4befaa, 0xaddd1e3a, 0xa8961706, 0xacf08696, 0x8767f45a, 0xde6407b7, 0xc5219c29, 0x441cc6ca, 0x7facd1ec, 0x1a8cd12c, 0x7dc451b4, 0xa4f4387e, 0x18156d78, 0x6376f6cc, 0xdb5727fd, 0x285753bc, 0x6cc53637, 0x421ef909, 0x7185bbc7, 0x43f0d844, 0x20e2671a, 0x620ac2f0, 0xf8e0d829, 0x03c20900, 0x9f6237a9, 0xac46cac2, 0xd320cee9, 0xe75f78e8, 0x63abf3d8, 0x5f7b5eef, 0x5c580db8, 0x00e028e4, 0x28b77df6, 0x5150b0ec, 0xbe411299, 0x844b884b, 0x2d085e38, 0x8f16bf08, 0xb082e459, 0xcf7df953, 0x52eb359c, 0x81168dca, 0xdf595d7b, 0xa99e0cc4, 0x056a9380, 0xec38d49a, 0xe88c1606, 0xce1a0687, 0x92a0a680, 0x71f3c08b, 0x4badcdf1, 0xa7ab2cd5, 0xd7c6ef1e, 0x0690bb38, 0xbf16994d, 0xec065761, 0x2293417c, 0x0cb8eb28, 0xff2a0000, 0x599367c0, 0x012dae17, 0x90ba84b4 }, // Message 6 - { 0xf5d4e9af, 0x7ddbf750, 0x161606d3, 0x552f5b5c, 0x32d54440, 0x1f1b90d9, 0x05346d53, 0x6617b470, 0xca904fab, 0xcf1600f1, 0x5c5274bb, 0xf9f511c8, 0x6f3e44b0, 0xa1431c4d, 0xd3e03362, 0x40f48092, 0x4d338cb2, 0x279e15a5, 0x164fd8d3, 0x28270914, 0x0bdedb1e, 0xe0dece47, 0x6abcd38b, 0x40562335, 0x8bc0cea0, 0x1a3d4f0a, 0x3e816741, 0x34f45381, 0x293853b1, 0xade0b447, 0xa128fec5, 0xf68152c5, 0xf8c0ebb3, 0xce11968a, 0x25d84d84, 0xe3e223ec, 0x04871f5d, 0xd6c0796b, 0xfad0cb0d, 0x2c5d77a6, 0x1e750819, 0x7a564e61, 0x9b136e13, 0xc2061d59, 0x7964bd81, 0x689fa374, 0xde1bc8f4, 0x3922f84b, 0x4581d684, 0x5b82dfe4, 0xeedef4e7, 0xc4c2f1ad, 0x4ccf4d78, 0xcdb83665, 0x4e7f1d77, 0xf139b6e8, 0x3f54c458, 0x9867e927, 0x4aada051, 0x198677f6, 0xa1cb7cb3, 0xd22e2ea9, 0xed6c6e67, 0xea940a8b, 0xc95217c0, 0x337d18e5, 0x92201215, 0xeb7c7763, 0x87af333d, 0x8cf7f049, 0x8ef96e74, 0x255c74c1, 0x857c7fb7, 0xc016a610, 0xe51cf39d, 0x5b0500f5, 0x34c4728d, 0x9abe58a2, 0x27f810a4, 0xe4bf61af, 0x35ed1d42, 0x7d724893, 0xe69c943e, 0xa163f9fd, 0xced20ee2, 0x5ba03600, 0x5d05e721, 0x185b4114, 0x43baffe6, 0x7fe34142, 0x569ca600, 0xfaad8f5c, 0xceb2ee6b, 0x7d53a97f, 0x12ee2fa2, 0x0f25ce8e }, // Message 7 - { 0x94b40b91, 0xdff655df, 0x2ff211ea, 0xbababd4a, 0x6fc2890f, 0x40092e6e, 0xc2ac8462, 0xad8842c2, 0x4c465b0b, 0x83567d09, 0xa0eed5c6, 0xbad2c5e5, 0x3a65f3d0, 0x69684a50, 0xd8326418, 0x42d686ad, 0x775bdf3d, 0x151e1248, 0x1046e45f, 0xc9175c79, 0x49164179, 0x32ca2f8e, 0x7d50c0df, 0xe4594e2d, 0x16bfc794, 0xf5817375, 0xe23780d9, 0x2d947950, 0x8934cb20, 0x63b9e631, 0xd8e94fd2, 0xbd432895, 0x7533c2a3, 0xe8e33956, 0x375c2d2b, 0xa7b8bc24, 0xb40f5a70, 0x20b35305, 0x064200e2, 0x7f84a8dc, 0x6fca1a64, 0x7c67c3be, 0x137bf864, 0x954292de, 0xc684108e, 0x203ea4b8, 0xbd04a57d, 0xe4889c98, 0x34c0ecb0, 0x5c10e181, 0x733c5e27, 0x3e034785, 0xd17c448c, 0x366addea, 0x99862929, 0x9200f99f, 0xc252cb28, 0x210a210b, 0xbb3fbf86, 0x4c1e3cf0, 0x4c286cef, 0x3069332c, 0xb47391dc, 0x300ecb50, 0xd8969893, 0x722c5a25, 0x9709b02c, 0x9ea45552, 0xe8e72472, 0xed3cd05b, 0x23d98e41, 0x85088018, 0x92053354, 0xc3dac73f, 0x3813d086, 0x4ac186e3, 0xe030cb60, 0xd04a459c, 0x9c7e660a, 0x3e16e170, 0xb878b8ff, 0x73cf3d27, 0xeb7ec0fa, 0xf7f41371, 0x148ccadc, 0xb7a50d86, 0x8f2ca973, 0xd1f4dfb1, 0xd80c3e22, 0x20293922, 0x73a01db6, 0x926f7a37, 0xf76b627a, 0x4204680e, 0x798e206d, 0x3f5b7eea }, // Message 8 - { 0x8461d479, 0x6207f011, 0xf750c7f8, 0xb16e20c0, 0x86f8c420, 0x355ca8c2, 0x3b4b8214, 0x39f89fb2, 0x06a90411, 0x460e58d0, 0x9e15bd12, 0x4fdcf3a2, 0x44c491e5, 0x9843cf61, 0x1d325991, 0x884302a5, 0x7d549362, 0xe1c956c0, 0x514bfd22, 0xd26a675b, 0xbdfe1a29, 0x04cc855c, 0x33f13004, 0xf7c4c753, 0x8c2367da, 0x0c1bebba, 0xe072fb75, 0x3b0bddb2, 0xee364509, 0xd2b11fdb, 0xd2b860ad, 0x277af197, 0xac8f4841, 0x32e0b82a, 0x667af41a, 0xb35e739a, 0x1fa78b60, 0xefe6d615, 0x92c2a7ba, 0x4fad1d19, 0xaabbc21c, 0x5141ffa3, 0x1c9d5467, 0x22221365, 0x81f7f3b7, 0x559357e6, 0x53ec3e09, 0x4bfbdf3d, 0x2d9ff612, 0x5e91c957, 0x336fae16, 0x574038b0, 0x9973a9e4, 0x877cab7b, 0xa07afcac, 0x77359195, 0x366b3335, 0xf78d3e7f, 0xe2b64afc, 0x2f474764, 0x11709fee, 0xf81efe37, 0xfafa7eb6, 0xedc06748, 0xabbb9c28, 0x2de89718, 0x720de58c, 0x74955261, 0xbaa726f3, 0xfaeb7bca, 0x36dd88c3, 0xff658280, 0x05bfdce0, 0x28c6b80c, 0xe03e296e, 0x0f0a714a, 0x5ca734e8, 0xd65036f2, 0xba994aaf, 0x1a28666c, 0x664c32ff, 0x81f4c33e, 0x1b3d92c7, 0xcdb03e43, 0x80d2e0d7, 0xedd40721, 0xb8b1235b, 0x2c60d12c, 0x8c7db652, 0xa3e70478, 0x90f39997, 0x6f9041b7, 0x130168c2, 0x89e29447, 0x7e7ecc8b, 0x718430d9 }, // Message 9 - { 0x52e547d9, 0xb170fba9, 0x04f4b83e, 0x1d4ca894, 0x2172af04, 0x2a255753, 0xc40671c5, 0xf7e2cc1e, 0x8186cb34, 0x455f51ef, 0xfb2fca8d, 0xe1bbd37e, 0x51b632b4, 0x9390ece9, 0x859aecfb, 0x295f3401, 0xe9d3e787, 0xf1c25b53, 0xa52f448f, 0x0afac83b, 0x9622a4ba, 0x0f0be543, 0xdb7f02ae, 0x8ae61d51, 0x81b9e719, 0x0082849b, 0x7e7f349c, 0xd27426e8, 0xce6f7bb3, 0xfee15619, 0x765c7b5a, 0xb63c9b36, 0xf0f683f7, 0xe45580d2, 0x87bac8ed, 0xa5da0c54, 0xecde7693, 0x449de9fa, 0x907691f7, 0x66fef5f9, 0x46aa0fc4, 0xfc8f1164, 0x07a4602e, 0x03ff47af, 0x40191395, 0x0e214f53, 0x2fc8408b, 0x07400050, 0xfced3dde, 0x7dcb6622, 0x374ee98c, 0xf8ea383d, 0x9549435c, 0x0c26d718, 0xf93c5102, 0x408ee062, 0xfa0ca7d9, 0xb98f419a, 0x2e60d6cb, 0x23bf4362, 0xda57b12c, 0xd706228e, 0x9f2b721f, 0xe1fd4168, 0xef042dcf, 0x1d0a4862, 0x6a5feb4f, 0xf05e70ae, 0x130c2065, 0xfda352f5, 0xd31b880a, 0x663ba883, 0x4b0423f0, 0x918ff7ab, 0x34a39cfd, 0xb014584b, 0x692cc10c, 0x32f7766d, 0x743ef57d, 0x4cb6c575, 0x244058c8, 0x9acfd3c6, 0xb7a9dec6, 0xa1183e73, 0xce1cee14, 0x98147360, 0xa83533e0, 0x00f33284, 0xb16439bf, 0xbb1ca5c7, 0x25040be8, 0x38b6a111, 0x2560117b, 0x7c4556fd, 0xa3983b01, 0x3db1afd2 }, }, - }, - { /* Case 1 */ - .iv = { 0x28, 0x98, 0x34, 0x8f, 0xcc, 0x04, 0x12, 0x70, 0x5c, 0x10, 0x9d, 0x34, 0x9f, 0x71, 0x14, 0xd0 }, - .p_data = { - .Y = { 0x0a7d2649, 0xff04a92e, 0x6daaab39, 0x2009f6ab, 0xd3c0506e, 0x1e37556b, 0x54948016, 0xba5bee4b, 0x069e25d1, 0x8b431099, 0x023823f7, 0xa79f1cb7, 0xff290429, 0x49c475ae, 0x46e3ffc0, 0xa2713a35, 0x2d4057fb, 0xc01d46f7, 0x2fb3cce3, 0x3f5df6fa, 0x954105cc, 0x2129c8e6, 0x5d336702, 0x65fc94b1, 0x1b8eecbc, 0x86f4ca88, 0x2fb5bd5e, 0x8ca29fa6, 0x49fa219c, 0x9c07ee09, 0x46624b31, 0x3a61868e, 0xbfff9cf3, 0x35d0fb3a, 0xc95021f9, 0x646d4730, 0xd71bd213, 0xf7715cb5, 0x0c9b452c, 0xf57e1d22, 0xe2970bfe, 0x28723bcd, 0x28960f77, 0x453af17d, 0xb1adc4a7, 0x3e5730d3, 0x42cbf974, 0xe7a81876, 0xaf42c832, 0x41b34359, 0xabdd44b2, 0xb52be073, 0x9075321b, 0xc4403990, 0x886cce4b, 0xe2f0cabb, 0xd9de1e3b, 0x5d044cbb, 0xbab20b39, 0x57799d78, 0x7984a95d, 0x0d2c0e33, 0x6d64c860, 0xa7d59473 }, - .M = { 0xd1ee431d, 0x59d19e48, 0xcc33d304, 0xfabdd511, 0x22b2406f, 0x2ce0ba09, 0x71f7ecc4, 0xa258c460, 0x6b8077c4, 0x8351d2ea, 0x1073137d, 0xb6a4ce18, 0x9a549663, 0x63da2203, 0xb3ccbe91, 0xc0e96187, 0x67996ce4, 0xe87d88d8, 0x6ed2da7a, 0xb2091f65, 0x3dab4d9c, 0xad5cd695, 0x1bea7884, 0x1d424f15, 0x3f221a5d, 0x930affca, 0x3076f5e4, 0xa3d01522, 0xa5ab37b0, 0xae88ce49, 0x857a962e, 0x80170df2, 0xe87bc96b, 0x07fa8734, 0xfd9fce7e, 0x07736dbb, 0xc8e52fc2, 0x05056744, 0xf104f851, 0xe6f66b5a, 0xe47c1638, 0x240c6fb4, 0x3cef51bb, 0xa8490acc, 0x5cb13fea, 0x70aa57be, 0x51fef53c, 0xd7daa545, 0xd867f233, 0xcb4630fe, 0xffe7f24e, 0xb5c7076b, 0x9a65ca87, 0xeb29bd00, 0x8ae68fd4, 0xfab6cdf9, 0xa17cf2d8, 0xa0de153c, 0x0019d70e, 0x84e7cf3f, 0x5c8c66fa, 0xdb7c2179, 0x1aeabaf0, 0xaf10bb23 }, - .Rb = { 0x5e4224d9, 0x34499f74, 0x1f9d96fd, 0x4fc48a10, 0x483a10e7, 0x8d701d43, 0xe707a2c1, 0x5746758c, 0x7467a20f, 0xfd605ad7, 0xcc2267d7, 0x31601983, 0x73ab70a8, 0x242271dd, 0x354229c9, 0x41801153, 0xde5694f1, 0xb35e74ad, 0xf3632e2f, 0xbcec730f, 0x95586b73, 0x3da3dfb3, 0x9746a72d, 0x3b9fd08b, 0x5c4da0f4, 0x2cbff8fc, 0x3260c9fc, 0x5095466d, 0x0abe9b44, 0xbb66ad50, 0x5d7eb466, 0xcd928a06, 0x636de21d, 0xa1725cb4, 0x9c862b88, 0x050b61c8, 0x46403bde, 0x91858baa, 0x3727331d, 0xb63e303a, 0x724aed74, 0x7abf0e8a, 0xbcdabe25, 0x3a84caf8, 0x1dfe643e, 0x4f0c286b, 0x7e285580, 0xa9ca8bd9, 0x3850f447, 0x55c662fc, 0x672582ae, 0x019bf1d9, 0x1eb3c5ec, 0x14be284d, 0x664ed150, 0x2a4b8b61, 0x5169540e, 0x25d3f0c5, 0x43f2eae0, 0x40f94130, 0x18d81099, 0x2b84ed17, 0x0c557e9c, 0x05deb5f3 }, - .M_prime = 0x017168cb, - .length = 63, // 2048 bit - }, - .expected_c = { 0xce, 0x77, 0xa8, 0x0a, 0xc8, 0x2a, 0x31, 0xe4, 0xcb, 0xb2, 0xf0, 0xef, 0xdd, 0xa8, 0xc6, 0x0d, 0x36, 0x63, 0x65, 0xe3, 0x55, 0x29, 0xf7, 0x53, 0xd2, 0xd2, 0xf2, 0xb8, 0x5d, 0x12, 0x87, 0xf7, 0x83, 0x44, 0xe0, 0xdd, 0x7d, 0x10, 0xee, 0xb6, 0x1a, 0xf7, 0xd6, 0xba, 0xc2, 0x01, 0x34, 0x00, 0xb3, 0xcc, 0xef, 0xed, 0x3a, 0xc7, 0x02, 0x12, 0x49, 0x82, 0x8e, 0xfd, 0x94, 0xd4, 0x52, 0x3f, 0x12, 0x90, 0x3e, 0x0b, 0x09, 0x1f, 0x43, 0xb4, 0xcd, 0x69, 0xb2, 0xa0, 0xa1, 0xff, 0xb9, 0x46, 0x0a, 0xc4, 0x0d, 0x54, 0xf1, 0x38, 0x1d, 0xc6, 0x64, 0x81, 0x6e, 0x49, 0x5e, 0x49, 0x28, 0xa0, 0x8a, 0xb8, 0xb2, 0x5d, 0xec, 0xb0, 0xf4, 0xa4, 0x4e, 0xfe, 0x73, 0xee, 0xb6, 0xe7, 0xcc, 0xcb, 0x0f, 0xd0, 0xbf, 0x49, 0xfd, 0xdd, 0xe3, 0xe4, 0x8e, 0xbf, 0xeb, 0xaa, 0x63, 0xe5, 0x14, 0x7a, 0xaa, 0x56, 0xa3, 0x87, 0xf7, 0xdf, 0xf4, 0x20, 0xb1, 0xdb, 0x17, 0x66, 0xff, 0x01, 0xdb, 0xb4, 0x6d, 0xcb, 0x91, 0x44, 0x41, 0x77, 0xa5, 0x85, 0xd4, 0x25, 0x6e, 0x16, 0xf2, 0xbd, 0xad, 0x1f, 0x9d, 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x25, 0x1c, 0xe3, 0x08, 0x8a, 0x50, 0x39, 0xec, 0xb7, 0x78, 0x24, 0x69, 0xf3, 0x74, 0xad, 0xeb, 0xd0, 0x57, 0x02, 0x8e, 0xca, 0x6e, 0x42, 0xcf, 0xca, 0x7d, 0x58, 0x4d, 0x57, 0x28, 0xde, 0xde, 0x2b, 0x82, 0x30, 0xf0, 0x76, 0x26, 0x58, 0x50, 0x87, 0xd7, 0xdf, 0x92, 0xb1, 0x37, 0x89, 0xfb, 0xb7, 0x8e, 0x16, 0xf5, 0xef, 0x54, 0x8b, 0xab, 0x73, 0xf1, 0x61, 0xb2, 0xd2, 0x85, 0x94, 0x39, 0x39, 0x08, 0xd7, 0x12, 0x27, 0xdd, 0x2d, 0xb6, 0x74, 0x26, 0xc3, 0xd6, 0x07, 0xcb, 0x21, 0x4a, 0xeb, 0x70, 0xf1, 0x44, 0x9e, 0x85, 0x93, 0x99, 0xd2, 0x0e, 0x39, 0x4f, 0x45, 0x7e, 0x41, 0xd2, 0x2e, 0xe1, 0x9c, 0x8e, 0x03, 0x94, 0x7f, 0x6b, 0x48, 0x65, 0x25, 0x48, 0xad, 0x98, 0xf7, 0x2d, 0x3c, 0x42, 0x2f, 0x9e, 0x2f, 0x26, 0x1f, 0x04, 0xfc, 0x55, 0x4f, 0xa4, 0x43, 0xfa, 0x51, 0xd1, 0xb8, 0x93, 0x5e, 0x49, 0x21, 0x31, 0x1f, 0x98, 0x43, 0xba, 0xa7, 0xe0, 0x4e, 0x47, 0x96, 0xca, 0x75, 0x12, 0xed, 0x79, 0x4f, 0x32, 0x0b, 0x1f, 0xbe, 0xf8, 0x25, 0xca, 0x35, 0x56, 0xc5, 0x8f, 0x82, 0x3a, 0x09, 0xf4, 0x01, 0x07, 0x91, 0x7e, 0x08, 0xf8, 0xf7, 0xf1, 0x0b, 0x91, 0x2a, 0x78, 0xbd, 0xf6, 0x5c, 0x23, 0xb3, 0x47, 0x43, 0x73, 0x69, 0x14, 0x44, 0x6f, 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0x5a, 0x15, 0xfd, 0x6d, 0xe7, 0x8c, 0x20, 0x9e, 0x13, 0x34, 0x52, 0x4a, 0xb3, 0x64, 0xec, 0x82, 0xc7, 0xa6, 0xc4, 0xd3, 0xdb, 0x22, 0x12, 0xee, 0x5d, 0xec, 0xbe, 0x1f, 0xda, 0xeb, 0x69, 0xca, 0xe7, 0x83, 0x8a, 0x1e, 0x03, 0x19, 0xca, 0xb3, 0x6d, 0x38, 0xfb, 0x93, 0xb3, 0x32, 0x79, 0x99, 0xaa, 0x23, 0x04, 0x49, 0x3d, 0xdb, 0x63, 0x05, 0x0f, 0x43, 0xaf, 0xb1, 0x51, 0x0e, 0xbc, 0xc7, 0x98, 0x58, 0xa2, 0x19, 0xfe, 0x1d, 0x39, 0x4a, 0x22, 0x1e, 0x7b, 0x3d, 0xe3, 0x2d, 0xf5, 0xbe, 0xe6, 0x81, 0x3c, 0xda, 0x2a, 0xf0, 0x13, 0xcd, 0x9f, 0x9f, 0x05, 0xa8, 0x0a, 0x89, 0x34, 0x98, 0xde, 0x1d, 0x3d, 0x0c, 0x7a, 0x10, 0xbc, 0xb3, 0x39, 0x04, 0x45, 0x89, 0x29, 0xd0, 0x10, 0xd3, 0x7f, 0xf9, 0x97, 0xdd }, - .hmac_key_idx = 2, - // results of message array encrypted with these keys - .expected_results = { - // Message 0 - { 0x0945b2b4, 0x054757f4, 0x8f765a17, 0x60d13fd8, 0x4589a098, 0x24c11112, 0x591fa9b2, 0x779be5c0, 0xb3b31cd7, 0x58a5a406, 0x9e99370b, 0x200af50a, 0xce16016e, 0x0d882a0f, 0x75ec7e0e, 0x25d6a694, 0x29fa562a, 0xc6504c6b, 0x3c2f0602, 0x12832577, 0x7b31685b, 0xf2e2ef3c, 0xed20276d, 0xdb765155, 0x8a68bb78, 0x87e993db, 0x29bc2857, 0x2b15c314, 0x08c616b7, 0x8e494e75, 0x21cd6e36, 0xd2450ee9, 0x85bd8d5c, 0x77d33531, 0x3e865931, 0x630a1882, 0x37c746d2, 0x9dd15386, 0x0e0367cd, 0x6976903d, 0x3908a5ae, 0xb9698ee7, 0x73143a8f, 0x690aca4a, 0xfc96ca1f, 0x90811ed8, 0x634de27e, 0x05e1499a, 0x03ddea52, 0xa736f4d0, 0xf47f60ec, 0x5150f85e, 0x45730753, 0x7086e797, 0x24ac2057, 0xd84dca26, 0x43417f70, 0x99283765, 0x1e0eed11, 0xb901ac56, 0x6b106d2b, 0x088c3e59, 0x6e93b58b, 0xa445726e }, // Message 1 - { 0x976f1acd, 0xee9d9748, 0xe8e71778, 0x158b14ff, 0x6a91e2e3, 0xb6083da2, 0x6c54e624, 0x1ad20801, 0x0eaa96ae, 0xb15cacf1, 0x6e57dd0c, 0x811a8f5f, 0xa655cd02, 0x7268a8e5, 0x7c973283, 0xb2d2edcf, 0x8199fcd1, 0xf6b40718, 0x12d8aab2, 0x0b5aa12a, 0x6f78345e, 0x3c383278, 0x26dc4a48, 0x060eb57f, 0xe22721e4, 0x16a4bf26, 0x08d431b7, 0xc833d1f5, 0x08c3f121, 0x7a8ab9df, 0xa1b3ba9f, 0x4ee9c021, 0xaafc7019, 0x524ea77e, 0x5070be2e, 0xfaaee387, 0x4f9c1869, 0xee8387ff, 0x709a38f8, 0x917f89d9, 0x95d19532, 0xfaefe80c, 0xda887d1d, 0x37501c93, 0x214c8b82, 0x8c8c4c1c, 0x9213f447, 0x97fa04d5, 0x6cc5669e, 0xf3d48973, 0xcf872c12, 0x2097382d, 0x2bde8215, 0x9d6c8250, 0x7d885fd3, 0x915e3407, 0xcd3969af, 0xfa98e7f7, 0x1975f1b2, 0xf41f0919, 0x996ed33d, 0x2d82f14f, 0x84f4483b, 0x7023639a }, // Message 2 - { 0x728f6465, 0x298bf54f, 0xfdccb8b4, 0xc7c29b2c, 0x41d3089f, 0xb0dab85d, 0x1ea8fb39, 0xf0f34e4c, 0xdd5de5eb, 0xd5dd8254, 0x829684e0, 0x5fa1cf0b, 0x2b5b3d33, 0xc05fae66, 0xf8fd70f2, 0x6b80677c, 0x2ac471ff, 0x6cbc4896, 0x834348d0, 0x4d464f3f, 0x7f52d488, 0x9358cc35, 0xa1d66d2f, 0xd901c364, 0x6cbf0166, 0x360347dc, 0xedbea94d, 0x60181101, 0x9996def9, 0x6ba0c54a, 0x173e8d6c, 0x30105b98, 0x7f1d505d, 0x96620056, 0xa16fff55, 0xd2e0ab8a, 0x589ccf44, 0xacd34cb5, 0x322615b4, 0x5e81a792, 0xd861e43f, 0x23c27a48, 0xc12656d9, 0x45313dec, 0x15d8bcde, 0xc679ffb2, 0x6523c369, 0xe2337bf5, 0x355ec371, 0xeeba8907, 0x361d806f, 0x3c67cbe5, 0x4133d02c, 0x6edb53b6, 0xc28f03f7, 0x6d0273e4, 0x46ecbdb3, 0x14e95ec5, 0xb520fc1c, 0x93c23a22, 0x56f6b92e, 0x427859a0, 0x6ffbea14, 0x2383a340 }, // Message 3 - { 0x4fdd63fb, 0x903b9d11, 0x3dee8665, 0x860fd5b7, 0x29e98634, 0xb8412dad, 0xbdd67d55, 0xaabefc04, 0x483bd926, 0x26559898, 0x2c4e31d7, 0x300dc466, 0xf8f8b2ec, 0x91f6c3f1, 0x87c2d7db, 0x65dcc837, 0xe657f513, 0xa5ca475b, 0xb33d5c4c, 0x8189ac9f, 0x968e94ae, 0xe30e687c, 0xaee961c5, 0x3bfab1c4, 0xad3738d8, 0xb24bccb0, 0x6c2ed1bd, 0xba9bf32f, 0x47ffd571, 0x92d1ef64, 0xbae9fe4c, 0x957ebf4c, 0x51a60e0d, 0x20230935, 0x3ece96b7, 0x20515d9c, 0x26be4a33, 0xf6e4c5ee, 0x8f4c0576, 0xda5497f1, 0x07026257, 0x7ad56f7f, 0xaf952734, 0x96239be4, 0x6cdc67f9, 0x120e8fa3, 0xf2b0d5e4, 0x05acc5d6, 0x52843aac, 0xac9b9e69, 0xa0b49a50, 0x24e095a2, 0xcee0be5c, 0x1a524c29, 0xfd708113, 0xe59fef24, 0x88d25a0c, 0x4883be17, 0x126edcd6, 0x629080cd, 0x2d746261, 0x29e4a53d, 0x681459dd, 0x69bf86b5 }, // Message 4 - { 0x521493f5, 0x184057aa, 0x72dbd9e7, 0x9451c2b3, 0x01a91ce0, 0xeff23076, 0x1d1ffdbd, 0x1d25f64b, 0x86b6322f, 0xc29cd86b, 0x3e166ce2, 0xbec9e422, 0x9a782d2b, 0x809109f9, 0xa9c303da, 0x5ce55dd8, 0xcb4cf002, 0xaa0d6b75, 0x9fd84600, 0x598c381d, 0x8f6f36bf, 0xe9931438, 0x91f32468, 0xf487b9a4, 0x742826a1, 0xfc94b2f8, 0x88e62c89, 0xf84d1f69, 0x7657b53e, 0x445c3067, 0xaa7b4b18, 0x3a8117a2, 0xfd919088, 0xa760a292, 0xd602c2b6, 0x7171536a, 0xf0722c15, 0xae7cb027, 0x5073e7cc, 0x5b7273b8, 0xdffe32b7, 0xcd02e42d, 0x1b9d9aab, 0x8664d51e, 0x14b741c4, 0xc82bd736, 0x52c91186, 0xec36ed9f, 0xa5640ceb, 0x8250292c, 0x6d8de316, 0x2d7d2ec8, 0x018bcf22, 0x9bbc053e, 0x2646ccf6, 0x7eec12f4, 0xc842fd06, 0xa48462d4, 0x37e3d3e6, 0x9bbcbd5a, 0x36a17aae, 0xb418b850, 0x67c8f8ce, 0x6750d407 }, // Message 5 - { 0xd02b7d24, 0x4017506b, 0x054459a9, 0x49bc64fc, 0x86ed843a, 0x354c41d8, 0x1f5b9dfa, 0x69a3321e, 0x03ca042b, 0x6fb9751c, 0xdeb0b33e, 0xaed2824a, 0x47bf7db9, 0xad5f816f, 0xacaf8c7e, 0x69e8034a, 0x4f86c368, 0xe426ec4b, 0x7e96fba2, 0x06ef68b2, 0x3327432c, 0xafeee978, 0xe4176b92, 0x90dc7e28, 0x4f2415e9, 0x26ff05db, 0xd039565c, 0x0e497ea9, 0xaf96d11f, 0x06d90a8b, 0x20727fdb, 0xc04d60e6, 0xd7486d92, 0x3fea5fb6, 0xed0d0547, 0x560f74ed, 0x488bc7de, 0xa542a5e7, 0xe892f78a, 0x610b68c9, 0xbdaacc00, 0x04192fd7, 0x1e9ddcf9, 0x1c6e8ca5, 0x80a6a17a, 0x84da4b96, 0x3c2b5282, 0x49f78f6d, 0x449782a9, 0x966df1d1, 0x80ac68da, 0x08eb61b3, 0xfd4b00e1, 0x2dc62d60, 0x9eecdc6c, 0xd562d247, 0xd919b50f, 0x89c51929, 0x64654b23, 0xbd744ae3, 0xf04059fa, 0x2825f240, 0x8083e068, 0x0454ec74 }, // Message 6 - { 0x4a00eaca, 0xbdeb2fc5, 0x7084074b, 0xa655329d, 0xb72b49db, 0x0174a93a, 0xbdc60cde, 0x63e323af, 0x3a5c3e95, 0xb648fc72, 0xe46b10be, 0xe483c3c4, 0xe61b71e7, 0x0608fc1b, 0x24f35f29, 0x165e9aa5, 0xb0d41334, 0x6d578f51, 0x5c21614d, 0x29548543, 0x543789e8, 0x731cd402, 0x116fa594, 0x01381bc4, 0x557a57ad, 0x0ab39ab4, 0x9a8617d8, 0xa2c753b4, 0xf6f4ef7f, 0x597c100b, 0xd0b58aec, 0x76619039, 0xfbe3f316, 0xffc0400d, 0x3ee89eaa, 0xe79f2ad3, 0x7399372e, 0x859877be, 0x4253e36b, 0x635b8c4c, 0xa0cb5223, 0x3c509eb1, 0x388fd2fa, 0x0e0f6b5b, 0x4fb38e90, 0x910f9d6a, 0xf4cf76a8, 0xf7bcdc96, 0xc3b76677, 0xf4aaa20e, 0x13e4470b, 0x79e7b7e3, 0xa28d5a61, 0xa1b33d0f, 0x4b23f0c1, 0xd6800659, 0xef2affba, 0xc664d556, 0xc921bf2d, 0xe70b50c4, 0x6c7aa113, 0xbe27e7f1, 0x392a892c, 0x3127539d }, // Message 7 - { 0xc8e36f8e, 0x272f2ffe, 0x7b8bda29, 0x0f183f1d, 0xc72066d5, 0x54574fb5, 0x39acb1ac, 0xa2420a0a, 0xe5de4ed3, 0xf85343fa, 0xb49eef94, 0x34826793, 0xcf309551, 0x94b349b7, 0xb21b8e9b, 0xfe84b59e, 0x8304da6b, 0x57cc10f6, 0xcd4d1a1e, 0x3e018268, 0x1b9c0e6b, 0x1a0e3d2f, 0xb046a38f, 0x2d189663, 0x01ca779a, 0x3f4a96b2, 0xa788e283, 0x88a31242, 0xa71faee8, 0xcbac9d62, 0x165acbed, 0xe6b4fc18, 0x2f4735e5, 0x8090d057, 0x1f81f973, 0xf458590a, 0x16ffcff3, 0xaa135c2e, 0xd9a9a480, 0x66a146ce, 0x4676c4d0, 0x1e6d3ac5, 0x29152f65, 0x44218661, 0x319e0216, 0xd265e3db, 0xa59e2f02, 0x9cf28d2f, 0xd81c8f7a, 0x84c0f216, 0x3f3887d7, 0xf2bca18d, 0x101cbd8d, 0x9ad60f6a, 0xc4c649fa, 0x3b328865, 0x4ccf84dd, 0x5d3d2ee5, 0xceb4175d, 0xa85c21bf, 0x899c2d62, 0x9fb19571, 0xa0287467, 0xabe9ce38 }, // Message 8 - { 0x05a9d8b6, 0x0db4c7f3, 0x476b358b, 0xa2291a8c, 0x1d003d6e, 0x27190d47, 0xeb2736b3, 0xa993dc4a, 0x3d9dfe33, 0x494f947c, 0x770b64ce, 0xa0af0083, 0x49502ad9, 0x45c8a90e, 0x65b47e45, 0x56c7f761, 0x27946a6a, 0x9cb3bd24, 0x2058c932, 0x1e66caee, 0x1231ada0, 0xbc6b8804, 0x90767ed2, 0x384f1a77, 0xa666b775, 0xce2ab541, 0x1ae561d1, 0x0e6e5c7b, 0x912d3e48, 0xe8e6216e, 0x2ca3695a, 0xb07d024a, 0x0e073ae8, 0x0dc2d346, 0x686b4b69, 0x14971211, 0xb7b15c14, 0x8d2b1569, 0x14eab77f, 0xaaa24d7a, 0x5c452889, 0x8a6be8bd, 0x5b727432, 0x72a37c1a, 0xf9614eeb, 0x5eb9d8b0, 0xb06fc403, 0xd94c11f9, 0x7b623c0f, 0xe1a477ae, 0x7c2f8d75, 0x63a631a1, 0x787a316b, 0x2244628b, 0x2faed554, 0x0baa0388, 0x4986df09, 0x494172e2, 0xb062f78a, 0x8a6936ed, 0xa65fe593, 0x81e1e6f8, 0x7dfe0ab0, 0x2be2a9b3 }, // Message 9 - { 0x19513121, 0x360ca394, 0x2c828866, 0xd45b8572, 0xadd669df, 0xb86af352, 0xa3eaffef, 0xfb4dd6cb, 0x450f1bfe, 0x0eb23f4a, 0x993bac03, 0x926f1328, 0x74bbfff6, 0xa40e0490, 0xaaf95a42, 0xfcbf937e, 0x660dbe5c, 0x920095a9, 0xdce74fc4, 0xc41af89f, 0x57e6f740, 0x2236c5dd, 0x02472152, 0x41284124, 0x06ddebd9, 0xeb56cdfb, 0x285a78a4, 0xaf914788, 0x87b93b5e, 0xeadf441f, 0x741eb3b9, 0x3806e001, 0x06ea2d79, 0x44f464b6, 0x051f1563, 0xeb545642, 0x3bf62f96, 0x363e1cc7, 0xce83eda6, 0xe20d6352, 0xd109f1d5, 0x0cedb178, 0xe29dcc9d, 0xb347a0bd, 0x851ffabc, 0x9b3d3b0c, 0x8dae1c55, 0x04a3f933, 0x9b8cf4b0, 0xda3e3a80, 0x399b36d1, 0xce6f1991, 0x58cc7322, 0xb56f5d55, 0xb5ce99c6, 0x4be7fe50, 0xdf7ccfcf, 0x8f6da12a, 0xc177c2b6, 0xbb402145, 0x0c74865b, 0x40b243c2, 0x7d9e20f5, 0x3163db75 }, }, - }, - { /* Case 2 */ - .iv = { 0x2a, 0x0c, 0x15, 0xc2, 0x39, 0x0d, 0x56, 0x37, 0xda, 0x53, 0x58, 0x8b, 0x33, 0x0d, 0xe1, 0xa0 }, - .p_data = { - .Y = { 0x42018cc1, 0x5570b4b5, 0x3b244341, 0x548e492c, 0xf45e6df0, 0x29a8427c, 0x54a4261f, 0xa639229b, 0x3a476ab9, 0x50e2e93b, 0x49bbbce5, 0xf899d452, 0xddf462bd, 0x5a1f1188, 0xcc9567fb, 0xc390b628, 0x81ca8c54, 0x66eff475, 0x2ee8fe90, 0xffb602a9, 0xecba5807, 0x47087d42, 0xb99432e5, 0xd6c8e3d3, 0x4b8c7539, 0xfd1f6865, 0xaff6074b, 0x900e756d, 0x9ea4727a, 0x1253260f, 0xa0ef53d5, 0x5edebf0a }, - .M = { 0x1183afb3, 0x49b2d855, 0xc1d6dc2e, 0xd50f7b62, 0x020e3c7a, 0x0be0bc65, 0x3e6e8f98, 0x0a732ab1, 0x90fc3e18, 0x905ba0b5, 0x799bfcaf, 0xb677eaf5, 0x56418d29, 0xa3063d0e, 0x4fd11a6e, 0x59d70a1e, 0x28ffb961, 0x5c31bf1e, 0x74ebc5e0, 0x71da91bd, 0x55552e27, 0x63ed46c3, 0xae1cffae, 0x9733c550, 0xa0af8651, 0xef5625ca, 0x6d4a1f69, 0xbf980a4e, 0xaee3e705, 0x3e0dbe5a, 0x4cce965e, 0xe043a585 }, - .Rb = { 0xc5a8b012, 0x6710ac99, 0x29a55534, 0x2d85b2cd, 0x881c0b55, 0xefa0b081, 0x93bc798b, 0x83831a0d, 0x34f7511d, 0xe5e42fb6, 0x63bd3cb9, 0x61eb9ee1, 0x176d1a7f, 0xa54904bf, 0xca532666, 0x28d312b9, 0x0b214b43, 0x2d73a77d, 0x53dcc012, 0xd6fe7785, 0xdfed3ca4, 0x19ae4a07, 0x03441d1d, 0x0767f32d, 0xd0a99fd2, 0xfd986f61, 0x30d6386e, 0x33cc9e91, 0xbd7ef5e0, 0x881a833a, 0xd344478e, 0x8650aa28 }, - .M_prime = 0xd9776885, - .length = 31, // 1024 bit - }, - .expected_c = { 0x96, 0xa4, 0x25, 0x0c, 0x43, 0x48, 0xe0, 0x6a, 0x57, 0x8a, 0xe1, 0x4d, 0xe7, 0xf6, 0x6a, 0x5e, 0xa6, 0xa9, 0x1d, 0x0c, 0x07, 0xd4, 0x44, 0xa4, 0x8e, 0xf5, 0x05, 0x4c, 0x1b, 0xa8, 0x64, 0x2a, 0x19, 0xd9, 0xf6, 0x28, 0x79, 0xf2, 0x7b, 0x38, 0x87, 0x0a, 0xc6, 0x39, 0xf4, 0xb0, 0x5f, 0x49, 0x86, 0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0xbe, 0x29, 0xca, 0x23, 0x6f, 0xa7, 0x88, 0x50, 0x60, 0x7c, 0xd8, 0x74, 0xbf, 0x11, 0x78, 0x57, 0xb2, 0xa7, 0x92, 0x06, 0xb2, 0xbb, 0x8d, 0xb9, 0x4b, 0xb1, 0x08, 0x27, 0x5f, 0xfd, 0x7c, 0x2f, 0x53, 0x3f, 0x5a, 0xcb, 0x5d, 0xfc, 0x53, 0x71 }, - .hmac_key_idx = 0, - // results of message array encrypted with these keys - .expected_results = { - // Message 0 - { 0xe5edea3c, 0xe6073206, 0x7e787676, 0xb4ba3f2c, 0x3ca9db24, 0xd1b4d954, 0x8fd23a4e, 0x80875e57, 0xaa6fffeb, 0xcf55420d, 0x35f5fef9, 0x64b119e9, 0x4b0be3c5, 0xc310f010, 0x727cf9f1, 0x4913855e, 0x6ed1a0ed, 0xc2074c38, 0x43fd92a5, 0xfa4a9328, 0xd0f96e0f, 0xad69c317, 0xd089f4ca, 0xfa906ac2, 0xcfc67275, 0x04697307, 0xd9c02d65, 0xcf9e9e50, 0x41fde0eb, 0xcf80479a, 0x24bdf2c7, 0xa366c4d3 }, // Message 1 - { 0x1e97de77, 0x26832b54, 0xe6c538a1, 0x80f11ce5, 0xa8159fa2, 0xae7378b2, 0x4ce9752c, 0xffc1fe65, 0x247c79aa, 0xb5456df2, 0x2b9c64a2, 0xe6416195, 0x7650be45, 0xc9448db3, 0x5fe36775, 0x8f45b2e0, 0x54456129, 0x4e29c3ba, 0x5a21d694, 0xe9adc848, 0x160b702f, 0x6251b504, 0x846b60c4, 0x21376c1d, 0x162ad548, 0x263ded50, 0x4b31b4ee, 0xd64e875a, 0x2107bfb3, 0xc3e4632b, 0x5862265d, 0x28076cd1 }, // Message 2 - { 0xe2cbdb2a, 0x33221d10, 0xc1152dec, 0x816be649, 0x3118ad12, 0xa2f288f2, 0x077f2fff, 0x01da518a, 0xd414cba0, 0x9060d389, 0x1a2f2d53, 0x2a21fa83, 0x2ea5a907, 0xaaeb0223, 0x659186fb, 0x0de05052, 0x0c29ff9d, 0x883786e1, 0xafa38a2b, 0x12acaf99, 0xa84ac4f2, 0xcdf43354, 0xed0ffe7e, 0x84af042d, 0x1ddccbca, 0xd0eeb6eb, 0x0e7969ef, 0x3a5badde, 0x239a7013, 0x686f59df, 0xc024aa3b, 0xdf5283f2 }, // Message 3 - { 0x6bfdf3b6, 0xaaca115d, 0x13f71e94, 0xc1d58117, 0x7e20268a, 0xba1164ce, 0xa62d7111, 0x71bf438a, 0xb1ef1bf3, 0x568cf2cf, 0xf77cc908, 0x93abeb1a, 0x8b48bccb, 0xaf61594e, 0x7b12b87f, 0x7046e65c, 0x32c9f344, 0x36228da8, 0xa53e4064, 0x771240c7, 0x03d2bf66, 0xaa3889d6, 0xe3f62cef, 0x24654692, 0xba9e2567, 0xd35808c9, 0xe8b13f1e, 0xc96f9461, 0x6f9edb8d, 0xb4fa6907, 0xd14ae63c, 0x86bf6697 }, // Message 4 - { 0x34cd0e29, 0x91e27cb1, 0xe1d8f7db, 0x0c2dc716, 0x97120bbe, 0x25cf2024, 0xc15722b3, 0xcaab648a, 0x6a758a09, 0x3eac1b8d, 0x7b91c3c5, 0x2c3aadc7, 0xc9196b23, 0x3f6c39e0, 0xdd17e486, 0x7c434e32, 0xaaf69d85, 0xcee2ef13, 0x22dacc4b, 0x677ab494, 0x87a62367, 0xf86291e5, 0xb338ad6c, 0x8258efb1, 0x23e9774d, 0x60a6d823, 0x34695070, 0xf565c64e, 0x584506f0, 0x9ded2478, 0xf1e9c7f4, 0x183c968c }, // Message 5 - { 0x03ed1bc3, 0x66f78658, 0x56f5de66, 0xb1d3381d, 0x6bac53f4, 0xd1685ca9, 0xcf373482, 0xd960b73d, 0x742a9dc7, 0xe019a31c, 0x3986d712, 0xab3c3a15, 0x42ce85d2, 0xe583acaa, 0xec70af74, 0xb2da696b, 0xaa5a9dc8, 0x2ee1cc2e, 0x600e4fd7, 0xd2840802, 0xc32ffbc0, 0xd55791a6, 0xf3424580, 0xcdd76019, 0x1f361747, 0x14db8c4e, 0xecb886c0, 0x9946a2b2, 0xc82bb408, 0x56ed0518, 0x0f2ba4b8, 0x6c79af92 }, // Message 6 - { 0xf32f948b, 0xaaa0ba88, 0x6efc8dc3, 0xf4c72cf4, 0x56190319, 0x25ce0426, 0x8b4032a8, 0xf1f1bab2, 0x0af6897c, 0x8369048c, 0x0888f4a1, 0x383b42c8, 0x9b2e2506, 0x7e853647, 0xe96127b9, 0x306427a5, 0x92f81696, 0xfa01c29c, 0x89542d32, 0xe2375122, 0x852cd30a, 0x255f71cb, 0x69cf28d3, 0x42b2610b, 0xb69da15d, 0xe4d9ab19, 0x60969f81, 0xcca52357, 0x0dabf3fa, 0x5932bb4b, 0xd13fbb9b, 0x30d45c15 }, // Message 7 - { 0x2eda5bf8, 0x76a3e7b8, 0x16751170, 0xc8ffc24a, 0x95728188, 0x93022f0b, 0xfb1b62c7, 0xe6d717dd, 0x0706b505, 0xd4d087a2, 0xe191e84b, 0x65e33816, 0x2b8817d5, 0x784dff54, 0xa61dd1d6, 0xa584a5e7, 0xd428dc14, 0xd110c506, 0xb620c8ab, 0x8f94a2dd, 0x46c9c3c2, 0x2f64ac02, 0x9b2c5318, 0x76aaa4e9, 0x2f524ad6, 0x5d69276c, 0xe7dc1a82, 0x5e7fd117, 0xa99bb773, 0x84aa7db8, 0x0a9d029b, 0x88d825b6 }, // Message 8 - { 0x92e9d65d, 0x914bc653, 0x5640a70e, 0x7f83e6e7, 0xaefba43f, 0xf0b727a3, 0x8bb1980e, 0x9988f45b, 0xbfac224a, 0x05430955, 0x995463b5, 0xbc9c7e60, 0x0f5f1505, 0xc6e279d5, 0xd90c9ef7, 0x794af4d0, 0x280f1a4a, 0xac57f4ab, 0x4e7a3f80, 0x0e47c6ec, 0x5566b042, 0xc398f57a, 0x343d596b, 0x34ca3486, 0xe70b3159, 0x96c78d63, 0xa5a6e0d7, 0x27788786, 0xe10184d1, 0x15de4f99, 0x5dfbce0e, 0x16b500b1 }, // Message 9 - { 0x9ae2ade0, 0x795640d0, 0x2ec1ac95, 0xcf91ef35, 0x4e23ac9d, 0x6d928302, 0xabadc916, 0x2bd2e305, 0x7d2bbc26, 0xf63d6b0f, 0xbd7a4c3d, 0xbc279680, 0x11534f96, 0x2089ecd8, 0x9797457a, 0xdb30b13a, 0x6ac85237, 0xda1c13cd, 0x3bdeaeae, 0x9dc739c4, 0xb67ac1e1, 0xf638c0d4, 0x299b38e4, 0xe6357ce6, 0xae6d26c6, 0x16d7bc3b, 0xf2f0e029, 0x92627fe4, 0xb6eda95d, 0x8673ef07, 0xc43ae485, 0x895242a4 }, }, - }, - { /* Case 4 */ - .iv = { 0x96, 0x5a, 0x0c, 0xec, 0x53, 0xbd, 0x5c, 0xa0, 0x8a, 0xfa, 0xf2, 0x69, 0x28, 0x0c, 0x61, 0x74 }, - .p_data = { - .Y = { 0x82c81f75, 0x3fbaf0da, 0xc6e34fc2, 0x45169f5c, 0xe255af46, 0xea6fd6cf, 0x7be8b38c, 0xed9558e9, 0xa5f75c80, 0x96fcbf38, 0x9e877b9d, 0x9cbbf4fb, 0xb648b92a, 0x7d6e6ee1, 0x9e8fb667, 0xea81da47, 0x25958789, 0x3ec847fc, 0x65405670, 0x4eb7bd46, 0xf95f2c0a, 0x66555cd0, 0x819e2ffa, 0xbd22aa0d, 0xb03bc289, 0xcf448568, 0xc0aa54ec, 0x46065689, 0x8de9c7da, 0x0f16611e, 0xa1d3b8c6, 0x9438c825, 0x8faeb380, 0xfea9e5e1, 0xa1eecba8, 0x62462e46, 0xc09cfd74, 0xecda374c, 0xa6196ca3, 0x54efd66b, 0xea743ca1, 0x19789a65, 0x022ea12a, 0xe3ac2eab, 0xf479a469, 0x7b34acdb, 0xea219e1a, 0xf0237054, 0x9b262528, 0x762f3888, 0xf8267219, 0xec738096, 0xf6ccc182, 0x845b14bb, 0x59ab0f6d, 0x31e81d6b, 0x2236f9e0, 0xcc4af38f, 0x51498ea3, 0xf7f8d034, 0xf3123155, 0x71ba9378, 0x4f124842, 0x9a26f7ba, 0xb1901805, 0x336d432a, 0x612fec1c, 0x5ece3c11, 0x24c19a32, 0x28832604, 0xa2bb7f02, 0xbbfab0a8, 0x88dbb8cb, 0x136a7a7f, 0x262076d0, 0xeec1decb, 0xa6a2539b, 0x725f43bc, 0x6e2f8603, 0x6949f63f, 0xafc6c351, 0xa5f1ab05, 0x03a7beed, 0x5681066e, 0x1c9f8aef, 0x87dbd104, 0xa152c018, 0x28ce0851, 0xb2278a60, 0x3a29546a, 0xb9345089, 0x56c3e310, 0x4670cb8c, 0x1c50a849, 0x27d4a1eb, 0xb47c873d }, - .M = { 0xf47a9529, 0x7cdc5d2f, 0x8ddfa293, 0xedbb7e3c, 0x1adf4f8a, 0xecc813f4, 0x39f65592, 0xdd2ef7a6, 0xe65b167a, 0x7931218d, 0xe43da582, 0x68628cfd, 0x4d91dd6b, 0x7a5a57f1, 0xa50be84e, 0x27a6bcde, 0x5529180d, 0x33111902, 0xd0ab2634, 0x9e7461f3, 0xc1f763e9, 0x8363920b, 0xb7eb12f7, 0x60fdc99f, 0x6f7d173c, 0xef401975, 0xb2c5bdf1, 0x42e3b994, 0x239fc07e, 0xb6ed5b40, 0x6ace33a2, 0xc5e1e70e, 0x695fa37e, 0xdf5aaed5, 0x97287af7, 0x28f3dd1f, 0x36cbd0ff, 0x01857cc8, 0xb40bdc9e, 0x5b082b1e, 0x3fb250b0, 0x81a975ae, 0xd2f6c63b, 0x6b1cab14, 0x793b0616, 0x885dcfc1, 0x61554c88, 0xdf6858a4, 0xc5235b3e, 0xf3d2c933, 0xcdfd1682, 0x017a7632, 0x8eb8188f, 0x999c46aa, 0xc34511af, 0x18ad86ab, 0x1363da7b, 0x9d35489b, 0xd2ab7e17, 0x71d4817f, 0x4c8d996c, 0x90a7da31, 0x7b9a43e5, 0x6cd70b25, 0x0e13dff2, 0xc670ca90, 0x40a6eb52, 0x1f3dd155, 0x36b1024c, 0x976ba305, 0x017e4764, 0x0ab66429, 0x99fcbf60, 0xa88ecffc, 0xbb2de066, 0xf5a9a2db, 0x478a016e, 0xe18d6cd3, 0xe15505e1, 0x9e16794c, 0x2f15efd9, 0xe59c52e6, 0x6680ef0d, 0x21eea982, 0x75e19ec7, 0xbc3a7122, 0x9e994bbf, 0x7d455193, 0x716be910, 0xc39dcd8d, 0x8ebfa241, 0x9125ba77, 0xf42bc4b6, 0x3c9b2f05, 0x1439c4fd, 0xb9e90637 }, - .Rb = { 0x8f3b4d09, 0xbba2c348, 0xb867352d, 0x4ebd8e36, 0x05f0da1f, 0x3780796f, 0x8d21087b, 0x2400a294, 0xde074bc4, 0xa19c5093, 0x60f00569, 0x334a2e47, 0x63d8921d, 0x62170e03, 0x05d0fac1, 0x0e08a1ba, 0xbd48f047, 0xd714f484, 0xb961404d, 0x12eac1cc, 0xf3070419, 0xec9459d7, 0x16afe9df, 0xd8b2e349, 0x96ddbf5f, 0x64b4382d, 0xf0c1185e, 0xe76b1a0d, 0x521fc1a8, 0xb1691e50, 0xa31db4d0, 0x6bc32d6f, 0xaac31f31, 0x7a3cb989, 0x8eb9eacb, 0xa1529164, 0x803c1324, 0x06b6b739, 0xdd8b1fde, 0xb1c93b86, 0xec9461c8, 0xc1cb3858, 0x74c56d2f, 0x6ded889b, 0x6db1e4f5, 0xb447af73, 0xce2f2af8, 0x3c203809, 0x040d4d56, 0x1fe5010a, 0xa1d951e4, 0x6fcba419, 0xda33954e, 0x60d7b946, 0xaa853c70, 0x0b36aa27, 0xa4872e7d, 0xe762216d, 0x77084cbd, 0x46a986b8, 0x16654e20, 0xf3a55b75, 0xb1d3fa6b, 0x4c4fff97, 0xed2956c1, 0x91049070, 0x7efb88d7, 0xe75a5b81, 0x7af24ea2, 0x636ea094, 0x36d3172d, 0x990bd5c0, 0x43a6a5be, 0xde623246, 0xa3f60aa7, 0x20f65947, 0x9c661629, 0x262b0813, 0x767c3349, 0xafb28169, 0xb5675479, 0x13fde10c, 0x55f7b74f, 0xb893644b, 0x1dfb720c, 0xbc251e1a, 0x9da4b2ed, 0x05ee29bb, 0xa8fcc918, 0x4f1d3c4c, 0xc8380b75, 0x3d953f6b, 0x3f69eb6b, 0xc2134abb, 0x546ade53, 0x8c35df85 }, - .M_prime = 0xb30d28e7, - .length = 95, // 3072 bit - }, - .expected_c = { 0xe8, 0x71, 0xf4, 0x55, 0xae, 0x2c, 0x4a, 0x70, 0x1f, 0x19, 0x1c, 0x3d, 0x43, 0x50, 0x89, 0x1f, 0x3f, 0xd5, 0x88, 0x5c, 0xc5, 0x10, 0x17, 0x04, 0x30, 0xfd, 0x3a, 0x24, 0xb9, 0x17, 0x53, 0x7d, 0x0e, 0x67, 0xb4, 0xe0, 0x44, 0x9d, 0xc1, 0xd7, 0xe3, 0x40, 0x2c, 0xda, 0x5d, 0x85, 0x32, 0x46, 0xdc, 0x05, 0xa3, 0xe3, 0x8e, 0xb3, 0x92, 0xcc, 0xb3, 0x15, 0x0d, 0x13, 0x47, 0xcd, 0x7d, 0x0b, 0xee, 0x9c, 0xe0, 0xaa, 0x8d, 0xbe, 0x55, 0x51, 0x40, 0x6f, 0x52, 0xda, 0x1f, 0xa0, 0xb1, 0x0c, 0xb1, 0x8a, 0xce, 0x93, 0x8f, 0xd6, 0xd7, 0xa9, 0x00, 0x42, 0x55, 0x0b, 0x5d, 0x37, 0xc3, 0xa0, 0xd2, 0x99, 0x36, 0x2b, 0x3f, 0xbe, 0x20, 0xa6, 0x0f, 0x81, 0x1e, 0x1c, 0x15, 0x91, 0x01, 0x65, 0x00, 0xbf, 0xba, 0xad, 0x2f, 0x29, 0x5b, 0x4f, 0x96, 0x77, 0xea, 0xec, 0xaa, 0xb8, 0xf3, 0xd3, 0x47, 0x70, 0x25, 0xbb, 0xcb, 0xd4, 0xe2, 0x04, 0x71, 0xec, 0x10, 0x23, 0x3a, 0xf4, 0xbb, 0x1d, 0x43, 0x36, 0x06, 0x4c, 0xf5, 0xb4, 0x55, 0x3c, 0x1d, 0xee, 0x9c, 0xd7, 0x69, 0x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, 0x7c, 0x15, 0x88, 0x90, 0xdf, 0xda, 0x0a, 0x47, 0x62, 0xc1, 0x49, 0xfb, 0xaa, 0x38, 0xbb, 0x93, 0x8e, 0xea, 0x43, 0x42, 0xf9, 0x49, 0x70, 0x97, 0xe7, 0x5c, 0xbc, 0x9d, 0x98, 0x40, 0x4c, 0x88, 0x0f, 0x8f, 0xff, 0xd5, 0x00, 0x1d, 0xe5, 0x3e, 0x63, 0x39, 0x5e, 0x79, 0x3a, 0x35, 0xc2, 0x58, 0x9e, 0x11, 0x8a, 0xd3, 0xb4, 0xe1, 0x62, 0x3d, 0x69, 0xb0, 0xb2, 0xc6, 0x89, 0x28, 0x6d, 0xfb, 0x25, 0x7d, 0xb3, 0x2e, 0x5b, 0x24, 0x59, 0xe1, 0x89, 0xca, 0x74, 0xa5, 0x32, 0x71, 0x5c, 0x00, 0x69, 0xe2, 0x03, 0x52, 0x28, 0xc0, 0x0b, 0x41, 0x3d, 0x59, 0x51, 0x3e, 0x9e, 0xe2, 0x6f, 0x6a, 0x66, 0xcd, 0x0d, 0xd4, 0x40, 0x87, 0xbd, 0x3e, 0x6d, 0x0c, 0x9f, 0x9b, 0x23, 0xf8, 0x6c, 0xb7, 0x90, 0xe5, 0x0b, 0x2c, 0xe7, 0x82, 0x9e }, - .hmac_key_idx = 1, - // results of message array encrypted with these keys - .expected_results = { - // Message 0 - { 0x98ae55fa, 0x8e3a5c6c, 0x70e6b8c3, 0x78c4ad7f, 0xc0585683, 0x154354e8, 0x14f7cd56, 0x716ee192, 0x8f248707, 0x412f07a0, 0x4cf38afb, 0xa6581443, 0x07d52cfa, 0x11829a8f, 0xc4eccd55, 0xc4784ad9, 0x7acb21a3, 0x1c5daf68, 0x44b01bf2, 0xaa7b4c35, 0x43d38c77, 0xe02200fb, 0x0c5dc289, 0xb266a4b0, 0xa632caa2, 0x0c4d9653, 0x1c840ad6, 0xc83a2533, 0x3593b4cc, 0xf927cf74, 0xfeb1a7c0, 0x0899b8aa, 0x624b9b41, 0xff0ba52e, 0x7a772e76, 0xe7e9104d, 0x7d56c83c, 0x58053fbf, 0x177fea07, 0xf5696d14, 0x09df3fdb, 0xb119c754, 0x47894350, 0xfc4c1071, 0xf2048c06, 0xea302c8f, 0xa70088d2, 0x1feebad9, 0x6eb748a7, 0x479b2f11, 0x71831c58, 0x90d71a8b, 0xd1ac563d, 0x14b15cb9, 0xdb89941e, 0xfc7fdfb5, 0x9c03e460, 0xd748f437, 0x43fd3af1, 0x6fc6afac, 0x7aa8e99c, 0xe4d9741d, 0xc939f2e9, 0x2a78ab68, 0xc782229e, 0x96949655, 0x56d7a65a, 0x80d8a5c5, 0x88341b02, 0x08b9eafa, 0x94a11163, 0xad184989, 0xd62e204a, 0x6a7a0dc2, 0x933692ed, 0xd61eb0e7, 0x483a5020, 0xb0cb79e1, 0xb58c0bbf, 0xdc0b1685, 0xf04dc7f9, 0xf0b7b944, 0x115741de, 0x04a8fbef, 0xc14b8ac8, 0xa0c842ff, 0x8d8be311, 0xc24fca56, 0xbeb2172d, 0xf458888a, 0x5cbd72b2, 0xf74dab5a, 0x19d4158d, 0x70b82f76, 0x578fe7ee, 0x041f3441 }, // Message 1 - { 0x269ecdc9, 0xec75529a, 0xe4dd9832, 0x9a7d9cf5, 0xbfc87ce8, 0x8f70440a, 0xc3b9c975, 0xce68167b, 0xdb39077a, 0xbfb2cfd0, 0x47f244fe, 0x2c569e22, 0x9dcb7c5f, 0x41f7e74a, 0xecb069e0, 0xcbd3441c, 0xe0afe198, 0xb0cc9efb, 0x8ed19f18, 0xeae16e4c, 0xd9a6f034, 0x30d135a9, 0x8ec193fe, 0x7da5123d, 0x2fdb72ab, 0x9377d3a9, 0xaf79140e, 0x06fa21f1, 0x1bf824d5, 0x4f4a3b7b, 0xbb0c9c22, 0xa9e61217, 0x2d4f1dbf, 0x43d39e8d, 0x427b3e3c, 0xc9d017a2, 0x80b9e970, 0x9465f675, 0x5fb718e8, 0x205885b9, 0x1d486275, 0xedf46bf1, 0x6e305e72, 0xeb929cab, 0x15935477, 0x89312f29, 0x95422f9a, 0xa3cf4f36, 0xd24898fe, 0x4230ba1c, 0x4bb221eb, 0xf24ac29d, 0xd0007433, 0x78d7800e, 0x93b99888, 0x65c62bea, 0xf50c78e9, 0xb25c1003, 0x366355fb, 0xe536c649, 0x1c18154e, 0xabdf177b, 0xcc62816a, 0x0281f158, 0x07c8f8eb, 0x3abc64d1, 0x84bcd4a5, 0x29f31b43, 0x53d922bf, 0x09363496, 0x643d9249, 0xf012c0ee, 0x00ca51ad, 0xdbdb113a, 0x388dffd8, 0xe04f75a7, 0x973614f0, 0x01f1c096, 0x2a9c1ae4, 0xf375cb42, 0xce289b7d, 0xe42faa32, 0x04dd740d, 0xfd5ffb21, 0x25a7648d, 0x73d1c77d, 0x04026145, 0x9cafe7fc, 0x3dcc66d6, 0x0797be68, 0x550c04e7, 0x9653c9ca, 0x3097b81d, 0x17d4672e, 0xbc072dc6, 0x14f66333 }, // Message 2 - { 0xf8262d26, 0xef952d84, 0xaeee6fbc, 0x0bfeee47, 0x214df086, 0xd27a921c, 0x23411c20, 0x4e6c94ec, 0xd06e91d8, 0x6402771f, 0x716ec0da, 0x708ba823, 0xeaca50b3, 0x675b5015, 0x0f924488, 0x453aaff3, 0x1f2236b4, 0x7415f7bc, 0x2e9b6a50, 0x4ec84f58, 0x95c70e14, 0x699a9833, 0x5a550933, 0xb7c2105f, 0xb3e5da91, 0xa8ee3cf7, 0x39ed39a7, 0x56968853, 0x4e134ad1, 0x6e9fe895, 0x295454f2, 0x096c319a, 0xbb94a7e7, 0x634a627f, 0x22106315, 0x4e8ce14c, 0xcb27f796, 0x32f54538, 0x77b88021, 0x7f352d1a, 0x7c72c2f3, 0x1336496a, 0x108bf300, 0xdfb97dba, 0x5027a576, 0xdb926660, 0x56666863, 0xc1879c2c, 0x876599d6, 0x9237412a, 0xb1fd9982, 0x04c47adf, 0xe3b33510, 0xac3ff9aa, 0xcce46ff1, 0x554eb4db, 0xd6e3b996, 0x5106ba01, 0x2a7dc00e, 0xfa58c795, 0x308cbdfa, 0x43253e75, 0x97e6a7c7, 0xf83e886a, 0xc8ed9a72, 0xffe67a8f, 0xbb088044, 0x9e45d2d3, 0x3b5bc70d, 0x4a84c1b2, 0x0908fb40, 0xf6cf9316, 0x089986d2, 0xb358e021, 0xd77ff93b, 0xd03062e0, 0x5c044518, 0x9c557dea, 0x90a4a40b, 0x8e6650b3, 0x549e79ac, 0xf7fa54f3, 0x6c0c6b1e, 0xbbe34ce7, 0x8a7ecc8a, 0x7ee66b62, 0xf983b274, 0xa2d5c6bb, 0x0365eab6, 0xea711268, 0x882172c9, 0x8be37923, 0xb217245a, 0x04643723, 0x55b4f658, 0x441bbe38 }, // Message 3 - { 0xfa45199e, 0x21b8e813, 0x6ca29c4c, 0xb7165335, 0x538f25e1, 0x5340bc94, 0xfee1d8f5, 0x33a4dd48, 0x8c91688f, 0x1424928e, 0xa42dd26a, 0x584a91d5, 0xde3a8a9a, 0xcd5940cc, 0xd22ae956, 0x5ad1a145, 0xabccf3e0, 0x0a43a19c, 0x01dc77a3, 0x746a47f8, 0x16c28528, 0xe8641692, 0xdae45f39, 0xddec1a36, 0x7e18a1cb, 0xa28ab236, 0x0302e70c, 0xed1fbda8, 0xdf23e52a, 0x945c375e, 0x7c35d8da, 0xec080cb3, 0x8d55eb5b, 0x222f6ab4, 0xf742aa49, 0xa89b3a75, 0x581b728e, 0xf0c02e05, 0x4be1f1ed, 0xe3000e8c, 0x7a6d642d, 0x454e0a78, 0x72718870, 0x1daabb07, 0x2f2916c1, 0x99d854a1, 0xb680961a, 0x0555f41f, 0xc117c2d6, 0x7cf1156a, 0x82f8c610, 0x0b2129a3, 0xa250eb75, 0x89bb4040, 0xf0fab8ab, 0xab4a00e4, 0x5642d1a3, 0x3a8c0552, 0xf1251a2a, 0x93f04b23, 0x62a6a308, 0x4258d041, 0xca347fef, 0xaf81466a, 0x1d26e962, 0x5ef34e17, 0xdeca4e68, 0x1e60cc38, 0x828fac7e, 0xfd5b5d4d, 0x3082d692, 0x914d8070, 0x8a376cbd, 0x6a875af9, 0x27825817, 0xce73030b, 0x1939c849, 0x95e9c475, 0xe469e8f8, 0xf4c39bb5, 0xa40677b6, 0x58ee1cdb, 0x7fd86c94, 0x4267db7a, 0xde52a266, 0xc73a200b, 0x04dde6d6, 0x031f5b47, 0x7ed8ffbe, 0xc8f1b319, 0x41066d4f, 0x60e2bb07, 0x068536b1, 0x9a2fed58, 0x85739a46, 0x3b0f16de }, // Message 4 - { 0x0ad48b36, 0x949c5fbe, 0x47df6bb2, 0x8dd75dc5, 0xe288cd71, 0xad15495a, 0x57428037, 0x7048c393, 0x4586e0a6, 0xf55df51d, 0x96650b5a, 0x552e0874, 0xfde91454, 0x7af4e7d7, 0xece36383, 0x29593e75, 0x7016c4ab, 0xdc5b5006, 0xaefe77ef, 0xcdfc7321, 0x6bccc4fb, 0x19605e14, 0x92d55392, 0x176f4a24, 0xf9619ff1, 0x6b119a11, 0x56530cbc, 0xbf046d9c, 0xf8468d64, 0xde8bf5d1, 0x2648704c, 0x19bc4fe8, 0x6b9d4501, 0x5c708ad7, 0x454b90d1, 0xeccebcba, 0x2c81861a, 0xdf330398, 0xb8a6a35f, 0xefc4c75e, 0x1c605049, 0x4d8155a9, 0x021dff92, 0x01f6e274, 0x43472025, 0xae429f76, 0xfd193375, 0x280c23c2, 0x200f0bde, 0x9f04c066, 0x657c2919, 0x5fd53a29, 0xcf0cc9fa, 0x40f79de0, 0x325e5f34, 0x600a6c77, 0x24aac398, 0xaef5d0a7, 0xf5cf51d0, 0x9f3ca128, 0xf134c6a3, 0x51d63e37, 0x9717f4c7, 0x4b0d2834, 0x2899d9f5, 0x45587051, 0x67b226c0, 0x5d6c38e9, 0x1465e434, 0xe6c984f0, 0xdbe15b76, 0xa9482eec, 0xe47df7d4, 0x805904bc, 0x945e4ef0, 0xace8eece, 0x25c944bd, 0x479bcb0d, 0x11d233b4, 0x57b379ad, 0x274f883d, 0xc4d92b5d, 0x13442f19, 0x38172f9e, 0xc442b5a3, 0x1a2ca4e2, 0x37c1acc6, 0x32c06c07, 0x0a48701c, 0xa35b7fc9, 0xf389ee99, 0x09baa0db, 0xe4e96f60, 0xd7e36530, 0x61144c55, 0x7362bca6 }, // Message 5 - { 0x8629bd73, 0x1b1475ba, 0x583f425e, 0x21a2189c, 0x4ffb0910, 0x1f1d93cd, 0x03dccd81, 0xc9c70b96, 0x2109c5c0, 0x9cdb087f, 0xdc2ec042, 0x6403868f, 0x9e5b994e, 0x42f54238, 0x87d73cca, 0x83fde6a0, 0x16f6740b, 0xa2955350, 0xc0da3132, 0xf4d7501e, 0x50cfff8b, 0x76f0f0f1, 0xe4e55ede, 0xb10f85b8, 0x9240924e, 0xb78b6f4a, 0x9ea9d535, 0x7f826364, 0x12627a1f, 0x7f9fd80d, 0x2ce28318, 0x2482b7f1, 0xf38b2df2, 0x831c93c9, 0xc58bf08d, 0x34b4e81d, 0xb6bcafbc, 0x15c44dde, 0xa76803e2, 0x32aed046, 0xb7c53573, 0x7b7a42ca, 0xbea2e6f5, 0x3dba3501, 0x25c940e2, 0xa8ba546a, 0x05740fa1, 0xf75952d6, 0xfdbe9c0d, 0x153a3659, 0xc4fd9a18, 0x309f889e, 0xbf4b301e, 0xaae9f765, 0x5bd0ce66, 0x57974080, 0x1a002b18, 0x53b86bce, 0x707d0da8, 0x5071dd78, 0xbd9fa428, 0xd09110e4, 0x2ccfe58f, 0x845226aa, 0xa857a860, 0x3ccccec7, 0x19a79959, 0x9910eaff, 0xd20c6529, 0x5fb0aa3e, 0x79594eee, 0x6a602474, 0x19e4934e, 0x05315ea9, 0x445be87a, 0xec78a296, 0x389556ba, 0xfb93aa16, 0x428b8ff6, 0xbbce5db6, 0x31b0d70e, 0x2e571c80, 0xea1352a5, 0x5a21aecd, 0x3ca2276e, 0x90a83c61, 0x2206b059, 0x5880df28, 0x604bff17, 0xac83bc48, 0x79ae9f2f, 0x2dd123c0, 0x370b4cb7, 0x87ff329d, 0xd337ff0c, 0x5d18e3f8 }, // Message 6 - { 0xa2e254b0, 0x6884b005, 0x24418c11, 0x9908ca41, 0x4bb60047, 0x8706344b, 0xcf1811aa, 0xc08b6acf, 0x9b1e9906, 0xc581c966, 0x4c8f5089, 0x2d12433e, 0x8a4fee82, 0xa4cd4bef, 0x191110bf, 0x16c6e0c2, 0x4bb8f64f, 0x66cd0f33, 0x7149b273, 0x84607692, 0x4065a925, 0xe4645988, 0x5a167e25, 0x68b53a54, 0xb0d800cb, 0xf7c3b213, 0xb47e214e, 0x8f3af683, 0xd8859f9f, 0x89a1fe53, 0xa39a3e89, 0x0b1ae43c, 0xa370d23d, 0x14601402, 0x83609e47, 0x240257e6, 0x0cf0be1b, 0xe7702330, 0x35ed27f4, 0xacf0000f, 0xf4c7083e, 0x6c7900de, 0x0bc038ef, 0xc587eb2d, 0xe1b056da, 0x2b6402a3, 0xa40c06bd, 0xf1fb6ef1, 0x1c51b0e2, 0xaf3a1c3c, 0xa4d59878, 0x778655d5, 0x2ff3ad3f, 0x7abeece6, 0xafef0177, 0x268e66f2, 0xeed5a22d, 0x05b074c5, 0xdbc62381, 0x81a76413, 0x8ed26f2f, 0xf68087d6, 0x77fbfe7e, 0x573b27b7, 0xb1e682b2, 0x91967fdd, 0x9d79fd4f, 0x2a7056e2, 0x24ddb17e, 0x5da9e4ea, 0xbff64981, 0x6eddbefd, 0xbc7ef3c3, 0x2094f3bd, 0xf4459273, 0x7e3ddda2, 0x8db553a8, 0x368d6f02, 0x0f365f00, 0x57fa4e43, 0xbe9dc56a, 0x563e0321, 0x7f02c833, 0x0883c3c4, 0x8d4ac3f7, 0xf360c8e5, 0xd0ad805c, 0x4d88cfa2, 0xd72e7019, 0x6a1694f0, 0xd764a4d5, 0xa5a1d620, 0x35192fdb, 0xbd445089, 0xa3f2555a, 0x33cca47e }, // Message 7 - { 0x7f4aa4b6, 0x3f60bc1f, 0x8f5c47d3, 0x3ab0a3d5, 0x7ac05847, 0x8455c8f9, 0x3fbe44da, 0x1aa38001, 0x7ecf7e66, 0xe10a8dc0, 0x4d8e0363, 0x292e6ef5, 0x318ff967, 0x6768981e, 0xd274c24a, 0xba72e572, 0xe5126a44, 0xb6e1aff1, 0xb5ee83d9, 0x806d15fb, 0x351a6a0d, 0xf385c53a, 0xbbdfafbd, 0x068040fa, 0x55bd7aa1, 0x09706c8a, 0xeed7f001, 0x0576a269, 0x4991bba8, 0xf5d63ca7, 0xb9090809, 0xefdb9d01, 0x0e569a5d, 0x88198cdf, 0x23f27b60, 0x2989e3aa, 0x63ac43eb, 0xfa787992, 0x7adeda6d, 0x45e2bb92, 0xcfbff8c3, 0xe530dcfb, 0x7814b3d4, 0x9c1dae62, 0x9a54e8fe, 0x7236dad2, 0x6f15b2dd, 0x16c31a83, 0x68195746, 0x5e09a6cc, 0x32296c82, 0x0430e96b, 0xa263ea48, 0x88fcb01b, 0x0043a382, 0xb943a56e, 0x6f2ebeea, 0xe02e2b97, 0x27aa6253, 0xc9fab5ee, 0x4417fa4f, 0x23b9d4b6, 0x2188b5cc, 0x62be7204, 0xa4e92917, 0x3e41e576, 0x3ded898b, 0xe5d2c291, 0xadc005fa, 0x77cf5a42, 0x602ee82e, 0x56380874, 0x3ef35e6f, 0x13974b7b, 0x12c8348e, 0xd9b0e727, 0xe12ac166, 0x959fe991, 0xa3e25dab, 0xf48ea55e, 0x03238261, 0x95753eec, 0x99f5e91d, 0x6e96df33, 0x8e7513a6, 0x35f05687, 0x795213e2, 0xe05e92a7, 0x4a379aa3, 0x3e367ba3, 0x090b5687, 0xe54fd5c1, 0x517245e4, 0x3b2fc347, 0xaec350e3, 0x53fa4f7d }, // Message 8 - { 0xba79ce1e, 0xdf957fb6, 0x0e69371c, 0x21cd0be9, 0x91d15f10, 0x1e284ef7, 0x13f695f0, 0x048174ce, 0x82653c98, 0x480739a3, 0x6b6309e8, 0xf259653b, 0x903d4788, 0xe5ff123d, 0xefb928c6, 0x3f8ab213, 0x0f004d7d, 0x1ef43198, 0x6fb3f8a0, 0x71a4e231, 0x5e017ce7, 0x0fc76394, 0xf9fda347, 0xb9d4dd95, 0xcb772d7a, 0x2f4a8728, 0xcc1fd8c5, 0xe623da36, 0xf02e2420, 0x3d81f71e, 0x2636fa6c, 0xceb47b75, 0xc16ee05c, 0xe453e3ce, 0xb5c328ea, 0xb7346190, 0xa5b78c76, 0xae1435b7, 0x3fe109e7, 0xc68a3991, 0x99dd7710, 0xa4cc1cf3, 0x7096fc5e, 0x9be4d5e7, 0xd1cc0c6e, 0x67a58657, 0xdd3fe831, 0x572a115a, 0x8e5ccdf2, 0x61b1f852, 0x9b7ef162, 0x11e052bb, 0x714bdc57, 0x3f4465cc, 0x59a1f45c, 0x8a7f8ca7, 0x8a5ea958, 0x66497d54, 0x45be0a42, 0xe08d427d, 0x1a043c7e, 0x00c36d56, 0x12e397fb, 0xdbb3066a, 0xe9784feb, 0x7ccb7d64, 0x5649d225, 0x04dae5a6, 0x7d1506ca, 0xf375bd50, 0x1610b9ab, 0x146aa493, 0xedb2cc41, 0x49992205, 0x89815982, 0x0affa370, 0x3022da89, 0x55f169e1, 0x136b1c2e, 0x19ae17cb, 0x02522159, 0xb08c3c33, 0x067e7f17, 0x0df72542, 0xc536df95, 0x0cf4d791, 0xc47d7f7f, 0x0f4fd915, 0x65341546, 0x65256b8f, 0x8fd2f1ad, 0x40f7b93d, 0x4d7e2e52, 0x625f7ff1, 0xbc4ba910, 0x72dc12dd }, // Message 9 - { 0xd8d0816c, 0x0a23556a, 0xf4bed43e, 0xb6db0599, 0xff114899, 0x65c35c4f, 0x879a6f90, 0xa09c7ac9, 0x86ff9986, 0xcad84d99, 0xd6528759, 0xed5ba410, 0xe033ec61, 0x73e157ee, 0x88847f4a, 0x8f6dc0aa, 0x967e6f66, 0x5a06473c, 0x28f25f15, 0x2a2f1a72, 0x55bba8d3, 0x23132590, 0xb30a92e8, 0xf910db46, 0xf1abc0b4, 0x8453c659, 0x189edfc9, 0xee0afacf, 0x53112765, 0xb5a314ad, 0x1042581c, 0xce91ea41, 0x2dbc0b0f, 0xa6967c0d, 0x745b3433, 0x64f76890, 0xa208aec9, 0x8b5b0589, 0x9f03b037, 0x5732a80b, 0xab015e91, 0x86e40797, 0xbba1e8b1, 0xd6698112, 0x157f1d63, 0x66617f33, 0x60d7f860, 0xee40dcfd, 0x0b38a943, 0x8448532e, 0xf14fc44e, 0x6c32e29c, 0xd7fc3fd0, 0x8b2d4860, 0x1a8c16be, 0x7e7565ab, 0xe1cd1ed7, 0xde9b3963, 0xe28133a2, 0xb4ffd9e4, 0x18b61f1e, 0xcdce746d, 0x903e318d, 0x817fb9f1, 0x3d08714e, 0x374aa438, 0x253b72fc, 0x922cb88d, 0x33d13a88, 0x41aca7a3, 0x19c31f12, 0xe903c78d, 0x615ccd7b, 0x1af53245, 0x6baecb63, 0x4c825acf, 0x68b05156, 0xf365c4bc, 0xaccfddba, 0xb9cf7626, 0x84da2a56, 0x7e003cd4, 0x3616aaa0, 0xda4a5242, 0xd0b3b1ec, 0x2fb6a77d, 0x36cf0925, 0xd168c4b0, 0xc6855e2a, 0x622e6ddd, 0x2c87168e, 0x60647ac9, 0xf8d92b07, 0x7e2db3c8, 0x93050b32, 0x21417980 }, }, - }, - { /* Case 5 */ - .iv = { 0xd9, 0x12, 0xb3, 0xf5, 0xdf, 0x64, 0xfb, 0x7a, 0xc8, 0x87, 0xd9, 0xc1, 0xdd, 0x23, 0xf4, 0x7c }, - .p_data = { - .Y = { 0x1517abc5, 0xda0a07a7, 0x50a2630e, 0x580d6350, 0x24dca21d, 0xcc3acfe2, 0x7d44905c, 0x022aaf82, 0xb81555e9, 0xd3782c5f, 0x0496e1ca, 0x397a5a9c, 0xba536806, 0xf6099ee9, 0x6c738611, 0x6e141ced, 0x521bae67, 0x525cbad6, 0xf5f3ed2b, 0x0d566cb7, 0x188ff23f, 0xf97e5be8, 0x72531f32, 0x29f0bbb7, 0x935a7186, 0x6ee0abc9, 0x4a680783, 0xd3bc67aa, 0x0623a3cd, 0xb8e6a152, 0xfe9e13dd, 0x1cc8bec0, 0x800c3eda, 0xbb137d8f, 0xcac2fe1e, 0xf4a50bf5, 0xf28e0d3d, 0x40f8279e, 0x3f62bb10, 0x177d1550, 0x1df24c80, 0x7e5dd8f0, 0xe9d567fa, 0x81529deb, 0x3d0a7df5, 0x0d603614, 0xf4ae7363, 0x506a3966, 0xce69b06f, 0x57c1eba6, 0xcb2a4c49, 0x33ad633f, 0xb520c7a0, 0x44c615f3, 0xdd38bcec, 0x1694bff4, 0xec7f13fe, 0xd9750709, 0xd8845ff8, 0x766f2f4c, 0x4ca8e68b, 0xe9b2814d, 0x3be493ef, 0x46d960d6 }, - .M = { 0xaa8caac5, 0xd9f24cde, 0x0e4d95f0, 0xc8cbcac2, 0x9d4a096f, 0x18fde814, 0x706a6052, 0x1ddcc861, 0xe3c04364, 0x32f7b992, 0xb15e44aa, 0x050328bb, 0xf25b9408, 0x92e786ed, 0x01092f61, 0xa73c035b, 0xf122a068, 0x70a54bab, 0xcc76414e, 0xb5ee0849, 0x1cc247d3, 0x62d427aa, 0x8a078598, 0x14cb69d1, 0xa40f51ea, 0x42985516, 0xab575a8a, 0x59d170a5, 0xfa1e17e2, 0x05b9ff3a, 0xb0ab5ced, 0x07a74f23, 0xbe8f8b39, 0xd97d55ed, 0x69f71138, 0x49503e00, 0xbbce0e16, 0x1229c8fe, 0xc2e9b9da, 0xb80a1d50, 0x5017a493, 0x2e0a575f, 0x0671e0fe, 0x6ab56bbb, 0xc642df1d, 0x7f901396, 0x87e287e7, 0x917017b4, 0x4572fd68, 0x140ccde3, 0xc1b13adf, 0x46b315e1, 0xabe3cbc5, 0xb4a7543b, 0x736514dc, 0xf18117ae, 0xfab70fb2, 0x5fe7b7cb, 0x3f6bd75c, 0xec1da247, 0x48216c7c, 0x1ef1fcaf, 0x63c85a99, 0xa7dfdc9a }, - .Rb = { 0xfd6df2a9, 0x2f001a69, 0xb5ec8e9f, 0xab1dd561, 0x8582ce6f, 0x4cf430da, 0x08775576, 0x0d498fa1, 0x78b2729a, 0x15df619c, 0x72636ee8, 0xf4f3efee, 0x6b4b0c17, 0x04094180, 0x97cc5f2c, 0xe4aef62b, 0x2393f3a9, 0x9ae3fe26, 0xfff62fb0, 0x462569a8, 0xa2356966, 0x4d25a0db, 0xbc59613a, 0xc3ac647c, 0x2b2280a0, 0x8074898f, 0x3b5547d3, 0xdf141401, 0x359c89cf, 0xe3c361f6, 0xd52d786f, 0x15254b3a, 0x43b486f6, 0x934c815e, 0xf0203620, 0x8df19844, 0xb82debac, 0xd8a81748, 0xfbc7a424, 0xcbb7d6fc, 0x7cef838e, 0x3cd70cdd, 0xa1019630, 0xbe2421eb, 0xa9a951e2, 0x0284e983, 0xf84d5c59, 0x02c038dc, 0x9d5bee73, 0x5011288a, 0xc82401e1, 0xaf272849, 0xa5adb2b3, 0x33b9e9c7, 0x14bf3b82, 0x99b707b4, 0xe276bdbc, 0x2d0dc0d1, 0x66df46f5, 0x5a843c54, 0x11d6dfd8, 0x15e56656, 0xa8565021, 0x71cd14b4 }, - .M_prime = 0x988cbbf3, - .length = 63, // 2048 bit - }, - .expected_c = { 0x6d, 0x68, 0x5d, 0x15, 0xe7, 0x44, 0xcb, 0x67, 0x0c, 0x86, 0x0e, 0x53, 0x96, 0x50, 0x8f, 0x4e, 0x16, 0x48, 0x04, 0x61, 0xca, 0xdb, 0x70, 0xf8, 0x5b, 0xcc, 0xf9, 0xbc, 0xc4, 0x6c, 0xbb, 0x02, 0x0a, 0xa1, 0x65, 0xef, 0xb0, 0x8b, 0x15, 0xb1, 0x99, 0x16, 0xb5, 0xb8, 0xc5, 0xb1, 0x17, 0x83, 0xe7, 0x80, 0x39, 0xe3, 0x52, 0x1f, 0x85, 0x92, 0xbf, 0x61, 0x79, 0x27, 0xc5, 0x25, 0x01, 0x20, 0x06, 0x46, 0xab, 0x55, 0x19, 0xf7, 0xfa, 0x80, 0x29, 0xef, 0xa4, 0xa9, 0xe0, 0xca, 0x8b, 0x6f, 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 0x4c, 0xfb, 0xcf, 0x8b, 0x5a, 0xff, 0x17, 0x3a, 0xb6, 0xd4, 0x53, 0xae, 0x95 }, - .hmac_key_idx = 2, - // results of message array encrypted with these keys - .expected_results = { - // Message 0 - { 0x7b22c206, 0x46ae989a, 0x6456c231, 0x2183bc5c, 0x92bdea51, 0x13417e21, 0xde38f455, 0xcc113b62, 0xa787a973, 0x8672490a, 0x5adf07e5, 0x3585f4ce, 0x9861c55d, 0xcfd465d0, 0xd38daf34, 0x49c1e9e4, 0x8f6e74c6, 0x61d6e2c8, 0xef486e63, 0x87da49e5, 0xfba091e3, 0x9775901b, 0xd0bafdd4, 0x8ceab0e0, 0x7214d792, 0x8e96474d, 0x6a30e56d, 0x27aeb6dd, 0x1e0a13c5, 0xc70bf66a, 0xabdb794b, 0x79615211, 0xec31b142, 0xc7e78250, 0x7b3436f1, 0x836e97a3, 0x18f69feb, 0x5f7ae9da, 0xa3c8aaea, 0x6e4a0942, 0xf046b062, 0xe173890e, 0x73011a58, 0x7a2e2e75, 0xcafe8105, 0xa7ef42da, 0xd8bf1dd3, 0xca3ef9c1, 0xa385d157, 0x1bc73056, 0x08f45713, 0x8f03b489, 0x2e3278c5, 0x0e085028, 0xab6d3a8b, 0xf875ebe7, 0xabafe41c, 0x0e6588a6, 0xaeb530ac, 0xae2deb58, 0x37a7d1e8, 0x4ac42801, 0x84838ea8, 0x9807a9c7 }, // Message 1 - { 0x189ece24, 0x588c859b, 0x4d3c4fe2, 0xaba143e4, 0xa3e69b16, 0xe892939c, 0x30b96777, 0x275fa922, 0xa090a7a4, 0x5ea8df3a, 0x4e63ace7, 0xb64336a0, 0xef87769e, 0x734e623a, 0xefec6481, 0x404f1ffa, 0x0eb53616, 0x5f641f9b, 0xc8ca81e5, 0x6562bd99, 0x90092de8, 0x756cd3da, 0x6d0e99a3, 0xc0887d8f, 0x35d380b2, 0x9f145969, 0x4e0d55b0, 0xa116d5a1, 0x3c60be2b, 0xcd970c74, 0x10086e47, 0x59fe8ec7, 0x642c179b, 0x5ba3646a, 0x849ad310, 0xf3fa09ce, 0x8b691d8d, 0xf27f1c3f, 0xbe74426f, 0x3e18f1a9, 0xe4eee4a8, 0xa1c1a4b8, 0xff82d121, 0xb442aa78, 0x12fa04ac, 0x34bec6bb, 0xb0988597, 0x48e2d92b, 0x2ceb5756, 0x7ed5290a, 0x7d240f20, 0xc970a910, 0x8962e1c6, 0x76c99d2d, 0xd431a0b5, 0xaa1f84a6, 0x83f97dc8, 0x0ca52886, 0x7c9f003a, 0xd1c0547c, 0xaaef6bd0, 0x3c25ee0d, 0x8fbb2719, 0xa2d8e535 }, // Message 2 - { 0x842f8773, 0x98344f46, 0x56583e5d, 0xf87e2ad3, 0x0dacf1b1, 0x1ad44410, 0x57d1cc41, 0xab528173, 0xa0b497bb, 0xcc9ffdfe, 0xbba26264, 0xfe1f176d, 0x814f7757, 0x8a13bc51, 0x412036d0, 0xa6bdb540, 0x565e9a13, 0x556d394e, 0x5aafa0cc, 0xf39796eb, 0xa8a3ac8f, 0xb9dd179f, 0x1a6b04a8, 0x61f36111, 0xaf9c5b78, 0xd7b32762, 0x1c751ff9, 0x31a7c78f, 0xd2ed9fb5, 0x81c19261, 0x973af61d, 0x1767c39f, 0x1a974921, 0xcc5b404d, 0x4e83c304, 0xf60c3d9b, 0xba033aab, 0xeac94156, 0x1addc5d0, 0xb706577b, 0x77e4cfff, 0x2009a3bf, 0xd68739f1, 0xa67fc485, 0x3e87d453, 0x5f9360f3, 0x78736697, 0xb0bda2a0, 0x9f9ec632, 0x4bbf4c8e, 0x4cb613c0, 0x2985c43b, 0xbcc89045, 0xb44d377a, 0x9f3efdab, 0x03708d30, 0x8fcbe8fb, 0x25a68e46, 0xc7df4e31, 0xf5f2aaeb, 0x82693a70, 0xbe82063b, 0x16d49fc1, 0x14d4cc5c }, // Message 3 - { 0x2e2e90d9, 0x2de4fc9e, 0x3bbf80ec, 0x8b1b08d7, 0xbb0ca909, 0x2768e2fd, 0x6b120d64, 0x6d5acc4d, 0x10ac6fcd, 0xe5e4a5cc, 0xba41bfd7, 0xac7c4660, 0x07606976, 0xab87cf16, 0x7feeb177, 0x2acd9b2b, 0xa62382e1, 0xd402b527, 0x72dd3033, 0x38a93ab0, 0xd83b1608, 0xcc945333, 0x982cea7d, 0x9319041f, 0xc94d029c, 0xa6e87c8a, 0x173d3a35, 0xf4e70cc3, 0x8c2d4ad7, 0xfd802823, 0x545d5aef, 0x5234deaa, 0x926ac06b, 0xcd39f99d, 0x1cdd2e32, 0x0532f48c, 0x2e2cb6f7, 0x61d2358f, 0xb46f8636, 0xb7a25c52, 0x1ef22814, 0xcef40419, 0x07424471, 0x349b854f, 0xc936a63a, 0xe6a5d41e, 0x56690c91, 0xbf84aad4, 0x0151e023, 0xa4949a71, 0x38bbf6f0, 0xf1abdfb8, 0x1e8b818b, 0x10d67b20, 0xb150f729, 0x553ca2df, 0x9f7d178b, 0x3a863661, 0x76a4c9aa, 0x89cc0fe6, 0x62fea752, 0x42339488, 0xcf99ff81, 0x4e1aecfe }, // Message 4 - { 0x841f4980, 0x2cf046b2, 0x82e95cc2, 0xa47ebc7c, 0xea548361, 0x564ccec3, 0x2faf266c, 0x659471dd, 0x4bbeaa68, 0xb4c256a1, 0xb7171691, 0x38e03b80, 0x4278d5f9, 0x46b2501c, 0x17fd4074, 0x74de63cd, 0x597e3de8, 0xf49ab732, 0x3590c171, 0x412474f5, 0xcab54898, 0xd8b1b004, 0x44443aaa, 0x76d906d3, 0x9dec151c, 0xf58d2673, 0x9bf53ae2, 0x1da366d9, 0x309135cb, 0x0fa7c2d3, 0x64c6fa06, 0x2fd482d8, 0x42ecbf3c, 0x0b2059a9, 0xeaeeb86a, 0xad7ca190, 0xedfd71ea, 0x86899035, 0x9ec7ee43, 0xd6ed40c0, 0xa5f99f9c, 0x34f924b1, 0x70b03003, 0x698d7c34, 0xc1f0d5fc, 0x4fa2274a, 0x4db6e8ac, 0x6540723c, 0xa25dc0a1, 0xfea69928, 0x43b40634, 0x569e0518, 0x4e390450, 0xc44901b4, 0x90967b05, 0xd4916f29, 0xb04e38c6, 0x4bb3f4cd, 0x55a0e3cf, 0x4058a3ee, 0x07d9ce28, 0x46e2defd, 0x8039fee1, 0x03e662ad }, // Message 5 - { 0x89019435, 0x24c401fa, 0x4d7c4b63, 0x17bff47b, 0x95a39c40, 0xb7346f21, 0x2e0464b4, 0xc885b549, 0xa1951ca1, 0x8bee01ee, 0x6d077d2a, 0x538f67db, 0xf1eb9773, 0x57e86797, 0x189b0494, 0xf1011d51, 0x0e2592f2, 0xeabbc83c, 0xf0badf63, 0xd61f066d, 0x0b88110e, 0xc00883ec, 0xd4d157ac, 0xfccad14f, 0xfc326202, 0xdba0ccbe, 0xc8aa8a62, 0x17ccf405, 0xd62cd80c, 0x1ea7730e, 0xec66f387, 0xfbf6b135, 0x0f019e3e, 0x487948aa, 0xb6117873, 0x032aa30e, 0x095d8c24, 0x40839164, 0x68ba9af0, 0x87639199, 0xae153b7f, 0x2dcfcc37, 0xec71e709, 0xbd84076a, 0x2a96711c, 0x99e37df3, 0x0b22ddd6, 0xfadba214, 0x77d71182, 0xa68cfd81, 0x2aab3ec2, 0xce30169e, 0xc46d9aee, 0x5f1206b9, 0x4622ef37, 0x9d13fa6b, 0x480f58ff, 0xf965ee1f, 0x360d1e3b, 0x0613ee41, 0xcb720f23, 0xa1465579, 0x05c19d02, 0x38669af2 }, // Message 6 - { 0x432cf8ba, 0xaf3b700b, 0xb4b5ae74, 0xd1561ebd, 0x369b3869, 0xb76b7cb6, 0x0d7d1ef1, 0x3011b466, 0x1207ded1, 0x4885f193, 0xdae5f9b1, 0xfb450105, 0x052e9eba, 0xc7ec34a1, 0xdcc48d31, 0x24c859f1, 0x8329c06f, 0x21e7b2f8, 0x74afea39, 0xcd9ee06b, 0x51ba6020, 0x8e0be42d, 0x283c6b39, 0xcd3fc394, 0x4e8497e0, 0x5cee0cbe, 0x437a14fc, 0x30df6d23, 0x1272bdd5, 0xe26a86e3, 0xab0f6163, 0x36a692b3, 0x7c49e052, 0xd4e65c50, 0x15c2a394, 0xeb357b9f, 0xbb795751, 0xb72df6ee, 0xf238e9f7, 0xa1ff9dfb, 0xa753208a, 0x7f78fd97, 0x0ff1c41d, 0xb3c4c174, 0xcf395664, 0x6676ba72, 0x849f7e7a, 0xac0473d7, 0x9b72d66e, 0x8fb69c14, 0x9e8878b2, 0x2dedf30d, 0xc8af55f5, 0x3f3d2083, 0x7fe947fe, 0x0a210322, 0xb92ab78d, 0xeb34a0ca, 0x39334df1, 0x773e3c8e, 0xa90774e1, 0xca705a5a, 0x218f28b7, 0x475ebdb0 }, // Message 7 - { 0x8c5c7218, 0x958a48f2, 0x1c20099a, 0xa9b5c3e9, 0xfca5473d, 0x746376da, 0xf575f9f4, 0x6b2282a0, 0xa31a843d, 0x66355730, 0x8988ca45, 0x2fb33584, 0x4670b87f, 0xe581a153, 0x7e710075, 0x995cebc1, 0x2f19171e, 0x8de26c2f, 0x09a125b4, 0x690d908a, 0xe44c5c98, 0xe9c76193, 0xb789803c, 0xcc76e6ff, 0x6a39b96f, 0x831c32de, 0x48c47e27, 0x28368d9b, 0x586f2c41, 0xaa95608a, 0x83689888, 0x406dae8c, 0x8b25ef7d, 0x0b4e553e, 0x64db76c6, 0x58a4f783, 0x63220f5c, 0x2ddff5db, 0x18e2dfea, 0x125b86c3, 0x90414551, 0x265b269b, 0x321ef362, 0x922f8e4a, 0xe43611cb, 0xd47a5216, 0xe6004e4f, 0xa6811400, 0x431e3e45, 0x8a8b1184, 0x64c52dd2, 0x12fdc22b, 0x0bd34023, 0x9a7fa998, 0x7495bc65, 0x0644fb9c, 0x2dddf147, 0xa3b17ca5, 0x828bc41b, 0xab194108, 0x464bbf74, 0xaa2b4852, 0x93c6adf8, 0x254ba88d }, // Message 8 - { 0xaf33125e, 0xcd61f762, 0xd52dcbea, 0x3b99e7a6, 0x431be6ef, 0xddec4ed5, 0x7cb4f2c6, 0x92ffb45e, 0x973c46af, 0xc5581b3b, 0x5bbab1db, 0xa6680da8, 0x30f38ce4, 0x1d93e00e, 0x0ceef86a, 0x07534741, 0xa9f570c9, 0xd8cf633e, 0x5c4ba0c3, 0x0968158a, 0xba0a4e25, 0x4a44017e, 0xdc1c6132, 0xae608ca8, 0x32c543ea, 0x2950f268, 0x7c6eda54, 0xbab7a023, 0xf36585ee, 0xdf0c66f3, 0x4a1ba502, 0xcac38574, 0x36e869fc, 0xb5509b0d, 0x1c088009, 0x178f1c26, 0x3c1cc513, 0x66a3141e, 0x6ddffe33, 0xe4417aee, 0xbdb6d8d3, 0xd9fe0bd2, 0x1262d566, 0xeda0ae23, 0x48f00099, 0xb0c61240, 0x46cc7c83, 0xa6d3d845, 0x9feb70de, 0xefa2f7ed, 0x5857fd55, 0x9bd3508f, 0x1c1bb350, 0xb31849c8, 0x51dfa657, 0xdd9029bc, 0xd1869778, 0xaf978c3f, 0x8c33cec1, 0x0c739f65, 0x36c69fc2, 0xe2874fe5, 0x8e41bf9e, 0x2e4bfd1e }, // Message 9 - { 0xf5d26d39, 0xe7673325, 0xf8051f90, 0xef04d0df, 0xa14bc15d, 0x830af6a3, 0x3e22caed, 0x4ae14f16, 0x9bf6bc8a, 0xe8bdf224, 0x10fafc74, 0x2dd86523, 0xa5361fc8, 0x67f39978, 0xbea39d9a, 0x93a68e79, 0x7306e87a, 0x6b702aeb, 0x6b11c96e, 0x2ea1315a, 0x6d9e46e8, 0x499c0493, 0xb2c670de, 0x684c0b90, 0xcfe86873, 0x750c4b73, 0x6d0d35e5, 0x5eb2a6b3, 0x7d2a2cfb, 0x2c5db123, 0x170d1d83, 0x6b4abe2a, 0x0351e500, 0xe2377316, 0x809b6ed5, 0xabb0c00d, 0x0d0e4060, 0x8910784a, 0x4f46fa98, 0x089aba27, 0x05b71b1a, 0xd77b3b8e, 0xc50c7f92, 0xeedb077a, 0x2adaf56e, 0xd3a00ea4, 0x452f597f, 0xe29b5e3a, 0xeb50742c, 0x502948d0, 0x7c0c6f6d, 0x847fa4ce, 0x8fa07655, 0x06ba7b82, 0x511e8807, 0x24e059f0, 0x85a49a42, 0x56e9bcf4, 0xb38ab575, 0x18be81df, 0x4175bad7, 0xf2cfb405, 0x99caaec9, 0x4f81f12f }, }, - }, -}; diff --git a/components/esp32h2/test/test_ds.c b/components/esp32h2/test/test_ds.c deleted file mode 100644 index e57d8a2cec..0000000000 --- a/components/esp32h2/test/test_ds.c +++ /dev/null @@ -1,382 +0,0 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// 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. - -#include "unity.h" -#include "esp32h2/rom/efuse.h" -#include "esp32h2/rom/digital_signature.h" -#include "esp32h2/rom/hmac.h" -#include - -#include "esp_ds.h" - -#define NUM_RESULTS 10 -#define DS_MAX_BITS (ETS_DS_MAX_BITS) - -typedef struct { - uint8_t iv[ETS_DS_IV_LEN]; - ets_ds_p_data_t p_data; - uint8_t expected_c[ETS_DS_C_LEN]; - uint8_t hmac_key_idx; - uint32_t expected_results[NUM_RESULTS][DS_MAX_BITS/32]; -} encrypt_testcase_t; - -// Generated header (components/esp32s2/test/gen_digital_signature_tests.py) defines -// NUM_HMAC_KEYS, test_hmac_keys, NUM_MESSAGES, NUM_CASES, test_messages[], test_cases[] -#include "digital_signature_test_cases.h" - -_Static_assert(NUM_RESULTS == NUM_MESSAGES, "expected_results size should be the same as NUM_MESSAGES in generated header"); - -TEST_CASE("Digital Signature Parameter Encryption data NULL", "[hw_crypto] [ds]") -{ - const char iv [32]; - esp_ds_p_data_t p_data; - const char key [32]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(NULL, iv, &p_data, key)); -} - -TEST_CASE("Digital Signature Parameter Encryption iv NULL", "[hw_crypto] [ds]") -{ - esp_ds_data_t data; - esp_ds_p_data_t p_data; - const char key [32]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, NULL, &p_data, key)); -} - -TEST_CASE("Digital Signature Parameter Encryption p_data NULL", "[hw_crypto] [ds]") -{ - esp_ds_data_t data; - const char iv [32]; - const char key [32]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, NULL, key)); -} - -TEST_CASE("Digital Signature Parameter Encryption key NULL", "[hw_crypto] [ds]") -{ - esp_ds_data_t data; - const char iv [32]; - esp_ds_p_data_t p_data; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, &p_data, NULL)); -} - -TEST_CASE("Digital Signature Parameter Encryption", "[hw_crypto] [ds]") -{ - for (int i = 0; i < NUM_CASES; i++) { - printf("Encrypting test case %d...\n", i); - const encrypt_testcase_t *t = &test_cases[i]; - esp_ds_data_t result = { }; - esp_ds_p_data_t p_data; - - memcpy(p_data.Y, t->p_data.Y, ESP_DS_SIGNATURE_MAX_BIT_LEN/8); - memcpy(p_data.M, t->p_data.M, ESP_DS_SIGNATURE_MAX_BIT_LEN/8); - memcpy(p_data.Rb, t->p_data.Rb, ESP_DS_SIGNATURE_MAX_BIT_LEN/8); - p_data.M_prime = t->p_data.M_prime; - p_data.length = t->p_data.length; - - esp_err_t r = esp_ds_encrypt_params(&result, t->iv, &p_data, - test_hmac_keys[t->hmac_key_idx]); - printf("Encrypting test case %d done\n", i); - - TEST_ASSERT_EQUAL(ESP_OK, r); - TEST_ASSERT_EQUAL(t->p_data.length, result.rsa_length); - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->iv, result.iv, ETS_DS_IV_LEN); - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_c, result.c, ETS_DS_C_LEN); - } -} - -TEST_CASE("Digital Signature start Invalid message", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = { }; - ds_data.rsa_length = ESP_DS_RSA_3072; - esp_ds_context_t *ctx; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(NULL, &ds_data, HMAC_KEY1, &ctx)); -} - -TEST_CASE("Digital Signature start Invalid data", "[hw_crypto] [ds]") -{ - const char *message = "test"; - esp_ds_context_t *ctx; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, NULL, HMAC_KEY1, &ctx)); -} - -TEST_CASE("Digital Signature start Invalid context", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature RSA length 0", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 0; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature RSA length too long", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 128; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature start HMAC key out of range", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; - esp_ds_context_t *ctx; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY5 + 1, &ctx)); - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_start_sign(message, &ds_data, HMAC_KEY0 - 1, &ctx)); -} - -TEST_CASE("Digital Signature finish Invalid signature ptr", "[hw_crypto] [ds]") -{ - esp_ds_context_t *ctx = NULL; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_finish_sign(NULL, ctx)); -} - -TEST_CASE("Digital Signature finish Invalid context", "[hw_crypto] [ds]") -{ - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_finish_sign(signature_data, NULL)); -} - -TEST_CASE("Digital Signature Blocking Invalid message", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = { }; - ds_data.rsa_length = ESP_DS_RSA_3072; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(NULL, &ds_data, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking Invalid data", "[hw_crypto] [ds]") -{ - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, NULL, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking Invalid signature ptr", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; - const char *message = "test"; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY1, NULL)); -} - -TEST_CASE("Digital Signature Blocking RSA length 0", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 0; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking RSA length too long", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 128; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY1, signature_data)); -} - -TEST_CASE("Digital Signature Blocking HMAC key out of range", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = 127; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY5 + 1, signature_data)); - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_sign(message, &ds_data, HMAC_KEY0 - 1, signature_data)); -} - -#if CONFIG_IDF_ENV_FPGA - -// Burn eFuse blocks 1, 2 and 3. Block 0 is used for HMAC tests already. -static void burn_hmac_keys(void) -{ - printf("Burning %d HMAC keys to efuse...\n", NUM_HMAC_KEYS); - for (int i = 0; i < NUM_HMAC_KEYS; i++) { - // TODO: vary the purpose across the keys - ets_efuse_purpose_t purpose = ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE; - ets_efuse_write_key(ETS_EFUSE_BLOCK_KEY1 + i, - purpose, - test_hmac_keys[i], 32); - } - /* verify the keys are what we expect (possibly they're already burned, doesn't matter but they have to match) */ - uint8_t block_compare[32]; - for (int i = 0; i < NUM_HMAC_KEYS; i++) { - printf("Checking key %d...\n", i); - memcpy(block_compare, (void *)ets_efuse_get_read_register_address(ETS_EFUSE_BLOCK_KEY1 + i), 32); - TEST_ASSERT_EQUAL_HEX8_ARRAY(test_hmac_keys[i], block_compare, 32); - } -} - -// This test uses the HMAC_KEY0 eFuse key which hasn't been burned by burn_hmac_keys(). -// HMAC_KEY0 is usually used for HMAC upstream (user access) tests. -TEST_CASE("Digital Signature wrong HMAC key purpose (FPGA only)", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; - esp_ds_context_t *ctx; - const char *message = "test"; - - // HMAC fails in that case because it checks for the correct purpose - TEST_ASSERT_EQUAL(ESP32H2_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_start_sign(message, &ds_data, HMAC_KEY0, &ctx)); -} - -// This test uses the HMAC_KEY0 eFuse key which hasn't been burned by burn_hmac_keys(). -// HMAC_KEY0 is usually used for HMAC upstream (user access) tests. -TEST_CASE("Digital Signature Blocking wrong HMAC key purpose (FPGA only)", "[hw_crypto] [ds]") -{ - esp_ds_data_t ds_data = {}; - ds_data.rsa_length = ESP_DS_RSA_3072; - const char *message = "test"; - uint8_t signature_data [128 * 4]; - - // HMAC fails in that case because it checks for the correct purpose - TEST_ASSERT_EQUAL(ESP32H2_ERR_HW_CRYPTO_DS_HMAC_FAIL, esp_ds_sign(message, &ds_data, HMAC_KEY0, signature_data)); -} - -TEST_CASE("Digital Signature Operation (FPGA only)", "[hw_crypto] [ds]") -{ - burn_hmac_keys(); - - for (int i = 0; i < NUM_CASES; i++) { - printf("Running test case %d...\n", i); - const encrypt_testcase_t *t = &test_cases[i]; - - // copy encrypt parameter test case into ds_data structure - esp_ds_data_t ds_data = { }; - memcpy(ds_data.iv, t->iv, ETS_DS_IV_LEN); - memcpy(ds_data.c, t->expected_c, ETS_DS_C_LEN); - ds_data.rsa_length = t->p_data.length; - - for (int j = 0; j < NUM_MESSAGES; j++) { - uint8_t signature[DS_MAX_BITS/8] = { 0 }; - printf(" ... message %d\n", j); - - esp_ds_context_t *esp_ds_ctx; - esp_err_t ds_r = esp_ds_start_sign(test_messages[j], - &ds_data, - t->hmac_key_idx + 1, - &esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - - ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_results[j], signature, sizeof(signature)); - } - - ets_hmac_invalidate_downstream(ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE); - } -} - -TEST_CASE("Digital Signature Blocking Operation (FPGA only)", "[hw_crypto] [ds]") -{ - burn_hmac_keys(); - - for (int i = 0; i < NUM_CASES; i++) { - printf("Running test case %d...\n", i); - const encrypt_testcase_t *t = &test_cases[i]; - - // copy encrypt parameter test case into ds_data structure - esp_ds_data_t ds_data = { }; - memcpy(ds_data.iv, t->iv, ETS_DS_IV_LEN); - memcpy(ds_data.c, t->expected_c, ETS_DS_C_LEN); - ds_data.rsa_length = t->p_data.length; - - uint8_t signature[DS_MAX_BITS/8] = { 0 }; - - esp_err_t ds_r = esp_ds_sign(test_messages[0], - &ds_data, - t->hmac_key_idx + 1, - signature); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - - TEST_ASSERT_EQUAL_HEX8_ARRAY(t->expected_results[0], signature, sizeof(signature)); - } -} - -TEST_CASE("Digital Signature Invalid Data (FPGA only)", "[hw_crypto] [ds]") -{ - burn_hmac_keys(); - - // Set up a valid test case - const encrypt_testcase_t *t = &test_cases[0]; - esp_ds_data_t ds_data = { }; - memcpy(ds_data.iv, t->iv, ETS_DS_IV_LEN); - memcpy(ds_data.c, t->expected_c, ETS_DS_C_LEN); - ds_data.rsa_length = t->p_data.length; - - uint8_t signature[DS_MAX_BITS/8] = { 0 }; - const uint8_t zero[DS_MAX_BITS/8] = { 0 }; - - // Corrupt the IV one bit at a time, rerun and expect failure - for (int bit = 0; bit < 128; bit++) { - printf("Corrupting IV bit %d...\n", bit); - ds_data.iv[bit / 8] ^= 1 << (bit % 8); - esp_ds_context_t *esp_ds_ctx; - - esp_err_t ds_r = esp_ds_start_sign(test_messages[0], &ds_data, t->hmac_key_idx + 1, &esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP32H2_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); - TEST_ASSERT_EQUAL_HEX8_ARRAY(zero, signature, DS_MAX_BITS/8); - - ds_data.iv[bit / 8] ^= 1 << (bit % 8); - } - - // Corrupt encrypted key data one bit at a time, rerun and expect failure - printf("Corrupting C...\n"); - for (int bit = 0; bit < ETS_DS_C_LEN * 8; bit++) { - printf("Corrupting C bit %d...\n", bit); - ds_data.c[bit / 8] ^= 1 << (bit % 8); - esp_ds_context_t *esp_ds_ctx; - - esp_err_t ds_r = esp_ds_start_sign(test_messages[0], &ds_data, t->hmac_key_idx + 1, &esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP_OK, ds_r); - ds_r = esp_ds_finish_sign(signature, esp_ds_ctx); - TEST_ASSERT_EQUAL(ESP32H2_ERR_HW_CRYPTO_DS_INVALID_DIGEST, ds_r); - TEST_ASSERT_EQUAL_HEX8_ARRAY(zero, signature, DS_MAX_BITS/8); - - ds_data.c[bit / 8] ^= 1 << (bit % 8); - } -} - -#endif // CONFIG_IDF_ENV_FPGA diff --git a/components/esp32h2/test/test_sha.c b/components/esp32h2/test/test_sha.c deleted file mode 100644 index e15fe43522..0000000000 --- a/components/esp32h2/test/test_sha.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include -#include -#include "esp_types.h" -#include "esp32h2/clk.h" -#include "esp_log.h" -#include "esp_timer.h" -#include "esp_heap_caps.h" -#include "idf_performance.h" - -#include "unity.h" -#include "test_utils.h" -#include "mbedtls/sha1.h" -#include "mbedtls/sha256.h" -#include "sha/sha_dma.h" - -/* Note: Most of the SHA functions are called as part of mbedTLS, so -are tested as part of mbedTLS tests. Only esp_sha() is different. -*/ - -#define TAG "sha_test" - -TEST_CASE("Test esp_sha()", "[hw_crypto]") -{ - const size_t BUFFER_SZ = 32 * 1024 + 6; // NB: not an exact multiple of SHA block size - - int64_t begin, end; - uint32_t us_sha1; - uint8_t sha1_result[20] = { 0 }; - void *buffer = heap_caps_malloc(BUFFER_SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - TEST_ASSERT_NOT_NULL(buffer); - memset(buffer, 0xEE, BUFFER_SZ); - - const uint8_t sha1_expected[20] = { 0xc7, 0xbb, 0xd3, 0x74, 0xf2, 0xf6, 0x20, 0x86, - 0x61, 0xf4, 0x50, 0xd5, 0xf5, 0x18, 0x44, 0xcc, - 0x7a, 0xb7, 0xa5, 0x4a }; - - begin = esp_timer_get_time(); - esp_sha(SHA1, buffer, BUFFER_SZ, sha1_result); - end = esp_timer_get_time(); - TEST_ASSERT_EQUAL_HEX8_ARRAY(sha1_expected, sha1_result, sizeof(sha1_expected)); - us_sha1 = end - begin; - ESP_LOGI(TAG, "esp_sha() 32KB SHA1 in %u us", us_sha1); - - free(buffer); - - TEST_PERFORMANCE_CCOMP_LESS_THAN(TIME_SHA1_32KB, "%dus", us_sha1); -} - -TEST_CASE("Test esp_sha() function with long input", "[hw_crypto]") -{ - const void* ptr; - spi_flash_mmap_handle_t handle; - uint8_t sha1_espsha[20] = { 0 }; - uint8_t sha1_mbedtls[20] = { 0 }; - uint8_t sha256_espsha[32] = { 0 }; - uint8_t sha256_mbedtls[32] = { 0 }; - - const size_t LEN = 1024 * 1024; - - /* mmap() 1MB of flash, we don't care what it is really */ - esp_err_t err = spi_flash_mmap(0x0, LEN, SPI_FLASH_MMAP_DATA, &ptr, &handle); - - TEST_ASSERT_EQUAL_HEX32(ESP_OK, err); - TEST_ASSERT_NOT_NULL(ptr); - - /* Compare esp_sha() result to the mbedTLS result, should always be the same */ - - esp_sha(SHA1, ptr, LEN, sha1_espsha); - int r = mbedtls_sha1_ret(ptr, LEN, sha1_mbedtls); - TEST_ASSERT_EQUAL(0, r); - - esp_sha(SHA2_256, ptr, LEN, sha256_espsha); - r = mbedtls_sha256_ret(ptr, LEN, sha256_mbedtls, 0); - TEST_ASSERT_EQUAL(0, r); - - TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha1_espsha, sha1_mbedtls, sizeof(sha1_espsha), "SHA1 results should match"); - - TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha256_espsha, sha256_mbedtls, sizeof(sha256_espsha), "SHA256 results should match"); -} diff --git a/components/esp32h2/include/esp32h2/dport_access.h b/components/esp_hw_support/include/soc/esp32h2/dport_access.h similarity index 100% rename from components/esp32h2/include/esp32h2/dport_access.h rename to components/esp_hw_support/include/soc/esp32h2/dport_access.h diff --git a/components/esp32h2/include/esp_crypto_lock.h b/components/esp_hw_support/include/soc/esp32h2/esp_crypto_lock.h similarity index 100% rename from components/esp32h2/include/esp_crypto_lock.h rename to components/esp_hw_support/include/soc/esp32h2/esp_crypto_lock.h diff --git a/components/esp32h2/include/esp_ds.h b/components/esp_hw_support/include/soc/esp32h2/esp_ds.h similarity index 100% rename from components/esp32h2/include/esp_ds.h rename to components/esp_hw_support/include/soc/esp32h2/esp_ds.h diff --git a/components/esp32h2/include/esp_hmac.h b/components/esp_hw_support/include/soc/esp32h2/esp_hmac.h similarity index 100% rename from components/esp32h2/include/esp_hmac.h rename to components/esp_hw_support/include/soc/esp32h2/esp_hmac.h diff --git a/components/esp32h2/include/esp32h2/memprot.h b/components/esp_hw_support/include/soc/esp32h2/memprot.h similarity index 99% rename from components/esp32h2/include/esp32h2/memprot.h rename to components/esp_hw_support/include/soc/esp32h2/memprot.h index 58d06eba18..2567b604b0 100644 --- a/components/esp32h2/include/esp32h2/memprot.h +++ b/components/esp_hw_support/include/soc/esp32h2/memprot.h @@ -20,6 +20,7 @@ #pragma once #include +#include #include "esp_attr.h" #ifdef __cplusplus diff --git a/components/esp_hw_support/port/esp32h2/CMakeLists.txt b/components/esp_hw_support/port/esp32h2/CMakeLists.txt index 98a188b679..46e1b856ec 100644 --- a/components/esp_hw_support/port/esp32h2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32h2/CMakeLists.txt @@ -9,7 +9,12 @@ set(srcs "cpu_util_esp32h2.c" ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c") + list(APPEND srcs "../async_memcpy_impl_gdma.c" + "memprot.c" + "esp_hmac.c" + "esp_crypto_lock.c" + "esp_ds.c" + "dport_access.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") @@ -17,8 +22,3 @@ add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") target_include_directories(${COMPONENT_LIB} PUBLIC . private_include) target_include_directories(${COMPONENT_LIB} PRIVATE ../hal) - -if(NOT CMAKE_BUILD_EARLY_EXPANSION) - set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/rtc_clk.c" PROPERTIES - COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") -endif() diff --git a/components/esp32h2/dport_access.c b/components/esp_hw_support/port/esp32h2/dport_access.c similarity index 100% rename from components/esp32h2/dport_access.c rename to components/esp_hw_support/port/esp32h2/dport_access.c diff --git a/components/esp32h2/esp_crypto_lock.c b/components/esp_hw_support/port/esp32h2/esp_crypto_lock.c similarity index 100% rename from components/esp32h2/esp_crypto_lock.c rename to components/esp_hw_support/port/esp32h2/esp_crypto_lock.c diff --git a/components/esp32h2/esp_ds.c b/components/esp_hw_support/port/esp32h2/esp_ds.c similarity index 100% rename from components/esp32h2/esp_ds.c rename to components/esp_hw_support/port/esp32h2/esp_ds.c diff --git a/components/esp32h2/esp_hmac.c b/components/esp_hw_support/port/esp32h2/esp_hmac.c similarity index 100% rename from components/esp32h2/esp_hmac.c rename to components/esp_hw_support/port/esp32h2/esp_hmac.c diff --git a/components/esp32h2/memprot.c b/components/esp_hw_support/port/esp32h2/memprot.c similarity index 100% rename from components/esp32h2/memprot.c rename to components/esp_hw_support/port/esp32h2/memprot.c diff --git a/components/esp32h2/ld/esp32h2.ld b/components/esp_system/ld/esp32h2/memory.ld.in similarity index 100% rename from components/esp32h2/ld/esp32h2.ld rename to components/esp_system/ld/esp32h2/memory.ld.in diff --git a/components/esp32h2/ld/esp32h2.project.ld.in b/components/esp_system/ld/esp32h2/sections.ld.in similarity index 100% rename from components/esp32h2/ld/esp32h2.project.ld.in rename to components/esp_system/ld/esp32h2/sections.ld.in From 1e628c0f30d341091baa7e256b143b110212a6d8 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 6 Jul 2021 17:31:18 +1000 Subject: [PATCH 10/17] esp32h2: Build unit test app --- .../components/test_utils/ccomp_timer_impl_riscv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/unit-test-app/components/test_utils/ccomp_timer_impl_riscv.c b/tools/unit-test-app/components/test_utils/ccomp_timer_impl_riscv.c index bea2b6d9f9..488472de9c 100644 --- a/tools/unit-test-app/components/test_utils/ccomp_timer_impl_riscv.c +++ b/tools/unit-test-app/components/test_utils/ccomp_timer_impl_riscv.c @@ -21,6 +21,8 @@ #if CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/clk.h" +#elif CONFIG_IDF_TARGET_ESP32H2 +#include "esp32h2/clk.h" #endif typedef enum { From c1ca7a35b0cea766c698b5ffa0efcf3149175f5c Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 7 Jul 2021 11:55:33 +1000 Subject: [PATCH 11/17] ldgen: Remove some remaining references to TARGET.project.ld.in --- components/esp_system/startup.c | 2 +- components/soc/esp32s3/soc_memory_layout.c | 2 +- docs/en/api-guides/linker-script-generation.rst | 2 +- docs/zh_CN/api-guides/linker-script-generation.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esp_system/startup.c b/components/esp_system/startup.c index 32cb377ed5..8afc43087f 100644 --- a/components/esp_system/startup.c +++ b/components/esp_system/startup.c @@ -162,7 +162,7 @@ size_t __cxx_eh_arena_size_get(void) * The rest of the init_array sections is sorted for iteration in descending order during startup, however. * Hence a different section is generated for the init_priority functions which is looped * over in ascending direction instead of descending direction. - * The RISC-V-specific behavior is dependent on the linker script esp32c3.project.ld.in. + * The RISC-V-specific behavior is dependent on the linker script ld/esp32c3/sections.ld.in. */ static void do_global_ctors(void) { diff --git a/components/soc/esp32s3/soc_memory_layout.c b/components/soc/esp32s3/soc_memory_layout.c index 9da8bdcae7..597a55c3e0 100644 --- a/components/soc/esp32s3/soc_memory_layout.c +++ b/components/soc/esp32s3/soc_memory_layout.c @@ -79,7 +79,7 @@ const soc_memory_region_t soc_memory_regions[] = { const size_t soc_memory_region_count = sizeof(soc_memory_regions) / sizeof(soc_memory_region_t); -extern int _data_start, _heap_start, _iram_start, _iram_end; // defined in esp32s3.project.ld.in +extern int _data_start, _heap_start, _iram_start, _iram_end; // defined in sections.ld.in /** * Reserved memory regions. diff --git a/docs/en/api-guides/linker-script-generation.rst b/docs/en/api-guides/linker-script-generation.rst index b94a62642f..ac813487bf 100644 --- a/docs/en/api-guides/linker-script-generation.rst +++ b/docs/en/api-guides/linker-script-generation.rst @@ -619,4 +619,4 @@ Then the corresponding excerpt from the generated linker script will be as follo Rule generated from the default scheme entry ``iram -> iram0_text``. Since the default scheme specifies an ``iram -> iram0_text`` entry, it too is placed wherever ``iram0_text`` is referenced by a marker. Since it is a rule generated from the default scheme, it comes first among all other rules collected under the same target name. - The linker script template currently used is :component_file:`{IDF_TARGET_PATH_NAME}/ld/{IDF_TARGET_PATH_NAME}.project.ld.in`, specified by the ``{IDF_TARGET_PATH_NAME}`` component; the generated output script is put under its build directory. + The linker script template currently used is :component_file:`esp_system/ld/{IDF_TARGET_PATH_NAME}/sections.ld.in`; the generated output script ``sections.ld`` is put under its build directory. diff --git a/docs/zh_CN/api-guides/linker-script-generation.rst b/docs/zh_CN/api-guides/linker-script-generation.rst index a2d70844f2..402e2ea8d8 100644 --- a/docs/zh_CN/api-guides/linker-script-generation.rst +++ b/docs/zh_CN/api-guides/linker-script-generation.rst @@ -619,4 +619,4 @@ ESP-IDF v4.0 变更了链接器脚本片段文件使用的一些语法: 这是根据默认协议条目 ``iram -> iram0_text`` 生成的规则。默认协议指定了 ``iram -> iram0_text`` 条目,因此生成的规则同样也放在被 ``iram0_text`` 标记的地方。由于该规则是根据默认协议生成的,因此在同一目标下收集的所有规则下排在第一位。 - 目前使用的链接器脚本模板是 :component_file:`{IDF_TARGET_PATH_NAME}/ld/{IDF_TARGET_PATH_NAME}.project.ld.in`,由 ``{IDF_TARGET_PATH_NAME}`` 组件指定,生成的脚本存放在构建目录下。 + 目前使用的链接器脚本模板是 :component_file:`esp_system/ld/{IDF_TARGET_PATH_NAME}/sections.ld.in`,生成的脚本存放在构建目录下。 From f9d958a65d63c3f10cb359cc83533f51ece0a758 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 8 Jul 2021 09:17:18 +1000 Subject: [PATCH 12/17] ut configs: Replace target component with esp_hw_support No tests remaining in the target components. Some further consolidations can be made here later, to combine target-specific configs that don't need to be target-specific any more. --- components/esp_hw_support/test/test_rtc_clk.c | 12 +++++++++--- tools/unit-test-app/configs/default | 2 +- tools/unit-test-app/configs/default_2 | 2 +- tools/unit-test-app/configs/default_2_c3 | 2 +- tools/unit-test-app/configs/default_2_s2 | 2 +- tools/unit-test-app/configs/default_c3 | 2 +- tools/unit-test-app/configs/default_s2_1 | 2 +- tools/unit-test-app/configs/default_s3 | 2 +- tools/unit-test-app/configs/freertos_compliance | 2 +- tools/unit-test-app/configs/freertos_compliance_c3 | 2 +- tools/unit-test-app/configs/freertos_compliance_s2 | 2 +- tools/unit-test-app/configs/psram | 2 +- tools/unit-test-app/configs/psram_2 | 2 +- tools/unit-test-app/configs/psram_8m | 2 +- tools/unit-test-app/configs/psram_hspi | 2 +- tools/unit-test-app/configs/psram_vspi | 2 +- tools/unit-test-app/configs/release | 2 +- tools/unit-test-app/configs/release_2 | 2 +- tools/unit-test-app/configs/release_2_s2 | 2 +- tools/unit-test-app/configs/release_c3 | 2 +- tools/unit-test-app/configs/release_s2 | 2 +- tools/unit-test-app/configs/release_s3 | 2 +- tools/unit-test-app/configs/single_core | 2 +- tools/unit-test-app/configs/single_core_2 | 2 +- tools/unit-test-app/configs/single_core_2_s2 | 2 +- tools/unit-test-app/configs/single_core_s2 | 2 +- tools/unit-test-app/disabled_configs/psram_2_s2 | 2 +- tools/unit-test-app/disabled_configs/psram_8m_s2 | 2 +- tools/unit-test-app/disabled_configs/psram_s2 | 2 +- tools/unit-test-app/tools/UnitTestParser.py | 2 +- 30 files changed, 38 insertions(+), 32 deletions(-) diff --git a/components/esp_hw_support/test/test_rtc_clk.c b/components/esp_hw_support/test/test_rtc_clk.c index 1756e795ed..22912ad2da 100644 --- a/components/esp_hw_support/test/test_rtc_clk.c +++ b/components/esp_hw_support/test/test_rtc_clk.c @@ -170,6 +170,10 @@ TEST_CASE("Test fast switching between PLL and XTAL", "[rtc_clk]") test_clock_switching(rtc_clk_cpu_freq_set_config_fast); } +/* In CI environments, the 32kXTAL runners don't have 8MB psram for bank switching. + So can only test one config or the other. */ +#if !IDF_CI_BUILD || !CONFIG_SPIRAM_BANKSWITCH_ENABLE + #define COUNT_TEST 3 #define TIMEOUT_TEST_MS (5 + CONFIG_ESP32_RTC_CLK_CAL_CYCLES / 16) @@ -207,7 +211,7 @@ static void start_freq(rtc_slow_freq_t required_src_freq, uint32_t start_delay_m printf("Test is started. Kconfig settings:\n Internal RC is selected,\n Oscillation cycles = %d,\n Calibration cycles = %d.\n", bootstrap_cycles, CONFIG_ESP32_RTC_CLK_CAL_CYCLES); -#endif +#endif // CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS if (start_delay_ms == 0 && CONFIG_ESP32_RTC_CLK_CAL_CYCLES < 1500){ start_delay_ms = 50; printf("Recommended increase Number of cycles for RTC_SLOW_CLK calibration to 3000!\n"); @@ -268,7 +272,7 @@ TEST_CASE("Test starting external RTC quartz", "[rtc_clk][test_env=UT_T1_32kXTAL printf("Test is started. Kconfig settings:\n Internal RC is selected,\n Oscillation cycles = %d,\n Calibration cycles = %d.\n", bootstrap_cycles, CONFIG_ESP32_RTC_CLK_CAL_CYCLES); -#endif +#endif // CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS if (CONFIG_ESP32_RTC_CLK_CAL_CYCLES < 1500){ printf("Recommended increase Number of cycles for RTC_SLOW_CLK calibration to 3000!\n"); } @@ -313,7 +317,9 @@ TEST_CASE("Test starting 'External 32kHz XTAL' on the board without it.", "[rtc_ start_freq(RTC_SLOW_FREQ_RTC, 0); } -#endif +#endif // !IDF_CI_BUILD || !CONFIG_SPIRAM_BANKSWITCH_ENABLE + +#endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3, ESP32C3) TEST_CASE("Test rtc clk calibration compensation", "[rtc_clk]") { diff --git a/tools/unit-test-app/configs/default b/tools/unit-test-app/configs/default index 4518588356..2edd93d470 100644 --- a/tools/unit-test-app/configs/default +++ b/tools/unit-test-app/configs/default @@ -1,4 +1,4 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos esp32 esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD=y diff --git a/tools/unit-test-app/configs/default_2 b/tools/unit-test-app/configs/default_2 index 0b2e01f386..d3d255759c 100644 --- a/tools/unit-test-app/configs/default_2 +++ b/tools/unit-test-app/configs/default_2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32 esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls diff --git a/tools/unit-test-app/configs/default_2_c3 b/tools/unit-test-app/configs/default_2_c3 index 0b87f01d41..d5ccde234e 100644 --- a/tools/unit-test-app/configs/default_2_c3 +++ b/tools/unit-test-app/configs/default_2_c3 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32c3" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32c3 esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component ulp perfmon esp-tls test_utils +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component ulp perfmon esp-tls test_utils diff --git a/tools/unit-test-app/configs/default_2_s2 b/tools/unit-test-app/configs/default_2_s2 index 462f9802a2..94ca4d9dbb 100644 --- a/tools/unit-test-app/configs/default_2_s2 +++ b/tools/unit-test-app/configs/default_2_s2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32s2 esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component esp-tls +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component esp-tls diff --git a/tools/unit-test-app/configs/default_c3 b/tools/unit-test-app/configs/default_c3 index 330048f578..0492136665 100644 --- a/tools/unit-test-app/configs/default_c3 +++ b/tools/unit-test-app/configs/default_c3 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c3" -TEST_COMPONENTS=freertos esp32c3 esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs diff --git a/tools/unit-test-app/configs/default_s2_1 b/tools/unit-test-app/configs/default_s2_1 index 06d7613e2a..3ef5b19050 100644 --- a/tools/unit-test-app/configs/default_s2_1 +++ b/tools/unit-test-app/configs/default_s2_1 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_COMPONENTS=freertos esp32s2 esp_system esp_timer driver heap +TEST_COMPONENTS=freertos esp_hw_support esp_system esp_timer driver heap diff --git a/tools/unit-test-app/configs/default_s3 b/tools/unit-test-app/configs/default_s3 index 260c7190da..ba02479cdd 100644 --- a/tools/unit-test-app/configs/default_s3 +++ b/tools/unit-test-app/configs/default_s3 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32s3" -TEST_COMPONENTS=freertos esp32s3 esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs diff --git a/tools/unit-test-app/configs/freertos_compliance b/tools/unit-test-app/configs/freertos_compliance index cd15c21119..55d96bf442 100644 --- a/tools/unit-test-app/configs/freertos_compliance +++ b/tools/unit-test-app/configs/freertos_compliance @@ -1,4 +1,4 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=driver esp32 esp_ipc esp_timer spi_flash +TEST_COMPONENTS=driver esp_hw_support esp_ipc esp_timer spi_flash CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=y diff --git a/tools/unit-test-app/configs/freertos_compliance_c3 b/tools/unit-test-app/configs/freertos_compliance_c3 index 8e85455fc6..a89936f2de 100644 --- a/tools/unit-test-app/configs/freertos_compliance_c3 +++ b/tools/unit-test-app/configs/freertos_compliance_c3 @@ -1,4 +1,4 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32c3" -TEST_COMPONENTS=driver esp32c3 esp_system esp_timer spi_flash +TEST_COMPONENTS=driver esp_hw_support esp_system esp_timer spi_flash CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=y diff --git a/tools/unit-test-app/configs/freertos_compliance_s2 b/tools/unit-test-app/configs/freertos_compliance_s2 index 5e33aa7992..39836a53b6 100644 --- a/tools/unit-test-app/configs/freertos_compliance_s2 +++ b/tools/unit-test-app/configs/freertos_compliance_s2 @@ -1,4 +1,4 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_COMPONENTS=driver esp32s2 esp_system esp_timer spi_flash +TEST_COMPONENTS=driver esp_hw_support esp_system esp_timer spi_flash CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=y diff --git a/tools/unit-test-app/configs/psram b/tools/unit-test-app/configs/psram index a4c91d1ba9..2184966329 100644 --- a/tools/unit-test-app/configs/psram +++ b/tools/unit-test-app/configs/psram @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update driver esp32 esp_ipc esp_pm esp_system esp_timer mbedtls spi_flash test_utils heap pthread soc experimental_cpp_component esp-tls freertos sdmmc +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update driver esp_hw_support esp_ipc esp_pm esp_system esp_timer mbedtls spi_flash test_utils heap pthread soc experimental_cpp_component esp-tls freertos sdmmc CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 CONFIG_SPIRAM_OCCUPY_NO_HOST=y diff --git a/tools/unit-test-app/configs/psram_2 b/tools/unit-test-app/configs/psram_2 index 867006f3f7..ed2b6efdf0 100644 --- a/tools/unit-test-app/configs/psram_2 +++ b/tools/unit-test-app/configs/psram_2 @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=esp32 esp_ipc esp_system esp_timer mbedtls spi_flash heap pthread soc +TEST_COMPONENTS=esp_hw_support esp_ipc esp_system esp_timer mbedtls spi_flash heap pthread soc CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 CONFIG_SPIRAM_OCCUPY_NO_HOST=y diff --git a/tools/unit-test-app/configs/psram_8m b/tools/unit-test-app/configs/psram_8m index 9601748b42..53445b4f43 100644 --- a/tools/unit-test-app/configs/psram_8m +++ b/tools/unit-test-app/configs/psram_8m @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=esp32 esp_timer +TEST_COMPONENTS=esp_hw_support esp_timer CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_SPIRAM_BANKSWITCH_ENABLE=y CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 diff --git a/tools/unit-test-app/configs/psram_hspi b/tools/unit-test-app/configs/psram_hspi index 5d0deaed4b..8d7fa7265a 100644 --- a/tools/unit-test-app/configs/psram_hspi +++ b/tools/unit-test-app/configs/psram_hspi @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=esp32 +TEST_COMPONENTS=esp_hw_support TEST_GROUPS=psram_4m CONFIG_ESPTOOLPY_FLASHFREQ_80M=y CONFIG_ESP32_SPIRAM_SUPPORT=y diff --git a/tools/unit-test-app/configs/psram_vspi b/tools/unit-test-app/configs/psram_vspi index 03dc373b88..a2950c9030 100644 --- a/tools/unit-test-app/configs/psram_vspi +++ b/tools/unit-test-app/configs/psram_vspi @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=esp32 +TEST_COMPONENTS=esp_hw_support TEST_GROUPS=psram_4m CONFIG_ESPTOOLPY_FLASHFREQ_80M=y CONFIG_ESP32_SPIRAM_SUPPORT=y diff --git a/tools/unit-test-app/configs/release b/tools/unit-test-app/configs/release index 074d867ffe..d9047f3af3 100644 --- a/tools/unit-test-app/configs/release +++ b/tools/unit-test-app/configs/release @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos esp32 esp_system esp_ipc esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_system esp_ipc esp_timer driver heap pthread soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_2 b/tools/unit-test-app/configs/release_2 index f4a8f1c679..5c4780c3c9 100644 --- a/tools/unit-test-app/configs/release_2 +++ b/tools/unit-test-app/configs/release_2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32 esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_2_s2 b/tools/unit-test-app/configs/release_2_s2 index a513cb9548..084be8f9d4 100644 --- a/tools/unit-test-app/configs/release_2_s2 +++ b/tools/unit-test-app/configs/release_2_s2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32s2 esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_c3 b/tools/unit-test-app/configs/release_c3 index e866001e14..87214a20ac 100644 --- a/tools/unit-test-app/configs/release_c3 +++ b/tools/unit-test-app/configs/release_c3 @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32c3" -TEST_COMPONENTS=freertos esp32c3 esp_system esp_ipc esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_system esp_ipc esp_timer driver heap pthread soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_s2 b/tools/unit-test-app/configs/release_s2 index 06adf282b2..e90ddd2d7a 100644 --- a/tools/unit-test-app/configs/release_s2 +++ b/tools/unit-test-app/configs/release_s2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_COMPONENTS=freertos esp32s2 esp_system esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_system esp_timer driver heap pthread soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_s3 b/tools/unit-test-app/configs/release_s3 index 823e25b848..3d7d7a0a1b 100644 --- a/tools/unit-test-app/configs/release_s3 +++ b/tools/unit-test-app/configs/release_s3 @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32s3" -TEST_COMPONENTS=freertos esp32s3 esp_system esp_ipc esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_system esp_ipc esp_timer driver heap pthread soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/single_core b/tools/unit-test-app/configs/single_core index 2967da2efa..9e4a54c0f0 100644 --- a/tools/unit-test-app/configs/single_core +++ b/tools/unit-test-app/configs/single_core @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos esp32 esp_system esp_timer driver heap pthread soc spi_flash vfs +TEST_COMPONENTS=freertos esp_hw_support esp_system esp_timer driver heap pthread soc spi_flash vfs CONFIG_MEMMAP_SMP=n CONFIG_FREERTOS_UNICORE=y CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY=y diff --git a/tools/unit-test-app/configs/single_core_2 b/tools/unit-test-app/configs/single_core_2 index 6af65f72d4..5dc395942b 100644 --- a/tools/unit-test-app/configs/single_core_2 +++ b/tools/unit-test-app/configs/single_core_2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32 esp_system esp_pm esp_ipc esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp_hw_support esp_system esp_pm esp_ipc esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls CONFIG_MEMMAP_SMP=n CONFIG_FREERTOS_UNICORE=y CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y diff --git a/tools/unit-test-app/configs/single_core_2_s2 b/tools/unit-test-app/configs/single_core_2_s2 index c83a254dc4..9bfc7bfadd 100644 --- a/tools/unit-test-app/configs/single_core_2_s2 +++ b/tools/unit-test-app/configs/single_core_2_s2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32s2 esp_ipc esp_system esp_pm esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp_hw_support esp_ipc esp_system esp_pm esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component CONFIG_MEMMAP_SMP=n CONFIG_FREERTOS_UNICORE=y CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y diff --git a/tools/unit-test-app/configs/single_core_s2 b/tools/unit-test-app/configs/single_core_s2 index 783edfd8c3..3e9e6dd08e 100644 --- a/tools/unit-test-app/configs/single_core_s2 +++ b/tools/unit-test-app/configs/single_core_s2 @@ -1,4 +1,4 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_COMPONENTS=esp32s2 esp_system esp_timer driver heap soc spi_flash test_utils +TEST_COMPONENTS=esp_hw_support esp_system esp_timer driver heap soc spi_flash test_utils CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y diff --git a/tools/unit-test-app/disabled_configs/psram_2_s2 b/tools/unit-test-app/disabled_configs/psram_2_s2 index 130a998481..495de89469 100644 --- a/tools/unit-test-app/disabled_configs/psram_2_s2 +++ b/tools/unit-test-app/disabled_configs/psram_2_s2 @@ -1,4 +1,4 @@ -TEST_COMPONENTS=driver esp32s2 spi_flash mbedtls +TEST_COMPONENTS=driver esp_hw_support spi_flash mbedtls CONFIG_ESP32S2_SPIRAM_SUPPORT=y CONFIG_IDF_TARGET="esp32s2" CONFIG_SPIRAM_OCCUPY_NO_HOST=y diff --git a/tools/unit-test-app/disabled_configs/psram_8m_s2 b/tools/unit-test-app/disabled_configs/psram_8m_s2 index 67b2bb42c9..54c00e1e40 100644 --- a/tools/unit-test-app/disabled_configs/psram_8m_s2 +++ b/tools/unit-test-app/disabled_configs/psram_8m_s2 @@ -1,4 +1,4 @@ -TEST_COMPONENTS=esp32s2 +TEST_COMPONENTS=esp_hw_support CONFIG_ESP32S2_SPIRAM_SUPPORT=y CONFIG_SPIRAM_BANKSWITCH_ENABLE=y CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 diff --git a/tools/unit-test-app/disabled_configs/psram_s2 b/tools/unit-test-app/disabled_configs/psram_s2 index c322a709da..680c9fcdbe 100644 --- a/tools/unit-test-app/disabled_configs/psram_s2 +++ b/tools/unit-test-app/disabled_configs/psram_s2 @@ -1,4 +1,4 @@ -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update driver esp32s2 spi_flash +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update driver esp_hw_support spi_flash CONFIG_ESP32S2_SPIRAM_SUPPORT=y CONFIG_IDF_TARGET="esp32s2" CONFIG_SPIRAM_OCCUPY_NO_HOST=y diff --git a/tools/unit-test-app/tools/UnitTestParser.py b/tools/unit-test-app/tools/UnitTestParser.py index 897984a906..64b21a1c4a 100644 --- a/tools/unit-test-app/tools/UnitTestParser.py +++ b/tools/unit-test-app/tools/UnitTestParser.py @@ -122,7 +122,7 @@ class Parser(object): # and we need to check all cases no matter if it's going te be executed by CI # also add app_name here, we allow same case for different apps if (tc['summary'] + stripped_config_name) in self.test_case_names: - self.parsing_errors.append('duplicated test case ID: ' + tc['summary']) + self.parsing_errors.append('{} ({}): duplicated test case ID: {}'.format(stripped_config_name, config_name, tc['summary'])) else: self.test_case_names.add(tc['summary'] + stripped_config_name) From 77b1ddbcdb83b56155155a2539a69abb50962324 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 12 Jul 2021 21:07:13 +1000 Subject: [PATCH 13/17] driver: Add some settling time when driving USB IOs high/low Otherwise seems to sometimes fail in release config --- components/driver/test/test_gpio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/driver/test/test_gpio.c b/components/driver/test/test_gpio.c index 3098a4cb89..1ed38cc5c1 100644 --- a/components/driver/test/test_gpio.c +++ b/components/driver/test/test_gpio.c @@ -821,17 +821,21 @@ TEST_CASE("GPIO input and output of USB pins test", "[gpio]") // test pin gpio_set_level(pin, 0); // tested voltage is around 0v + esp_rom_delay_us(10); TEST_ASSERT_EQUAL_INT_MESSAGE(gpio_get_level(pin), 0, "get level error! the level should be low!"); vTaskDelay(1000 / portTICK_RATE_MS); gpio_set_level(pin, 1); + esp_rom_delay_us(10); // tested voltage is around 3.3v TEST_ASSERT_EQUAL_INT_MESSAGE(gpio_get_level(pin), 1, "get level error! the level should be high!"); vTaskDelay(1000 / portTICK_RATE_MS); gpio_set_level(pin, 0); + esp_rom_delay_us(10); // tested voltage is around 0v TEST_ASSERT_EQUAL_INT_MESSAGE(gpio_get_level(pin), 0, "get level error! the level should be low!"); vTaskDelay(1000 / portTICK_RATE_MS); gpio_set_level(pin, 1); + esp_rom_delay_us(10); // tested voltage is around 3.3v TEST_ASSERT_EQUAL_INT_MESSAGE(gpio_get_level(pin), 1, "get level error! the level should be high!"); } From 86061a720b5cf698b7776ecbe8094e42e07c3be7 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 14 Jul 2021 19:19:41 +1000 Subject: [PATCH 14/17] app_update: Add soc_caps dependency to esp_ota_ops.h --- components/app_update/include/esp_ota_ops.h | 1 + 1 file changed, 1 insertion(+) diff --git a/components/app_update/include/esp_ota_ops.h b/components/app_update/include/esp_ota_ops.h index ee29cdacae..6278ab7905 100644 --- a/components/app_update/include/esp_ota_ops.h +++ b/components/app_update/include/esp_ota_ops.h @@ -14,6 +14,7 @@ #include "esp_partition.h" #include "esp_image_format.h" #include "esp_flash_partitions.h" +#include "soc/soc_caps.h" #ifdef __cplusplus extern "C" From 9d6366f290f8059a7903939857266e9f11ef719b Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 15 Jul 2021 14:55:15 +1000 Subject: [PATCH 15/17] esp_hw_support: Move rtc.h header from target components --- components/esp32c3/CMakeLists.txt | 3 +-- components/esp32h2/CMakeLists.txt | 3 +-- components/esp32s2/CMakeLists.txt | 3 +-- components/esp32s3/CMakeLists.txt | 3 +-- .../{esp32/include => esp_hw_support/include/soc}/esp32/rtc.h | 0 .../include => esp_hw_support/include/soc}/esp32c3/rtc.h | 0 .../include => esp_hw_support/include/soc}/esp32h2/rtc.h | 0 .../include => esp_hw_support/include/soc}/esp32s2/rtc.h | 0 .../include => esp_hw_support/include/soc}/esp32s3/rtc.h | 0 9 files changed, 4 insertions(+), 8 deletions(-) rename components/{esp32/include => esp_hw_support/include/soc}/esp32/rtc.h (100%) rename components/{esp32c3/include => esp_hw_support/include/soc}/esp32c3/rtc.h (100%) rename components/{esp32h2/include => esp_hw_support/include/soc}/esp32h2/rtc.h (100%) rename components/{esp32s2/include => esp_hw_support/include/soc}/esp32s2/rtc.h (100%) rename components/{esp32s3/include => esp_hw_support/include/soc}/esp32s3/rtc.h (100%) diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index a0577f4dcd..fa6658cc0d 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -9,8 +9,7 @@ if(NOT BOOTLOADER_BUILD) set(legacy_reqs driver efuse soc) endif() -idf_component_register(INCLUDE_DIRS include - REQUIRES riscv "${legacy_reqs}" +idf_component_register(REQUIRES riscv "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32c3) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") diff --git a/components/esp32h2/CMakeLists.txt b/components/esp32h2/CMakeLists.txt index 3c29e6a62c..58cc2fa226 100644 --- a/components/esp32h2/CMakeLists.txt +++ b/components/esp32h2/CMakeLists.txt @@ -9,8 +9,7 @@ if(NOT BOOTLOADER_BUILD) set(legacy_reqs driver efuse soc) endif() -idf_component_register(INCLUDE_DIRS include - REQUIRES riscv "${legacy_reqs}" +idf_component_register(REQUIRES riscv "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32h2) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32h2.peripherals.ld") diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index 81c68f82de..0918864d18 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -9,8 +9,7 @@ if(NOT BOOTLOADER_BUILD) set(legacy_reqs driver efuse soc) endif() -idf_component_register(INCLUDE_DIRS include - REQUIRES xtensa "${legacy_reqs}" +idf_component_register(REQUIRES xtensa "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32s2) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index 6e30552c1a..02b509b91f 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -9,8 +9,7 @@ if(NOT BOOTLOADER_BUILD) set(legacy_reqs driver efuse soc) endif() -idf_component_register(INCLUDE_DIRS include - REQUIRES xtensa "${legacy_reqs}" +idf_component_register(REQUIRES xtensa "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32s3) target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s3.peripherals.ld") diff --git a/components/esp32/include/esp32/rtc.h b/components/esp_hw_support/include/soc/esp32/rtc.h similarity index 100% rename from components/esp32/include/esp32/rtc.h rename to components/esp_hw_support/include/soc/esp32/rtc.h diff --git a/components/esp32c3/include/esp32c3/rtc.h b/components/esp_hw_support/include/soc/esp32c3/rtc.h similarity index 100% rename from components/esp32c3/include/esp32c3/rtc.h rename to components/esp_hw_support/include/soc/esp32c3/rtc.h diff --git a/components/esp32h2/include/esp32h2/rtc.h b/components/esp_hw_support/include/soc/esp32h2/rtc.h similarity index 100% rename from components/esp32h2/include/esp32h2/rtc.h rename to components/esp_hw_support/include/soc/esp32h2/rtc.h diff --git a/components/esp32s2/include/esp32s2/rtc.h b/components/esp_hw_support/include/soc/esp32s2/rtc.h similarity index 100% rename from components/esp32s2/include/esp32s2/rtc.h rename to components/esp_hw_support/include/soc/esp32s2/rtc.h diff --git a/components/esp32s3/include/esp32s3/rtc.h b/components/esp_hw_support/include/soc/esp32s3/rtc.h similarity index 100% rename from components/esp32s3/include/esp32s3/rtc.h rename to components/esp_hw_support/include/soc/esp32s3/rtc.h From 356d7b6da3ef10fd60967930312147fb3a52c6ee Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 15 Jul 2021 19:23:15 +1000 Subject: [PATCH 16/17] esp_hw_support: Clean up CMakeLists file --- components/esp_hw_support/CMakeLists.txt | 51 ++++++++----------- .../esp_hw_support/project_include.cmake | 2 +- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index df16921b75..236f930ec5 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -7,8 +7,6 @@ if(${target} STREQUAL "esp32") list(APPEND requires efuse) endif() -set(priv_requires efuse bootloader_support spi_flash) - set(srcs "compare_set.c" "cpu_util.c") if(NOT BOOTLOADER_BUILD) list(APPEND srcs "esp_async_memcpy.c" @@ -35,33 +33,26 @@ idf_component_register(SRCS ${srcs} idf_build_get_property(target IDF_TARGET) add_subdirectory(port/${target}) -if(NOT BOOTLOADER_BUILD) - - if(CONFIG_SPIRAM_CACHE_WORKAROUND) - # Note: Adding as a PUBLIC compile option here causes this option to propagate to all - # components that depend on esp32. - # - # To handle some corner cases, the same flag is set in project_include.cmake - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) - # also, make sure we link with this option so correct toolchain libs are pulled in - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) - # set strategy selected - # note that we don't need to set link options as the library linked is independent of this - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) - endif() - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) - endif() - if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS) - target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) - target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) - endif() +if(CONFIG_IDF_TARGET_ESP32 AND CONFIG_SPIRAM_CACHE_WORKAROUND AND NOT BOOTLOADER_BUILD) + # Note: Adding as a PUBLIC compile option here causes this option to propagate to all + # components that depend on esp32. + # + # To handle some corner cases, the same flag is set in project_include.cmake + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) + # also, make sure we link with this option so correct toolchain libs are pulled in + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) + # set strategy selected + # note that we don't need to set link options as the library linked is independent of this + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) + endif() + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) + endif() + if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS) + target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) + target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) endif() - - set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/sleep_modes.c" PROPERTIES - COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") - endif() diff --git a/components/esp_hw_support/project_include.cmake b/components/esp_hw_support/project_include.cmake index 417d6e70e3..4e77c0389e 100644 --- a/components/esp_hw_support/project_include.cmake +++ b/components/esp_hw_support/project_include.cmake @@ -1,4 +1,4 @@ -if(CONFIG_SPIRAM_CACHE_WORKAROUND AND NOT BOOTLOADER_BUILD) +if(CONFIG_IDF_TARGET_ESP32 AND CONFIG_SPIRAM_CACHE_WORKAROUND AND NOT BOOTLOADER_BUILD) # We do this here as well as in CMakeLists.txt, because targets that # are not part of the ESP-IDF build system (for cases where a generic # non-IDF CMakeLists.txt file is imported into a component) don't depend From ae04cbe48fb41666bceffc7160289a38751f1ec0 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 16 Jul 2021 11:48:24 +1000 Subject: [PATCH 17/17] ci: Bump S3 UT count --- .gitlab/ci/target-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 8e6c98db44..568ade3894 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -687,7 +687,7 @@ UT_C3_FLASH_SUSPEND: UT_S3: extends: .unit_test_esp32s3_template - parallel: 25 + parallel: 26 tags: - ESP32S3_IDF - UT_T1_1