Skip to content

Commit afdf1a3

Browse files
committed
feat(soc): Update ESP32-C5 ECO2 to support SHA512
1 parent d0aabd3 commit afdf1a3

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
@@ -1071,6 +1071,26 @@ config SOC_SHA_SUPPORT_SHA256
10711071
bool
10721072
default y
10731073

1074+
config SOC_SHA_SUPPORT_SHA384
1075+
bool
1076+
default y
1077+
1078+
config SOC_SHA_SUPPORT_SHA512
1079+
bool
1080+
default y
1081+
1082+
config SOC_SHA_SUPPORT_SHA512_224
1083+
bool
1084+
default y
1085+
1086+
config SOC_SHA_SUPPORT_SHA512_256
1087+
bool
1088+
default y
1089+
1090+
config SOC_SHA_SUPPORT_SHA512_T
1091+
bool
1092+
default y
1093+
10741094
config SOC_ECC_CONSTANT_TIME_POINT_MUL
10751095
bool
10761096
default y

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@
422422
#define SOC_SHA_SUPPORT_SHA1 (1)
423423
#define SOC_SHA_SUPPORT_SHA224 (1)
424424
#define SOC_SHA_SUPPORT_SHA256 (1)
425+
#define SOC_SHA_SUPPORT_SHA384 (1)
426+
#define SOC_SHA_SUPPORT_SHA512 (1)
427+
#define SOC_SHA_SUPPORT_SHA512_224 (1)
428+
#define SOC_SHA_SUPPORT_SHA512_256 (1)
429+
#define SOC_SHA_SUPPORT_SHA512_T (1)
425430

426431
/*--------------------------- ECC CAPS ---------------------------------------*/
427432
#define SOC_ECC_CONSTANT_TIME_POINT_MUL 1

0 commit comments

Comments
 (0)