Przeglądaj źródła

ecc: added `SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK` soc caps for esp32c2
as the ESP32C2 ECC peripheral has a bug in ECC point verification,
if value of K is zero the verification fails

harshal.patil 2 lat temu
rodzic
commit
56ac7eee3b

+ 2 - 2
components/hal/test_apps/ecc/main/test_ecc.c

@@ -132,7 +132,7 @@ TEST_CASE("ECC point multiplication on SECP192R1 and SECP256R1", "[ecc][hal]")
 }
 #endif
 
-#if SOC_ECC_SUPPORT_POINT_VERIFY
+#if SOC_ECC_SUPPORT_POINT_VERIFY && !defined(SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK)
 static int ecc_point_verify(const uint8_t *x_le, const uint8_t *y_le, uint8_t len)
 {
     ecc_enable_and_reset();
@@ -182,7 +182,7 @@ TEST_CASE("ECC point verification on SECP192R1 and SECP256R1", "[ecc][hal]")
 }
 #endif
 
-#if SOC_ECC_SUPPORT_POINT_MULT && SOC_ECC_SUPPORT_POINT_VERIFY
+#if SOC_ECC_SUPPORT_POINT_MULT && SOC_ECC_SUPPORT_POINT_VERIFY && !defined(SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK)
 TEST_CASE("ECC point verification and multiplication on SECP192R1 and SECP256R1", "[ecc][hal]")
 {
     test_ecc_point_mul_inner(true);

+ 4 - 0
components/soc/esp32c2/include/soc/Kconfig.soc_caps.in

@@ -203,6 +203,10 @@ config SOC_CPU_IDRAM_SPLIT_USING_PMP
     bool
     default y
 
+config SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK
+    bool
+    default y
+
 config SOC_GDMA_GROUPS
     int
     default 1

+ 3 - 0
components/soc/esp32c2/include/soc/soc_caps.h

@@ -98,6 +98,9 @@
 
 #define SOC_CPU_IDRAM_SPLIT_USING_PMP   1
 
+/*-------------------------- ECC CAPS --------------------------*/
+#define SOC_ECC_SUPPORT_POINT_VERIFY_QUIRK  1  // C2 ECC peripheral has a bug in ECC point verification, if value of K is zero the verification fails
+
 /*-------------------------- GDMA CAPS -------------------------------------*/
 #define SOC_GDMA_GROUPS                 (1U) // Number of GDMA groups
 #define SOC_GDMA_PAIRS_PER_GROUP        (1U) // Number of GDMA pairs in each group