diff --git a/components/esp_tee/subproject/components/tee_sec_storage/tee_sec_storage.c b/components/esp_tee/subproject/components/tee_sec_storage/tee_sec_storage.c index ff6ef16cfd..0868e38606 100644 --- a/components/esp_tee/subproject/components/tee_sec_storage/tee_sec_storage.c +++ b/components/esp_tee/subproject/components/tee_sec_storage/tee_sec_storage.c @@ -643,11 +643,12 @@ esp_err_t esp_tee_sec_storage_ecdsa_sign_pbkdf2(const esp_tee_sec_storage_pbkdf2 return ESP_ERR_INVALID_ARG; } - hmac_key_id_t key_id = (hmac_key_id_t)(CONFIG_SECURE_TEE_PBKDF2_EFUSE_HMAC_KEY_ID); - if (key_id < 0 || key_id >= HMAC_KEY_MAX) { + int cfg_key_id = (int)CONFIG_SECURE_TEE_PBKDF2_EFUSE_HMAC_KEY_ID; + if (cfg_key_id < 0 || cfg_key_id >= HMAC_KEY_MAX) { return ESP_ERR_INVALID_ARG; } + hmac_key_id_t key_id = (hmac_key_id_t)cfg_key_id; esp_efuse_block_t blk = (esp_efuse_block_t)(EFUSE_BLK_KEY0 + key_id); if (esp_efuse_get_key_purpose(blk) != ESP_EFUSE_KEY_PURPOSE_HMAC_UP) { ESP_LOGE(TAG, "HMAC key is not burnt in the specified eFuse block ID"); diff --git a/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c b/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c index 9a7e68afc4..030e6ff1c8 100644 --- a/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c +++ b/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c @@ -48,12 +48,6 @@ __attribute__((unused)) static const uint32_t mmu_op_fail_seq[8] = {[0 ... 7] = } while (0) #endif -#if SOC_TEE_FLASH_OP_FAIL_FAULT -#define CHECK_FLASH_OP_FAIL(err) TEST_ESP_ERR(ESP_FAIL, err) -#else -#define CHECK_FLASH_OP_FAIL(err) do { (void)(err); esp_restart(); } while (0) -#endif - static const char *TAG = "test_esp_tee_flash_prot"; static void set_boot_count_in_nvs(uint8_t boot_count) @@ -146,8 +140,7 @@ static void test_esp_partition_api_r(const esp_partition_t *part) TEST_ASSERT_NOT_NULL(part); uint8_t buf_r[128]; memset(buf_r, 0x00, sizeof(buf_r)); - esp_err_t err = esp_partition_read(part, 0x00, buf_r, sizeof(buf_r)); - CHECK_FLASH_OP_FAIL(err); + esp_partition_read(part, 0x00, buf_r, sizeof(buf_r)); } static void test_esp_partition_api_w(const esp_partition_t *part) @@ -155,15 +148,13 @@ static void test_esp_partition_api_w(const esp_partition_t *part) TEST_ASSERT_NOT_NULL(part); uint8_t buf_w[128]; memset(buf_w, 0xA5, sizeof(buf_w)); - esp_err_t err = esp_partition_write(part, 0x00, buf_w, sizeof(buf_w)); - CHECK_FLASH_OP_FAIL(err); + esp_partition_write(part, 0x00, buf_w, sizeof(buf_w)); } static void test_esp_partition_api_e(const esp_partition_t *part) { TEST_ASSERT_NOT_NULL(part); - esp_err_t err = esp_partition_erase_range(part, 0x00, SPI_FLASH_SEC_SIZE); - CHECK_FLASH_OP_FAIL(err); + esp_partition_erase_range(part, 0x00, SPI_FLASH_SEC_SIZE); } static void test_esp_partition_api(void) @@ -267,22 +258,19 @@ static void test_esp_flash_api_r(uint32_t paddr) { uint8_t buf_r[128]; memset(buf_r, 0x00, sizeof(buf_r)); - esp_err_t err = esp_flash_read(NULL, buf_r, paddr, sizeof(buf_r)); - CHECK_FLASH_OP_FAIL(err); + esp_flash_read(NULL, buf_r, paddr, sizeof(buf_r)); } static void test_esp_flash_api_w(uint32_t paddr) { uint8_t buf_w[128]; memset(buf_w, 0xA5, sizeof(buf_w)); - esp_err_t err = esp_flash_write(NULL, buf_w, paddr, sizeof(buf_w)); - CHECK_FLASH_OP_FAIL(err); + esp_flash_write(NULL, buf_w, paddr, sizeof(buf_w)); } static void test_esp_flash_api_e(uint32_t paddr) { - esp_err_t err = esp_flash_erase_region(NULL, paddr, SPI_FLASH_SEC_SIZE); - CHECK_FLASH_OP_FAIL(err); + esp_flash_erase_region(NULL, paddr, SPI_FLASH_SEC_SIZE); } static void test_esp_flash_api(void)