From b17ca9cb381685960bf6f160f3e8a9f2cf386642 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sat, 27 Jul 2019 09:38:39 +0200 Subject: [PATCH] unit-test-app: add config with flash encryption enabled --- components/spi_flash/test/test_flash_encryption.c | 9 ++++----- tools/unit-test-app/configs/flash_encryption | 10 ++++++++++ tools/unit-test-app/tools/ModuleDefinition.yml | 5 +++++ 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 tools/unit-test-app/configs/flash_encryption diff --git a/components/spi_flash/test/test_flash_encryption.c b/components/spi_flash/test/test_flash_encryption.c index 16579930c..ac468fd4e 100644 --- a/components/spi_flash/test/test_flash_encryption.c +++ b/components/spi_flash/test/test_flash_encryption.c @@ -9,6 +9,8 @@ #include #include +#ifdef CONFIG_SECURE_FLASH_ENC_ENABLED + static void test_encrypted_write(size_t offset, const uint8_t *data, size_t length); static void verify_erased_flash(size_t offset, size_t length); @@ -23,14 +25,10 @@ static void setup_tests() } } -TEST_CASE("test 16 byte encrypted writes", "[spi_flash]") +TEST_CASE("test 16 byte encrypted writes", "[flash_encryption][test_env=UT_T1_FlashEncryption]") { setup_tests(); - if (!esp_flash_encryption_enabled()) { - TEST_IGNORE_MESSAGE("flash encryption disabled, skipping spi_flash_write_encrypted() tests"); - } - TEST_ASSERT_EQUAL_HEX(ESP_OK, spi_flash_erase_sector(start / SPI_FLASH_SEC_SIZE)); @@ -101,3 +99,4 @@ static void verify_erased_flash(size_t offset, size_t length) } } +#endif // CONFIG_SECURE_FLASH_ENC_ENABLED diff --git a/tools/unit-test-app/configs/flash_encryption b/tools/unit-test-app/configs/flash_encryption new file mode 100644 index 000000000..7334d6737 --- /dev/null +++ b/tools/unit-test-app/configs/flash_encryption @@ -0,0 +1,10 @@ +TEST_COMPONENTS=spi_flash +TEST_GROUPS=flash_encryption +CONFIG_SECURE_FLASH_ENC_ENABLED=y +CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y +CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y +CONFIG_SECURE_BOOT_ALLOW_JTAG=y +CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y +CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC=y +CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=y +CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED=y diff --git a/tools/unit-test-app/tools/ModuleDefinition.yml b/tools/unit-test-app/tools/ModuleDefinition.yml index 0f9a31f90..a7b54404e 100644 --- a/tools/unit-test-app/tools/ModuleDefinition.yml +++ b/tools/unit-test-app/tools/ModuleDefinition.yml @@ -78,6 +78,11 @@ spi_flash_write: module abbr: DRV sub module: SPI sub module abbr: SPI +flash_encryption: + module: Driver + module abbr: DRV + sub module: SPI + sub module abbr: SPI esp32: module: System module abbr: SYS