From 174ef6c4a369c7288d586512d3e5db5ba4386043 Mon Sep 17 00:00:00 2001 From: Sachin Parekh Date: Wed, 29 Mar 2023 14:24:00 +0530 Subject: [PATCH 1/4] ecdsa_hal.c: Add missing configuration for signature generation --- components/hal/ecdsa_hal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/hal/ecdsa_hal.c b/components/hal/ecdsa_hal.c index 4f8e87168d..3d799c0661 100644 --- a/components/hal/ecdsa_hal.c +++ b/components/hal/ecdsa_hal.c @@ -46,6 +46,8 @@ void ecdsa_hal_gen_signature(ecdsa_hal_config_t *conf, const uint8_t *k, const u ; } + ecdsa_ll_write_param(ECDSA_PARAM_Z, hash, len); + ecdsa_ll_set_stage(ECDSA_STAGE_LOAD_DONE); while (ecdsa_ll_get_state() != ECDSA_STATE_GET) { From abc099ce9fcaad3701dc8b699a4224d6f57ddda0 Mon Sep 17 00:00:00 2001 From: Sachin Parekh Date: Fri, 31 Mar 2023 14:34:30 +0530 Subject: [PATCH 2/4] ecdsa: Support multiple ECDSA keys Add provision to choose which efuse block should be used as ECDSA private key --- components/hal/ecdsa_hal.c | 3 +++ components/hal/efuse_hal.c | 11 +++++++++++ components/hal/esp32h2/include/hal/efuse_ll.h | 15 +++++++++++++++ components/hal/include/hal/ecdsa_hal.h | 1 + components/hal/include/hal/efuse_hal.h | 12 ++++++++++++ components/mbedtls/port/ecdsa/ecdsa_alt.c | 1 + components/mbedtls/port/include/ecdsa/ecdsa_alt.h | 10 ---------- 7 files changed, 43 insertions(+), 10 deletions(-) diff --git a/components/hal/ecdsa_hal.c b/components/hal/ecdsa_hal.c index 3d799c0661..3d8e8696e5 100644 --- a/components/hal/ecdsa_hal.c +++ b/components/hal/ecdsa_hal.c @@ -7,12 +7,15 @@ #include "hal/assert.h" #include "hal/ecdsa_ll.h" #include "hal/ecdsa_hal.h" +#include "hal/efuse_hal.h" #define ECDSA_HAL_P192_COMPONENT_LEN 24 #define ECDSA_HAL_P256_COMPONENT_LEN 32 static void configure_ecdsa_periph(ecdsa_hal_config_t *conf) { + efuse_hal_set_ecdsa_key(conf->efuse_key_blk); + ecdsa_ll_set_mode(conf->mode); ecdsa_ll_set_curve(conf->curve); ecdsa_ll_set_k_mode(conf->k_mode); diff --git a/components/hal/efuse_hal.c b/components/hal/efuse_hal.c index 51514ad499..6a46c85d36 100644 --- a/components/hal/efuse_hal.c +++ b/components/hal/efuse_hal.c @@ -36,3 +36,14 @@ IRAM_ATTR bool efuse_hal_flash_encryption_enabled(void) } return enabled; } + +#if SOC_ECDSA_SUPPORTED +void efuse_hal_set_ecdsa_key(int efuse_blk) +{ + efuse_ll_set_ecdsa_key_blk(efuse_blk); + + efuse_ll_rs_bypass_update(); + + efuse_hal_read(); +} +#endif diff --git a/components/hal/esp32h2/include/hal/efuse_ll.h b/components/hal/esp32h2/include/hal/efuse_ll.h index 6617681c89..1ac00e6053 100644 --- a/components/hal/esp32h2/include/hal/efuse_ll.h +++ b/components/hal/esp32h2/include/hal/efuse_ll.h @@ -82,6 +82,16 @@ __attribute__((always_inline)) static inline uint32_t efuse_ll_get_chip_ver_pkg( return EFUSE.rd_mac_sys_4.pkg_version; } +__attribute__((always_inline)) static inline uint32_t efuse_ll_get_ecdsa_key_blk(void) +{ + return EFUSE.conf.cfg_ecdsa_blk; +} + +__attribute__((always_inline)) static inline void efuse_ll_set_ecdsa_key_blk(int efuse_blk) +{ + EFUSE.conf.cfg_ecdsa_blk = efuse_blk; +} + /******************* eFuse control functions *************************/ __attribute__((always_inline)) static inline bool efuse_ll_get_read_cmd(void) @@ -120,6 +130,11 @@ __attribute__((always_inline)) static inline void efuse_ll_set_pwr_off_num(uint1 EFUSE.wr_tim_conf2.pwr_off_num = value; } +__attribute__((always_inline)) static inline void efuse_ll_rs_bypass_update(void) +{ + EFUSE.wr_tim_conf0_rs_bypass.update = 1; +} + /******************* eFuse control functions *************************/ #ifdef __cplusplus diff --git a/components/hal/include/hal/ecdsa_hal.h b/components/hal/include/hal/ecdsa_hal.h index d7244b3dc0..02bad6092b 100644 --- a/components/hal/include/hal/ecdsa_hal.h +++ b/components/hal/include/hal/ecdsa_hal.h @@ -27,6 +27,7 @@ typedef struct { ecdsa_curve_t curve; /* Curve to use for operation */ ecdsa_k_mode_t k_mode; /* Source of K */ ecdsa_sha_mode_t sha_mode; /* Source of SHA that needs to be signed */ + int efuse_key_blk; /* Efuse block to use as ECDSA key (The purpose of the efuse block must be ECDSA_KEY) */ } ecdsa_hal_config_t; /** diff --git a/components/hal/include/hal/efuse_hal.h b/components/hal/include/hal/efuse_hal.h index bb11c9ae7b..a30c77da5a 100644 --- a/components/hal/include/hal/efuse_hal.h +++ b/components/hal/include/hal/efuse_hal.h @@ -8,6 +8,7 @@ #include #include +#include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { @@ -45,6 +46,17 @@ uint32_t efuse_hal_get_major_chip_version(void); */ uint32_t efuse_hal_get_minor_chip_version(void); +#if SOC_ECDSA_SUPPORTED +/** + * @brief Set the efuse block that should be used as ECDSA private key + * + * @note The efuse block must be burnt with key purpose ECDSA_KEY + * + * @param efuse_key_blk Efuse key block number (Must be in [EFUSE_BLK_KEY0...EFUSE_BLK_KEY_MAX - 1] range) + */ +void efuse_hal_set_ecdsa_key(int efuse_key_blk); +#endif + #ifdef __cplusplus } #endif diff --git a/components/mbedtls/port/ecdsa/ecdsa_alt.c b/components/mbedtls/port/ecdsa/ecdsa_alt.c index e90f01c584..e098b5e9e3 100644 --- a/components/mbedtls/port/ecdsa/ecdsa_alt.c +++ b/components/mbedtls/port/ecdsa/ecdsa_alt.c @@ -140,6 +140,7 @@ static int esp_ecdsa_sign(mbedtls_ecp_group *grp, mbedtls_mpi* r, mbedtls_mpi* s .curve = curve, .k_mode = ECDSA_K_USE_TRNG, .sha_mode = ECDSA_Z_USER_PROVIDED, + .efuse_key_blk = d->MBEDTLS_PRIVATE(n), }; ecdsa_hal_gen_signature(&conf, NULL, sha_le, r_le, s_le, len); diff --git a/components/mbedtls/port/include/ecdsa/ecdsa_alt.h b/components/mbedtls/port/include/ecdsa/ecdsa_alt.h index 9e2620b312..0326795f8d 100644 --- a/components/mbedtls/port/include/ecdsa/ecdsa_alt.h +++ b/components/mbedtls/port/include/ecdsa/ecdsa_alt.h @@ -21,11 +21,6 @@ extern "C" { * We break the MPI struct of the private key in order to * differentiate between hardware key and software key * - * @note Currently, `efuse_blk` is not used internally. - * Hardware will choose the efuse block that has purpose set to ECDSA_KEY. - * In case of multiple ECDSA_KEY burnt in efuse, hardware will choose the - * greater efuse block number as the private key. - * * @param key The MPI in which this functions stores the hardware context. * This must be uninitialized * @param efuse_blk The efuse key block that should be used as the private key. @@ -42,11 +37,6 @@ int esp_ecdsa_privkey_load_mpi(mbedtls_mpi *key, int efuse_blk); * We break the MPI struct used to represent the private key `d` in ECP keypair * in order to differentiate between hardware key and software key * - * @note Currently, `efuse_blk` is not used internally. - * Hardware will choose the efuse block that has purpose set to ECDSA_KEY. - * In case of multiple ECDSA_KEY burnt in efuse, hardware will choose the - * greater efuse block number as the private key. - * * @param key_ctx The context in which this functions stores the hardware context. * This must be uninitialized * @param efuse_blk The efuse key block that should be used as the private key. From 5fac5b0191813bfc02d6484b7ac009e7b6d84c21 Mon Sep 17 00:00:00 2001 From: Sachin Parekh Date: Fri, 31 Mar 2023 14:30:18 +0530 Subject: [PATCH 3/4] mbedtls/ecdsa: Add ECDSA signature generation test --- .../mbedtls/test_apps/ecdsa_key_p192.pem | 5 + .../mbedtls/test_apps/ecdsa_key_p256.pem | 5 + .../test_apps/main/test_mbedtls_ecdsa.c | 93 ++++++++++++++++++- .../mbedtls/test_apps/pytest_mbedtls_ut.py | 7 ++ .../mbedtls/test_apps/sdkconfig.ci.ecdsa_sign | 2 + 5 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 components/mbedtls/test_apps/ecdsa_key_p192.pem create mode 100644 components/mbedtls/test_apps/ecdsa_key_p256.pem create mode 100644 components/mbedtls/test_apps/sdkconfig.ci.ecdsa_sign diff --git a/components/mbedtls/test_apps/ecdsa_key_p192.pem b/components/mbedtls/test_apps/ecdsa_key_p192.pem new file mode 100644 index 0000000000..a0ca456b88 --- /dev/null +++ b/components/mbedtls/test_apps/ecdsa_key_p192.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MF8CAQEEGNav/J4c/nx4R+a30zxRJ2e7l15YTyZlkqAKBggqhkjOPQMBAaE0AzIA +BIhHJTy0t4ckXgfhx/x2D2uD9oF9m1/EuZz8qu3vugLDHApVF+CdEMsjrn4PH01p +1Q== +-----END EC PRIVATE KEY----- diff --git a/components/mbedtls/test_apps/ecdsa_key_p256.pem b/components/mbedtls/test_apps/ecdsa_key_p256.pem new file mode 100644 index 0000000000..3f6b708532 --- /dev/null +++ b/components/mbedtls/test_apps/ecdsa_key_p256.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIBElYzI+FTYu0axLSDoANj0kfm1/oxBzMCDLx89MK0fzoAoGCCqGSM49 +AwEHoUQDQgAEoo9SYCCbVDwTL1Gxib/H+oRcVpYqAGfdfIwPY4t2f7n2TIdbWptZ +CsRTBHINfN6sfq1JjPdcwxwegfJHAXQF1Q== +-----END EC PRIVATE KEY----- diff --git a/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c b/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c index bb6ba9bddd..aeb830f0b2 100644 --- a/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c +++ b/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c @@ -20,6 +20,8 @@ #include "ccomp_timer.h" #include "unity.h" +#include "ecdsa/ecdsa_alt.h" + #define TEST_ASSERT_MBEDTLS_OK(X) TEST_ASSERT_EQUAL_HEX32(0, -(X)) #if CONFIG_NEWLIB_NANO_FORMAT @@ -30,8 +32,6 @@ #define NEWLIB_NANO_COMPAT_CAST(int64_t_var) int64_t_var #endif -#if CONFIG_MBEDTLS_HARDWARE_ECC || CONFIG_MBEDTLS_HARDWARE_ECDSA_VERIFY - /* * All the following values are in big endian format, as required by the mbedTLS APIs */ @@ -43,6 +43,8 @@ const uint8_t sha[] = { 0x91, 0xbe, 0x58, 0x10, 0xfe, 0x80, 0x65, 0x6e }; +#if CONFIG_MBEDTLS_HARDWARE_ECC || CONFIG_MBEDTLS_HARDWARE_ECDSA_VERIFY + const uint8_t ecdsa256_r[] = { 0x26, 0x1a, 0x0f, 0xbd, 0xa5, 0xe5, 0x1e, 0xe7, 0xb3, 0xc3, 0xb7, 0x09, 0xd1, 0x4a, 0x7a, 0x2a, @@ -146,3 +148,90 @@ TEST_CASE("mbedtls ECDSA signature verification performance on SECP256R1", "[mbe } #endif /* CONFIG_MBEDTLS_HARDWARE_ECC */ + +#if CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN + +/* + * This test assumes that ECDSA private key has been burnt in efuse. + * + * ecdsa_key_p192.pem must be burnt in efuse block 4 + * ecdsa_key_p256.pem must be burnt in efuse block 5 + */ +#define SECP192R1_EFUSE_BLOCK 4 // EFUSE_BLK_KEY0 +#define SECP256R1_EFUSE_BLOCK 5 // EFUSE_BLK_KEY1 + +#define MAX_ECDSA_COMPONENT_LEN 32 +#define HASH_LEN 32 + +const uint8_t ecdsa256_sign_pub_x[] = { + 0xa2, 0x8f, 0x52, 0x60, 0x20, 0x9b, 0x54, 0x3c, + 0x13, 0x2f, 0x51, 0xb1, 0x89, 0xbf, 0xc7, 0xfa, + 0x84, 0x5c, 0x56, 0x96, 0x2a, 0x00, 0x67, 0xdd, + 0x7c, 0x8c, 0x0f, 0x63, 0x8b, 0x76, 0x7f, 0xb9, +}; + +const uint8_t ecdsa256_sign_pub_y[] = { + 0xf6, 0x4c, 0x87, 0x5b, 0x5a, 0x9b, 0x59, 0x0a, + 0xc4, 0x53, 0x04, 0x72, 0x0d, 0x7c, 0xde, 0xac, + 0x7e, 0xad, 0x49, 0x8c, 0xf7, 0x5c, 0xc3, 0x1c, + 0x1e, 0x81, 0xf2, 0x47, 0x01, 0x74, 0x05, 0xd5 +}; + +const uint8_t ecdsa192_sign_pub_x[] = { + 0x88, 0x47, 0x25, 0x3c, 0xb4, 0xb7, 0x87, 0x24, + 0x5e, 0x07, 0xe1, 0xc7, 0xfc, 0x76, 0x0f, 0x6b, + 0x83, 0xf6, 0x81, 0x7d, 0x9b, 0x5f, 0xc4, 0xb9, +}; + +const uint8_t ecdsa192_sign_pub_y[] = { + 0x9c, 0xfc, 0xaa, 0xed, 0xef, 0xba, 0x02, 0xc3, + 0x1c, 0x0a, 0x55, 0x17, 0xe0, 0x9d, 0x10, 0xcb, + 0x23, 0xae, 0x7e, 0x0f, 0x1f, 0x4d, 0x69, 0xd5 +}; + +void test_ecdsa_sign(mbedtls_ecp_group_id id, const uint8_t *hash, const uint8_t *pub_x, const uint8_t *pub_y) +{ + uint8_t r_be[MAX_ECDSA_COMPONENT_LEN] = {0}; + uint8_t s_be[MAX_ECDSA_COMPONENT_LEN] = {0}; + + mbedtls_mpi r, s; + mbedtls_mpi key_mpi; + + mbedtls_mpi_init(&r); + mbedtls_mpi_init(&s); + + mbedtls_ecdsa_context ecdsa_context; + mbedtls_ecdsa_init(&ecdsa_context); + + if (id == MBEDTLS_ECP_DP_SECP192R1) { + mbedtls_ecp_group_load(&ecdsa_context.MBEDTLS_PRIVATE(grp), MBEDTLS_ECP_DP_SECP192R1); + esp_ecdsa_privkey_load_mpi(&key_mpi, SECP192R1_EFUSE_BLOCK); + } else if (id == MBEDTLS_ECP_DP_SECP256R1) { + mbedtls_ecp_group_load(&ecdsa_context.MBEDTLS_PRIVATE(grp), MBEDTLS_ECP_DP_SECP256R1); + esp_ecdsa_privkey_load_mpi(&key_mpi, SECP256R1_EFUSE_BLOCK); + } + + mbedtls_ecdsa_sign(&ecdsa_context.MBEDTLS_PRIVATE(grp), &r, &s, &key_mpi, sha, HASH_LEN, NULL, NULL); + + mbedtls_mpi_write_binary(&r, r_be, MAX_ECDSA_COMPONENT_LEN); + mbedtls_mpi_write_binary(&s, s_be, MAX_ECDSA_COMPONENT_LEN); + + if (id == MBEDTLS_ECP_DP_SECP192R1) { + // Skip the initial zeroes + test_ecdsa_verify(id, sha, &r_be[8], &s_be[8], pub_x, pub_y); + } else if (id == MBEDTLS_ECP_DP_SECP256R1) { + test_ecdsa_verify(id, sha, r_be, s_be, pub_x, pub_y); + } +} + +TEST_CASE("mbedtls ECDSA signature generation on SECP192R1", "[mbedtls][efuse_key]") +{ + test_ecdsa_sign(MBEDTLS_ECP_DP_SECP192R1, sha, ecdsa192_sign_pub_x, ecdsa192_sign_pub_y); +} + +TEST_CASE("mbedtls ECDSA signature generation on SECP256R1", "[mbedtls][efuse_key]") +{ + test_ecdsa_sign(MBEDTLS_ECP_DP_SECP256R1, sha, ecdsa256_sign_pub_x, ecdsa256_sign_pub_y); +} + +#endif /* CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN */ diff --git a/components/mbedtls/test_apps/pytest_mbedtls_ut.py b/components/mbedtls/test_apps/pytest_mbedtls_ut.py index beb6cc7fcc..1a2fdd0fd4 100644 --- a/components/mbedtls/test_apps/pytest_mbedtls_ut.py +++ b/components/mbedtls/test_apps/pytest_mbedtls_ut.py @@ -67,3 +67,10 @@ def test_mbedtls_psram(dut: Dut) -> None: ) def test_mbedtls_psram_esp32(dut: Dut) -> None: dut.run_all_single_board_cases() + + +@pytest.mark.esp32h2 +@pytest.mark.ecdsa_efuse +@pytest.mark.parametrize('config', ['ecdsa_sign',], indirect=True) +def test_mbedtls_ecdsa_sign(dut: Dut) -> None: + dut.run_all_single_board_cases(group='efuse_key') diff --git a/components/mbedtls/test_apps/sdkconfig.ci.ecdsa_sign b/components/mbedtls/test_apps/sdkconfig.ci.ecdsa_sign new file mode 100644 index 0000000000..be59d96a4e --- /dev/null +++ b/components/mbedtls/test_apps/sdkconfig.ci.ecdsa_sign @@ -0,0 +1,2 @@ +CONFIG_MBEDTLS_HARDWARE_ECDSA_VERIFY=y +CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN=y From 4a74ae4921ac025927203545fedec7b6ecc0438d Mon Sep 17 00:00:00 2001 From: Sachin Parekh Date: Thu, 6 Apr 2023 12:20:44 +0530 Subject: [PATCH 4/4] ci: Add patterns and target-tests for `ecdsa_efuse` runner --- .gitlab/ci/dependencies/dependencies.yml | 1 + .gitlab/ci/rules.yml | 84 ++++++++++++++++++++++++ .gitlab/ci/target-test.yml | 8 +++ conftest.py | 1 + 4 files changed, 94 insertions(+) diff --git a/.gitlab/ci/dependencies/dependencies.yml b/.gitlab/ci/dependencies/dependencies.yml index 70b3ee9c01..9d5abc4947 100644 --- a/.gitlab/ci/dependencies/dependencies.yml +++ b/.gitlab/ci/dependencies/dependencies.yml @@ -139,6 +139,7 @@ build:integration_test: - adc # component_ut_pytest_esp32x_adc - i154 - flash_multi + - ecdsa patterns: - "{0}-{1}-{2}" - "{0}-{2}" diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index 43b21d3569..23b1d30b40 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -306,6 +306,11 @@ - "components/efuse/**/*" - "examples/peripherals/adc/**/*" +.patterns-target_test-ecdsa: &patterns-target_test-ecdsa + - "components/hal/**/*" + - "components/efuse/**/*" + - "components/mbedtls/port/ecdsa/*" + ############## # if anchors # ############## @@ -623,6 +628,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -656,6 +663,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -688,6 +697,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -720,6 +731,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -752,6 +765,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -784,6 +799,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -816,6 +833,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -848,6 +867,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -879,6 +900,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -904,6 +927,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -928,6 +953,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -952,6 +979,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -976,6 +1005,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1000,6 +1031,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1024,6 +1057,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1048,6 +1083,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1110,6 +1147,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1150,6 +1189,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1188,6 +1229,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1227,6 +1270,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1265,6 +1310,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1303,6 +1350,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1341,6 +1390,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1379,6 +1430,8 @@ changes: *patterns-example_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1502,6 +1555,8 @@ changes: *patterns-integration_test-wifi - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1537,6 +1592,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1566,6 +1623,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1594,6 +1653,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1622,6 +1683,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1650,6 +1713,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1678,6 +1743,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1706,6 +1773,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1734,6 +1803,8 @@ changes: *patterns-downloadable-tools - <<: *if-dev-push changes: *patterns-target_test-adc + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -2002,6 +2073,19 @@ - <<: *if-dev-push changes: *patterns-target_test-adc +.rules:test:component_ut-esp32h2-ecdsa: + rules: + - <<: *if-revert-branch + when: never + - <<: *if-protected + - <<: *if-label-build-only + when: never + - <<: *if-label-component_ut + - <<: *if-label-component_ut_esp32h2 + - <<: *if-label-target_test + - <<: *if-dev-push + changes: *patterns-target_test-ecdsa + .rules:test:component_ut-esp32s2: rules: - <<: *if-revert-branch diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index af043b04e7..ce51b37120 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -892,6 +892,14 @@ pytest_components_esp32h2_adc: - build_pytest_components_esp32h2 tags: [ esp32h2, adc ] +component_ut_pytest_esp32h2_ecdsa: + extends: + - .pytest_components_dir_template + - .rules:test:component_ut-esp32h2-ecdsa + needs: + - build_pytest_components_esp32h2 + tags: [ esp32h2, ecdsa_efuse ] + pytest_components_esp32c6_generic_multi_device: extends: - .pytest_components_dir_template diff --git a/conftest.py b/conftest.py index baad264ce3..967587f47b 100644 --- a/conftest.py +++ b/conftest.py @@ -121,6 +121,7 @@ ENV_MARKERS = { 'multi_dut_modbus_rs485': 'a pair of runners connected by RS485 bus', 'psramv0': 'Runner with PSRAM version 0', 'esp32eco3': 'Runner with esp32 eco3 connected', + 'ecdsa_efuse': 'Runner with test ECDSA private keys programmed in efuse', # multi-dut markers 'ieee802154': 'ieee802154 related tests should run on ieee802154 runners.', 'openthread_br': 'tests should be used for openthread border router.',