mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat: enabled ECDSA-P192 support for ESP32H2
This commit is contained in:
@@ -14,7 +14,7 @@ menu "Test App Configuration"
|
||||
Enabling this option includes HMAC Peripheral related test cases in the build for supported targets.
|
||||
|
||||
config CRYPTO_TEST_APP_ENABLE_ECDSA_TESTS
|
||||
depends on !CRYPTO_TEST_APP_ENABLE_HMAC_TESTS
|
||||
depends on SOC_ECDSA_SUPPORTED && !CRYPTO_TEST_APP_ENABLE_HMAC_TESTS
|
||||
bool "Enable ECDSA Peripheral test cases"
|
||||
default n
|
||||
help
|
||||
|
||||
@@ -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: CC0-1.0
|
||||
*/
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "esp_efuse_chip.h"
|
||||
#include "esp_private/esp_crypto_lock_internal.h"
|
||||
#include "esp_random.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_efuse.h"
|
||||
#include "hal/ecc_ll.h"
|
||||
#include "hal/ecdsa_hal.h"
|
||||
#include "hal/ecdsa_ll.h"
|
||||
@@ -25,6 +27,8 @@
|
||||
#include "ecdsa_params.h"
|
||||
#include "hal_crypto_common.h"
|
||||
|
||||
__attribute__((unused)) static const char * TAG = "crypto_test";
|
||||
|
||||
static void ecdsa_enable_and_reset(void)
|
||||
{
|
||||
ECDSA_RCC_ATOMIC() {
|
||||
@@ -279,17 +283,29 @@ TEST_TEAR_DOWN(ecdsa)
|
||||
|
||||
TEST(ecdsa, ecdsa_SECP192R1_signature_verification)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(0, test_ecdsa_verify(0, sha, ecdsa192_r, ecdsa192_s, ecdsa192_pub_x, ecdsa192_pub_y));
|
||||
if (!esp_efuse_is_ecdsa_p192_curve_supported()) {
|
||||
ESP_LOGI(TAG, "Skipping test because ECDSA 192-curve operations are disabled.");
|
||||
} else {
|
||||
TEST_ASSERT_EQUAL(0, test_ecdsa_verify(0, sha, ecdsa192_r, ecdsa192_s, ecdsa192_pub_x, ecdsa192_pub_y));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ecdsa, ecdsa_SECP192R1_sign_and_verify)
|
||||
{
|
||||
test_ecdsa_sign_and_verify(0, sha, ecdsa192_pub_x, ecdsa192_pub_y, false, ECDSA_K_TYPE_TRNG);
|
||||
if (!esp_efuse_is_ecdsa_p192_curve_supported()) {
|
||||
ESP_LOGI(TAG, "Skipping test because ECDSA 192-curve operations are disabled.");
|
||||
} else {
|
||||
test_ecdsa_sign_and_verify(0, sha, ecdsa192_pub_x, ecdsa192_pub_y, false, ECDSA_K_TYPE_TRNG);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ecdsa, ecdsa_SECP192R1_corrupt_signature)
|
||||
{
|
||||
test_ecdsa_corrupt_data(0, sha, ecdsa192_r, ecdsa192_s, ecdsa192_pub_x, ecdsa192_pub_y);
|
||||
if (!esp_efuse_is_ecdsa_p192_curve_supported()) {
|
||||
ESP_LOGI(TAG, "Skipping test because ECDSA 192-curve operations are disabled.");
|
||||
} else {
|
||||
test_ecdsa_corrupt_data(0, sha, ecdsa192_r, ecdsa192_s, ecdsa192_pub_x, ecdsa192_pub_y);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ecdsa, ecdsa_SECP256R1_signature_verification)
|
||||
@@ -322,7 +338,11 @@ TEST(ecdsa, ecdsa_SECP256R1_det_sign_and_verify)
|
||||
#ifdef SOC_ECDSA_SUPPORT_EXPORT_PUBKEY
|
||||
TEST(ecdsa, ecdsa_SECP192R1_export_pubkey)
|
||||
{
|
||||
test_ecdsa_export_pubkey(0, 0);
|
||||
if (!esp_efuse_is_ecdsa_p192_curve_supported()) {
|
||||
ESP_LOGI(TAG, "Skipping test because ECDSA 192-curve operations are disabled.");
|
||||
} else {
|
||||
test_ecdsa_export_pubkey(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ecdsa, ecdsa_SECP256R1_export_pubkey)
|
||||
|
||||
Reference in New Issue
Block a user