Skip to content

Commit e7a76ff

Browse files
committed
feat(soc): Update ESP32-C5 ECO2 to support SHA512
1 parent 8694f89 commit e7a76ff

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

components/esp_rom/esp32c5/include/esp32c5/rom/sha.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -18,6 +18,11 @@ typedef enum {
1818
SHA1 = 0,
1919
SHA2_224,
2020
SHA2_256,
21+
SHA2_384,
22+
SHA2_512,
23+
SHA2_512224,
24+
SHA2_512256,
25+
SHA2_512T,
2126
SHA_TYPE_MAX
2227
} SHA_TYPE;
2328

components/hal/esp32c5/include/hal/sha_ll.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -168,6 +168,25 @@ static inline void sha_ll_write_digest(esp_sha_type sha_type, void *digest_state
168168
}
169169
}
170170

171+
/**
172+
* @brief Sets SHA512_t T_string parameter
173+
*
174+
* @param t_string T_string parameter
175+
*/
176+
static inline void sha_ll_t_string_set(uint32_t t_string)
177+
{
178+
REG_WRITE(SHA_T_STRING_REG, t_string);
179+
}
180+
181+
/**
182+
* @brief Sets SHA512_t T_string parameter's length
183+
*
184+
* @param t_len T_string parameter length
185+
*/
186+
static inline void sha_ll_t_len_set(uint8_t t_len)
187+
{
188+
REG_WRITE(SHA_T_LENGTH_REG, t_len);
189+
}
171190

172191
#ifdef __cplusplus
173192
}

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,26 @@ config SOC_SHA_SUPPORT_SHA256
10631063
bool
10641064
default y
10651065

1066+
config SOC_SHA_SUPPORT_SHA384
1067+
bool
1068+
default y
1069+
1070+
config SOC_SHA_SUPPORT_SHA512
1071+
bool
1072+
default y
1073+
1074+
config SOC_SHA_SUPPORT_SHA512_224
1075+
bool
1076+
default y
1077+
1078+
config SOC_SHA_SUPPORT_SHA512_256
1079+
bool
1080+
default y
1081+
1082+
config SOC_SHA_SUPPORT_SHA512_T
1083+
bool
1084+
default y
1085+
10661086
config SOC_ECC_CONSTANT_TIME_POINT_MUL
10671087
bool
10681088
default y

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,11 @@
420420
#define SOC_SHA_SUPPORT_SHA1 (1)
421421
#define SOC_SHA_SUPPORT_SHA224 (1)
422422
#define SOC_SHA_SUPPORT_SHA256 (1)
423+
#define SOC_SHA_SUPPORT_SHA384 (1)
424+
#define SOC_SHA_SUPPORT_SHA512 (1)
425+
#define SOC_SHA_SUPPORT_SHA512_224 (1)
426+
#define SOC_SHA_SUPPORT_SHA512_256 (1)
427+
#define SOC_SHA_SUPPORT_SHA512_T (1)
423428

424429
/*--------------------------- ECC CAPS ---------------------------------------*/
425430
#define SOC_ECC_CONSTANT_TIME_POINT_MUL 1

0 commit comments

Comments
 (0)