Skip to content

Commit 14d93de

Browse files
KonstantinKondrashovESP-Marius
authored andcommitted
feat(soc): Update efuse related soc_caps for c61 and c5 (MP/beta3)
1 parent 7e5ab45 commit 14d93de

File tree

15 files changed

+46
-13
lines changed

15 files changed

+46
-13
lines changed

components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ esp_err_t esp_efuse_write_key(esp_efuse_block_t block, esp_efuse_purpose_t purpo
288288
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 ||
289289
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 ||
290290
#endif
291-
#if SOC_ECDSA_SUPPORTED
291+
#if SOC_EFUSE_ECDSA_KEY
292292
purpose == ESP_EFUSE_KEY_PURPOSE_ECDSA_KEY ||
293293
#endif
294294
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY)) {
@@ -303,7 +303,7 @@ esp_err_t esp_efuse_write_key(esp_efuse_block_t block, esp_efuse_purpose_t purpo
303303
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 ||
304304
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 ||
305305
#endif //#ifdef SOC_EFUSE_SUPPORT_XTS_AES_256_KEYS
306-
#if SOC_ECDSA_SUPPORTED
306+
#if SOC_EFUSE_ECDSA_KEY
307307
purpose == ESP_EFUSE_KEY_PURPOSE_ECDSA_KEY ||
308308
#endif
309309
#if SOC_KEY_MANAGER_SUPPORTED

components/efuse/test_apps/main/with_key_purposes/test_efuse_keys.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -63,7 +63,7 @@ TEST_CASE("Test efuse API blocks burning XTS and ECDSA keys into BLOCK9", "[efus
6363
purpose = ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2;
6464
TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_write_key(EFUSE_BLK9, purpose, &key, sizeof(key)));
6565
#endif
66-
#if SOC_ECDSA_SUPPORTED
66+
#if SOC_EFUSE_ECDSA_KEY
6767
purpose = ESP_EFUSE_KEY_PURPOSE_ECDSA_KEY;
6868
TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_write_key(EFUSE_BLK9, purpose, &key, sizeof(key)));
6969
#endif
@@ -90,7 +90,7 @@ static esp_err_t s_check_key(esp_efuse_block_t num_key, void* wr_key)
9090
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 ||
9191
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 ||
9292
#endif
93-
#if SOC_ECDSA_SUPPORTED
93+
#if SOC_EFUSE_ECDSA_KEY
9494
purpose == ESP_EFUSE_KEY_PURPOSE_ECDSA_KEY ||
9595
#endif
9696
purpose == ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL ||
@@ -169,7 +169,7 @@ TEST_CASE("Test esp_efuse_write_key for virt mode", "[efuse]")
169169
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 ||
170170
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 ||
171171
#endif //#ifdef SOC_EFUSE_SUPPORT_XTS_AES_256_KEYS
172-
#if SOC_ECDSA_SUPPORTED
172+
#if SOC_EFUSE_ECDSA_KEY
173173
purpose == ESP_EFUSE_KEY_PURPOSE_ECDSA_KEY ||
174174
#endif
175175
purpose == ESP_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY)) {
@@ -204,7 +204,7 @@ TEST_CASE("Test 1 esp_efuse_write_key for FPGA", "[efuse]")
204204

205205
esp_efuse_purpose_t purpose [] = {
206206
ESP_EFUSE_KEY_PURPOSE_USER,
207-
#if SOC_ECDSA_SUPPORTED
207+
#if SOC_EFUSE_ECDSA_KEY
208208
ESP_EFUSE_KEY_PURPOSE_ECDSA_KEY,
209209
#else
210210
ESP_EFUSE_KEY_PURPOSE_RESERVED,

components/hal/efuse_hal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ IRAM_ATTR bool efuse_hal_flash_encryption_enabled(void)
4747
return enabled;
4848
}
4949

50-
#if SOC_ECDSA_SUPPORTED
50+
#if SOC_EFUSE_ECDSA_KEY
5151
void efuse_hal_set_ecdsa_key(int efuse_blk)
5252
{
5353
efuse_ll_set_ecdsa_key_blk(efuse_blk);

components/hal/esp32c61/include/hal/efuse_ll.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ __attribute__((always_inline)) static inline uint32_t efuse_ll_get_chip_ver_pkg(
8484
return (uint32_t)0;
8585
}
8686

87+
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_ecdsa_key_blk(void)
88+
{
89+
return EFUSE0.conf.cfg_ecdsa_blk;
90+
}
91+
92+
__attribute__((always_inline)) static inline void efuse_ll_set_ecdsa_key_blk(int efuse_blk)
93+
{
94+
EFUSE0.conf.cfg_ecdsa_blk = efuse_blk;
95+
}
96+
8797
/******************* eFuse control functions *************************/
8898

8999
__attribute__((always_inline)) static inline bool efuse_ll_get_read_cmd(void)
@@ -137,6 +147,11 @@ __attribute__((always_inline)) static inline void efuse_ll_set_pwr_off_num(uint1
137147
EFUSE0.wr_tim_conf2.pwr_off_num = value;
138148
}
139149

150+
__attribute__((always_inline)) static inline void efuse_ll_rs_bypass_update(void)
151+
{
152+
EFUSE0.wr_tim_conf0_rs_bypass.update = 1;
153+
}
154+
140155
/******************* eFuse control functions *************************/
141156

142157
#ifdef __cplusplus

components/hal/include/hal/efuse_hal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ uint32_t efuse_hal_get_major_chip_version(void);
6161
*/
6262
uint32_t efuse_hal_get_minor_chip_version(void);
6363

64-
#if SOC_ECDSA_SUPPORTED
64+
#if SOC_EFUSE_ECDSA_KEY
6565
/**
6666
* @brief Set the efuse block that should be used as ECDSA private key
6767
*

components/soc/esp32c5/beta3/include/soc/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,10 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS
571571
int
572572
default 2
573573

574+
config SOC_EFUSE_ECDSA_KEY
575+
bool
576+
default y
577+
574578
config SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS
575579
int
576580
default 3

components/soc/esp32c5/beta3/include/soc/soc_caps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
// #define SOC_EFUSE_DIS_DIRECT_BOOT 1
464464
// #define SOC_EFUSE_SOFT_DIS_JTAG 1
465465
// #define SOC_EFUSE_DIS_ICACHE 1
466-
// #define SOC_EFUSE_BLOCK9_KEY_PURPOSE_QUIRK 1 // XTS-AES key purpose not supported for this block
466+
#define SOC_EFUSE_ECDSA_KEY 1
467467

468468
/*-------------------------- Secure Boot CAPS----------------------------*/
469469
// #define SOC_SECURE_BOOT_V2_RSA 1

components/soc/esp32c5/mp/include/soc/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS
351351
int
352352
default 2
353353

354+
config SOC_EFUSE_ECDSA_KEY
355+
bool
356+
default y
357+
354358
config SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS
355359
int
356360
default 3

components/soc/esp32c5/mp/include/soc/soc_caps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@
458458
// #define SOC_EFUSE_DIS_DIRECT_BOOT 1
459459
// #define SOC_EFUSE_SOFT_DIS_JTAG 1
460460
// #define SOC_EFUSE_DIS_ICACHE 1
461-
// #define SOC_EFUSE_BLOCK9_KEY_PURPOSE_QUIRK 1 // XTS-AES key purpose not supported for this block
461+
#define SOC_EFUSE_ECDSA_KEY 1
462462

463463
/*-------------------------- Secure Boot CAPS----------------------------*/
464464
// #define SOC_SECURE_BOOT_V2_RSA 1

components/soc/esp32c61/include/soc/Kconfig.soc_caps.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ config SOC_EFUSE_DIS_ICACHE
795795
bool
796796
default y
797797

798-
config SOC_EFUSE_BLOCK9_KEY_PURPOSE_QUIRK
798+
config SOC_EFUSE_ECDSA_KEY
799799
bool
800800
default y
801801

0 commit comments

Comments
 (0)