From 674dc8810ea9a5f661651df481fff6037cba6e4b Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 24 Apr 2025 21:48:53 +0530 Subject: [PATCH] feat(hal): add support for ESP32-C5 ECO2 ECC peripheral --- components/hal/esp32c5/include/hal/ecc_ll.h | 10 +++++----- components/hal/include/hal/ecc_types.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/hal/esp32c5/include/hal/ecc_ll.h b/components/hal/esp32c5/include/hal/ecc_ll.h index 9e56f188b8..9060cdbf72 100644 --- a/components/hal/esp32c5/include/hal/ecc_ll.h +++ b/components/hal/esp32c5/include/hal/ecc_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -121,11 +121,11 @@ static inline void ecc_ll_set_mode(ecc_mode_t mode) static inline void ecc_ll_set_curve(ecc_curve_t curve) { switch(curve) { - case ECC_CURVE_SECP256R1: - REG_SET_BIT(ECC_MULT_CONF_REG, ECC_MULT_KEY_LENGTH); - break; case ECC_CURVE_SECP192R1: - REG_CLR_BIT(ECC_MULT_CONF_REG, ECC_MULT_KEY_LENGTH); + case ECC_CURVE_SECP256R1: + case ECC_CURVE_SECP384R1: + case ECC_CURVE_SM2: + REG_SET_FIELD(ECC_MULT_CONF_REG, ECC_MULT_KEY_LENGTH, curve); break; default: HAL_ASSERT(false && "Unsupported curve"); diff --git a/components/hal/include/hal/ecc_types.h b/components/hal/include/hal/ecc_types.h index 497fb5222c..09030f7f76 100644 --- a/components/hal/include/hal/ecc_types.h +++ b/components/hal/include/hal/ecc_types.h @@ -26,6 +26,8 @@ typedef enum { typedef enum { ECC_CURVE_SECP192R1 = 0x0, ECC_CURVE_SECP256R1, + ECC_CURVE_SECP384R1, + ECC_CURVE_SM2, } ecc_curve_t; typedef enum {