feat(mbedtls): enable ROM mbedTLS pytest with esp32c2 rev2.0

This commit is contained in:
Jiang Guang Ming
2026-05-06 19:52:43 +08:00
committed by JiangGuangMing
parent 5d5b8200dc
commit d5a712f1f8
9 changed files with 24 additions and 22 deletions

View File

@@ -8,6 +8,7 @@ if(esp_tee_build)
elseif(BOOTLOADER_BUILD) # TODO: IDF-11673
if(CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL_BOOTLOADER)
set(include_dirs "${COMPONENT_DIR}/mbedtls/include"
"${COMPONENT_DIR}/mbedtls/tf-psa-crypto/drivers/builtin/include"
"port/mbedtls_rom")
set(srcs "port/mbedtls_rom/mbedtls_rom_osi_bootloader.c")
endif()

View File

@@ -1608,8 +1608,7 @@ menu "mbedTLS"
config MBEDTLS_USE_CRYPTO_ROM_IMPL_BOOTLOADER
bool "Use ROM implementation of the crypto algorithm in the bootloader"
# TODO: IDF-15012
depends on ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB && !MBEDTLS_VER_4_X_SUPPORT
depends on ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB && ESP32C2_REV_MIN_200
default "n"
select MBEDTLS_AES_C
help
@@ -1620,7 +1619,7 @@ menu "mbedTLS"
config MBEDTLS_USE_CRYPTO_ROM_IMPL
bool "Use ROM implementation of the crypto algorithm"
depends on ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB
depends on ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB && ESP32C2_REV_MIN_200
default "n"
select MBEDTLS_SHA512_C
select MBEDTLS_AES_C

View File

@@ -118,18 +118,19 @@ def test_mbedtls_hmac_opaque(dut: Dut) -> None:
dut.run_all_single_board_cases(group='efuse_hmac_key')
# TODO: IDF-15012
# @pytest.mark.generic
# @pytest.mark.parametrize(
# 'config',
# [
# 'rom_impl',
# ],
# indirect=True,
# )
# @idf_parametrize('target', ['esp32c2'], indirect=['target'])
# def test_mbedtls_rom_impl_esp32c2(dut: Dut) -> None:
# dut.run_all_single_board_cases()
@pytest.mark.esp32c2_rev2
@pytest.mark.xtal_26mhz
@pytest.mark.generic
@pytest.mark.parametrize(
'config, baud',
[
('rom_impl', '74880'),
],
indirect=True,
)
@idf_parametrize('target', ['esp32c2'], indirect=['target'])
def test_mbedtls_rom_impl_esp32c2(dut: Dut) -> None:
dut.run_all_single_board_cases()
@pytest.mark.generic

View File

@@ -1,3 +1,4 @@
CONFIG_IDF_TARGET="esp32c2"
# TODO: IDF-15012
# CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=y
CONFIG_XTAL_FREQ_26=y
CONFIG_ESP32C2_REV_MIN_200=y
CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=y

View File

@@ -1,2 +1,3 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_ESP32C2_REV_MIN_200=y
CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL_BOOTLOADER=y

View File

@@ -389,6 +389,7 @@ def test_examples_protocol_https_request(dut: Dut) -> None:
@pytest.mark.wifi_ap
@pytest.mark.esp32c2_rev2
@pytest.mark.xtal_26mhz
@pytest.mark.parametrize(
'config, baud',

View File

@@ -1,6 +1,6 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_XTAL_FREQ_26=y
CONFIG_ESP32C2_REV_MIN_200=y
CONFIG_EXAMPLE_CONNECT_WIFI=y
CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN=y
# TODO: IDF-15012
CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=n
CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=y

View File

@@ -12,9 +12,6 @@ examples/storage/nvs/nvs_bootloader:
- if: CONFIG_NAME == "nvs_enc_flash_enc" and (SOC_AES_SUPPORTED != 1 and ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB != 1)
- if: CONFIG_NAME == "nvs_enc_hmac" and (SOC_HMAC_SUPPORTED != 1 or (SOC_HMAC_SUPPORTED == 1 and (SOC_AES_SUPPORTED != 1 and ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB != 1)))
reason: As of now in such cases, we do not have any way to perform AES operations in the bootloader build
# TODO: IDF-15012
- if: IDF_TARGET in ["esp32c2"] and CONFIG_NAME in ["nvs_enc_flash_enc", "nvs_enc_hmac", "default"]
reason: PSA is not yet available for ESP32-C2
examples/storage/nvs/nvs_console:
depends_components:

View File

@@ -1,2 +1,3 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_ESP32C2_REV_MIN_200=y
CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL_BOOTLOADER=y