From cd38d68bd1c38c854e6336fb0b12629e8e72d821 Mon Sep 17 00:00:00 2001 From: Ashish Sharma Date: Thu, 30 Apr 2026 17:30:33 +0800 Subject: [PATCH] feat(bootloader_support): remove P192 curve support --- components/bootloader/Kconfig.projbuild | 13 ++--------- components/bootloader/project_include.cmake | 5 +---- .../include/esp_secure_boot.h | 6 ++--- .../secure_boot_ecdsa_signature.c | 11 +--------- .../secure_boot_signatures_app.c | 11 ---------- .../secure_boot_signatures_bootloader.c | 11 ---------- .../mbedtls/port/include/mbedtls/esp_config.h | 8 +------ .../release-6.x/6.0/security.rst | 8 +++++++ docs/en/security/secure-boot-v2.rst | 22 +++++-------------- ...security-features-enablement-workflows.rst | 6 +---- .../release-6.x/6.0/security.rst | 1 + docs/zh_CN/security/secure-boot-v2.rst | 22 +++++-------------- ...security-features-enablement-workflows.rst | 6 +---- .../help_custom_targets_skip.py | 6 ++++- tools/idf_py_actions/serial_ext.py | 4 ++-- .../secure_boot/pytest_secure_boot.py | 10 +++------ .../secure_boot/sdkconfig.ci.ecdsa_p192 | 9 -------- .../secure_boot/test_ecdsa_p192_key.pem | 5 ----- 18 files changed, 40 insertions(+), 124 deletions(-) delete mode 100644 tools/test_apps/security/secure_boot/sdkconfig.ci.ecdsa_p192 delete mode 100644 tools/test_apps/security/secure_boot/test_ecdsa_p192_key.pem diff --git a/components/bootloader/Kconfig.projbuild b/components/bootloader/Kconfig.projbuild index 3f4e3810d0c..213b7984735 100644 --- a/components/bootloader/Kconfig.projbuild +++ b/components/bootloader/Kconfig.projbuild @@ -558,22 +558,13 @@ menu "Security features" depends on SECURE_SIGNED_APPS_ECDSA_V2_SCHEME default SECURE_BOOT_ECDSA_KEY_LEN_256_BITS help - Select the ECDSA key size. Three key sizes are supported depending upon on the target: + Select the ECDSA key size. Two key sizes are supported depending on the target: - - 192 bit key using NISTP192 curve (Legacy, not recommended) - 256 bit key using NISTP256 curve (Recommended) - 384 bit key using NISTP384 curve (Recommended) - The advantage of using 384 and 256 bit keys is the extra randomness which makes it difficult to be - bruteforced compared to 192 bit key. At present, both key sizes are practically implausible to bruteforce. - config SECURE_BOOT_ECDSA_KEY_LEN_192_BITS - bool "Using ECC curve NISTP192 (Legacy, not recommended)" - depends on SECURE_SIGNED_APPS_ECDSA_V2_SCHEME - help - This legacy option is not recommended for new designs. Prefer NISTP256 or NISTP384. - config SECURE_BOOT_ECDSA_KEY_LEN_256_BITS bool "Using ECC curve NISTP256 (Recommended)" depends on SECURE_SIGNED_APPS_ECDSA_V2_SCHEME @@ -708,7 +699,7 @@ menu "Security features" Key file is an ECDSA private key (NIST256p curve) in PEM format for Secure Boot V1. Key file is an RSA private key in PEM format for Secure Boot V2 (RSA scheme). - Key file is an ECDSA private key (NIST 192p, 256p or 384p) in PEM format for Secure Boot V2 (ECDSA scheme). + Key file is an ECDSA private key (256p or 384p) in PEM format for Secure Boot V2 (ECDSA scheme). Path is evaluated relative to the project directory. diff --git a/components/bootloader/project_include.cmake b/components/bootloader/project_include.cmake index aa9e368e43a..121f6514f94 100644 --- a/components/bootloader/project_include.cmake +++ b/components/bootloader/project_include.cmake @@ -43,7 +43,6 @@ if(CONFIG_SECURE_SIGNED_APPS) set(bootloader_binary_files ${bootloader_binary_files} "${BOOTLOADER_BUILD_DIR}/bootloader-reflash-digest.bin" - "${BOOTLOADER_BUILD_DIR}/secure-bootloader-key-192.bin" "${BOOTLOADER_BUILD_DIR}/secure-bootloader-key-256.bin" ) endif() @@ -66,9 +65,7 @@ if(CONFIG_SECURE_SIGNED_APPS) "Secure Boot Signing Key ${CONFIG_SECURE_BOOT_SIGNING_KEY} does not exist. Generate using:" "\tidf.py secure-generate-signing-key ${CONFIG_SECURE_BOOT_SIGNING_KEY}") else() - if(CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS) - set(scheme "ecdsa192") - elseif(CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS) + if(CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS) set(scheme "ecdsa256") elseif(CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_384_BITS) set(scheme "ecdsa384") diff --git a/components/bootloader_support/include/esp_secure_boot.h b/components/bootloader_support/include/esp_secure_boot.h index 4da6c38c685..4fa79dac4b2 100644 --- a/components/bootloader_support/include/esp_secure_boot.h +++ b/components/bootloader_support/include/esp_secure_boot.h @@ -70,11 +70,9 @@ typedef enum { #define ESP_SECURE_BOOT_SCHEME ESP_SECURE_BOOT_V2_ECDSA #endif -/* Expected ECDSA curve ID from menuconfig "ECDSA key size" (matches ECDSA_CURVE_P192/P256/P384 in ROM) */ +/* Expected ECDSA curve ID from menuconfig "ECDSA key size" (matches ECDSA_CURVE_P256/P384 in ROM) */ #if CONFIG_SECURE_SIGNED_APPS_ECDSA_V2_SCHEME -#if CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS -#define ESP_SECURE_BOOT_ECDSA_CURVE_ID ECDSA_CURVE_P192 -#elif CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS +#if CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS #define ESP_SECURE_BOOT_ECDSA_CURVE_ID ECDSA_CURVE_P256 #elif CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_384_BITS #define ESP_SECURE_BOOT_ECDSA_CURVE_ID ECDSA_CURVE_P384 diff --git a/components/bootloader_support/src/secure_boot_v2/secure_boot_ecdsa_signature.c b/components/bootloader_support/src/secure_boot_v2/secure_boot_ecdsa_signature.c index 67bbff382c6..698786df704 100644 --- a/components/bootloader_support/src/secure_boot_v2/secure_boot_ecdsa_signature.c +++ b/components/bootloader_support/src/secure_boot_v2/secure_boot_ecdsa_signature.c @@ -13,9 +13,7 @@ ESP_LOG_ATTR_TAG(TAG, "secure_boot_v2_ecdsa"); -#if CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS -#define ECDSA_INTEGER_LEN 24 -#elif CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_384_BITS +#if CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_384_BITS #define ECDSA_INTEGER_LEN 48 #else #define ECDSA_INTEGER_LEN 32 @@ -41,13 +39,6 @@ esp_err_t verify_ecdsa_signature_block(const ets_secure_boot_signature_t *sig_bl psa_ecc_family_t curve_family; switch(trusted_block->ecdsa.key.curve_id) { -#if CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS - case ECDSA_CURVE_P192: - key_size = 24; - curve_family = PSA_ECC_FAMILY_SECP_R1; - psa_set_key_bits(&key_attributes, PSA_BYTES_TO_BITS(key_size)); - break; -#endif /* CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS */ #if CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS case ECDSA_CURVE_P256: key_size = 32; diff --git a/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_app.c b/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_app.c index 7af567d2b10..c5f96006180 100644 --- a/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_app.c +++ b/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_app.c @@ -50,17 +50,6 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo } #endif -#if SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED && CONFIG_SECURE_SIGNED_APPS_ECDSA_V2_SCHEME - if (block->ecdsa.key.curve_id == ECDSA_CURVE_P192) { - // Enabling ECDSA-192 Curve mode - esp_err_t err = esp_efuse_enable_ecdsa_p192_curve_mode(); - if (err != ESP_OK) { - ESP_LOGE(TAG, "Failed to enable ECDSA-192 curve mode: %d", err); - return err; - } - } -#endif - return ESP_OK; } diff --git a/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_bootloader.c b/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_bootloader.c index 55e5e774519..71cc6dcd7f6 100644 --- a/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_bootloader.c +++ b/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_bootloader.c @@ -79,17 +79,6 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo } #endif -#if SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED && CONFIG_SECURE_SIGNED_APPS_ECDSA_V2_SCHEME - if (block->ecdsa.key.curve_id == ECDSA_CURVE_P192) { - // Enabling ECDSA-192 Curve mode - esp_err_t err = esp_efuse_enable_ecdsa_p192_curve_mode(); - if (err != ESP_OK) { - ESP_LOGE(TAG, "Failed to enable ECDSA-192 curve mode: %d", err); - return err; - } - } -#endif - return ESP_OK; } diff --git a/components/mbedtls/port/include/mbedtls/esp_config.h b/components/mbedtls/port/include/mbedtls/esp_config.h index 014f450c5a6..fe0b0f344b6 100644 --- a/components/mbedtls/port/include/mbedtls/esp_config.h +++ b/components/mbedtls/port/include/mbedtls/esp_config.h @@ -277,7 +277,7 @@ #ifdef CONFIG_MBEDTLS_HARDWARE_ECC #ifdef CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK - /* Use hardware accelerator for SECP192R1 and SECP256R1 curves, + /* Use hardware accelerator for SECP256R1 curves, * software implementation for rest of the curves */ #define MBEDTLS_ECP_MUL_ALT_SOFT_FALLBACK @@ -525,7 +525,6 @@ #endif /** - * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED * * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve * module. By default all supported curves are enabled. @@ -543,11 +542,6 @@ #else #undef PSA_WANT_ECC_SECP_R1_384 #endif -#ifdef CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS -#define PSA_WANT_ECC_SECP_R1_192 1 -#else -#undef PSA_WANT_ECC_SECP_R1_192 -#endif #ifdef CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED #define PSA_WANT_ECC_SECP_R1_521 1 #else diff --git a/docs/en/migration-guides/release-6.x/6.0/security.rst b/docs/en/migration-guides/release-6.x/6.0/security.rst index 36264b0edd5..6ca1c60d3be 100644 --- a/docs/en/migration-guides/release-6.x/6.0/security.rst +++ b/docs/en/migration-guides/release-6.x/6.0/security.rst @@ -164,3 +164,11 @@ The following deprecated functions have been removed: --------------------- - When NVS encryption is enabled on SoCs with the HMAC peripheral that have flash encryption enabled, the HMAC-based NVS encryption scheme is now selected as default instead of the flash encryption-based scheme. If your application previously used the flash encryption-based scheme, you need to manually configure the NVS encryption scheme to flash encryption from HMAC through ``menuconfig`` or your project's ``sdkconfig`` (i.e., setting ``CONFIG_NVS_SEC_KEY_PROTECT_USING_FLASH_ENC=y``). + +Mbed TLS v4.1 migration +----------------------- + +Bootloader Support +~~~~~~~~~~~~~~~~~~ + +- Starting with Mbed TLS 4.1, legacy NISTP192 support has been removed. diff --git a/docs/en/security/secure-boot-v2.rst b/docs/en/security/secure-boot-v2.rst index 532930fe147..934b13a254e 100644 --- a/docs/en/security/secure-boot-v2.rst +++ b/docs/en/security/secure-boot-v2.rst @@ -7,7 +7,7 @@ Secure Boot v2 {IDF_TARGET_SBV2_SCHEME:default="RSA-PSS", esp32c2, esp32c61="ECDSA", esp32c6, esp32h2, esp32p4, esp32c5, esp32h21="RSA-PSS or ECDSA"} -{IDF_TARGET_SBV2_KEY:default="RSA-3072", esp32c2, esp32c61="ECDSA-256 or ECDSA-192", esp32c6, esp32h2, esp32p4, esp32h21="RSA-3072, ECDSA-256, or ECDSA-192", esp32c5="RSA-3072, ECDSA-384, ECDSA-256, or ECDSA-192"} +{IDF_TARGET_SBV2_KEY:default="RSA-3072", esp32c2, esp32c61="ECDSA-256", esp32c6, esp32h2, esp32p4, esp32h21="RSA-3072, ECDSA-256", esp32c5="RSA-3072, ECDSA-384, ECDSA-256"} {IDF_TARGET_SECURE_BOOT_OPTION_TEXT:default="", esp32c6, esp32h2, esp32p4, esp32h21="RSA is recommended for faster verification. You can choose either the RSA or ECDSA scheme from the menu.", esp32c5="ECDSA is recommended for faster verification. You can choose either the RSA or ECDSA scheme from the menu."} @@ -75,9 +75,7 @@ The Secure Boot process on {IDF_TARGET_NAME} involves the following steps: 2. When the second stage bootloader loads a particular application image, the application's {IDF_TARGET_SBV2_SCHEME} signature is verified. If the verification is successful, the application image is executed. -.. only:: SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED - The ECDSA-P192 curve is disabled by default on {IDF_TARGET_NAME}. If the provided secure boot signing key uses the ECDSA-P192 curve, the system attempts to enable support for ECDSA-P192 curve mode to proceed with secure boot. However, if the curve mode has already been locked, enabling ECDSA-P192 is not possible. In such cases, secure boot cannot be configured using an ECDSA-P192 key. The user must instead provide a signing key based on the ECDSA-P256 curve or RSA based signing key. Advantages ---------- @@ -254,7 +252,7 @@ The content of each signature block is shown in the following table: .. only:: SOC_SECURE_BOOT_V2_ECC - .. list-table:: Content of an ECDSA-256 / ECDSA-192 Signature Block + .. list-table:: Content of an ECDSA-256 Signature Block :widths: 10 10 40 :header-rows: 1 @@ -275,7 +273,7 @@ The content of each signature block is shown in the following table: - SHA-256 hash of only the image content, not including the signature block. * - 36 - 1 - - Curve ID. 1 for NIST192p curve. 2 for NIST256p curve. + - Curve ID. 2 for NIST256p curve. * - 37 - 64 - ECDSA Public key: 32-byte X coordinate followed by 32-byte Y coordinate. @@ -530,9 +528,7 @@ Restrictions After Secure Boot Is Enabled - After Secure Boot is enabled, further read-protection of eFuse keys is not possible. This is done to prevent an attacker from read-protecting the eFuse block that contains the Secure Boot public key digest, which could result in immediate denial of service and potentially enable a fault injection attack to bypass the signature verification. For further information on read-protected keys, see the details below. -.. only:: SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED - When Secure Boot is enabled, the ECDSA curve mode becomes write-protected. This means that if the curve mode was not previously set to use the ECDSA-P192 key before enabling Secure Boot, it will no longer be possible to configure or use the ECDSA-P192 curve on the ECDSA_DS peripheral afterward. Burning read-protected keys ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -581,11 +577,11 @@ The build system will prompt you with a command to generate a new signing key vi .. only:: SOC_ECDSA_SUPPORT_CURVE_P384 - Select the ECDSA scheme by passing ``--version 2 --scheme ecdsa384``, ``--version 2 --scheme ecdsa256`` or ``--version 2 --scheme ecdsa192`` to generate corresponding ECDSA private key. + Select the ECDSA scheme by passing ``--version 2 --scheme ecdsa384`` or ``--version 2 --scheme ecdsa256`` to generate the corresponding ECDSA private key. .. only:: not SOC_ECDSA_SUPPORT_CURVE_P384 - Select the ECDSA scheme by passing ``--version 2 --scheme ecdsa256`` or ``--version 2 --scheme ecdsa192`` to generate corresponding ECDSA private key. + Select the ECDSA scheme by passing ``--version 2 --scheme ecdsa256`` to generate the corresponding ECDSA private key. The strength of the signing key is proportional to (a) the random number source of the system, and (b) the correctness of the algorithm used. For production devices, we recommend generating signing keys from a system with a quality entropy source and using the best available {IDF_TARGET_SBV2_SCHEME} key generation utilities. @@ -601,12 +597,6 @@ For example, to generate a signing key using the OpenSSL command line: .. only:: SOC_SECURE_BOOT_V2_ECC - For the ECC NIST192p curve - - .. code-block:: - - openssl ecparam -name prime192v1 -genkey -noout -out my_secure_boot_signing_key.pem - For the ECC NIST256p curve .. code-block:: @@ -728,7 +718,7 @@ Secure Boot Best Practices .. note:: - If Secure Boot v2 is configured using the ECDSA P-384 signature scheme, all signing keys used must be ECDSA-P384 keys. Using keys with different elliptic curves (e.g., P-192 or P-256) alongside P-384 is not supported and will cause signature verification to fail during boot. + If Secure Boot v2 is configured using the ECDSA P-384 signature scheme, all signing keys used must be ECDSA-P384 keys. Using keys with different elliptic curves (for example, P-256) alongside P-384 is not supported and will cause signature verification to fail during boot. .. _secure-boot-v2-key-revocation: diff --git a/docs/en/security/security-features-enablement-workflows.rst b/docs/en/security/security-features-enablement-workflows.rst index b1d87e244d1..ab1c66bf21e 100644 --- a/docs/en/security/security-features-enablement-workflows.rst +++ b/docs/en/security/security-features-enablement-workflows.rst @@ -448,13 +448,9 @@ In this workflow we shall use ``espsecure`` tool to generate signing keys and us espsecure generate-signing-key --version 2 --scheme ecdsa256 secure_boot_signing_key.pem - .. only:: not SOC_ECDSA_SUPPORT_CURVE_P384 - - The scheme in the above command can be changed to ``ecdsa192`` to generate ecdsa192 private key. - .. only:: SOC_ECDSA_SUPPORT_CURVE_P384 - The scheme in the above command can be changed to ``ecdsa384`` or ``ecdsa192`` to generate ecdsa384 or ecdsa192 private key. + The scheme in the above command can be changed to ``ecdsa384`` to generate an ecdsa384 private key. .. only:: SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/security.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/security.rst index 0f950be7270..6f70bfad493 100644 --- a/docs/zh_CN/migration-guides/release-6.x/6.0/security.rst +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/security.rst @@ -151,6 +151,7 @@ BluFi(基于 BLE 的 Wi-Fi 配网)功能受到 ESP-IDF v6.0 中 Mbed TLS v4. - 在 ESP-IDF v6.0 中,用于安全启动的 ECDSA 应为 NISTP256/NISTP384 曲线。 - 对旧版 NISTP192 的支持已弃用,仅当通过 ``CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS`` 显式启用时方可使用。 - 对旧版 NISTP192 的支持可能会在下一个 ESP-IDF 版本中被移除,因此强烈建议迁移至 NISTP256/NISTP384。 +- 从 Mbed TLS 4.1 开始,已移除对旧版 NISTP192 的支持。 **已移除的废弃 API** diff --git a/docs/zh_CN/security/secure-boot-v2.rst b/docs/zh_CN/security/secure-boot-v2.rst index 26b66061644..f3465f53058 100644 --- a/docs/zh_CN/security/secure-boot-v2.rst +++ b/docs/zh_CN/security/secure-boot-v2.rst @@ -7,7 +7,7 @@ {IDF_TARGET_SBV2_SCHEME:default="RSA-PSS", esp32c2, esp32c61="ECDSA", esp32c6, esp32h2, esp32p4, esp32c5, esp32h21="RSA-PSS 或 ECDSA"} -{IDF_TARGET_SBV2_KEY:default="RSA-3072", esp32c2, esp32c61="ECDSA-256 或 ECDSA-192", esp32c6, esp32h2, esp32p4, esp32h21="RSA-3072、ECDSA-256 或 ECDSA-192", esp32c5="RSA-3072、ECDSA-384、ECDSA-256 或 ECDSA-192"} +{IDF_TARGET_SBV2_KEY:default="RSA-3072", esp32c2, esp32c61="ECDSA-256", esp32c6, esp32h2, esp32p4, esp32h21="RSA-3072、ECDSA-256", esp32c5="RSA-3072、ECDSA-384、ECDSA-256"} {IDF_TARGET_SECURE_BOOT_OPTION_TEXT:default="", esp32c6, esp32h2, esp32p4, esp32h21="推荐使用 RSA,其验证时间更短。可以在菜单中选择 RSA 或 ECDSA 方案。", esp32c5="推荐使用 ECDSA,其验证时间更短。可以在菜单中选择 RSA 或 ECDSA 方案。"} @@ -75,9 +75,7 @@ 2. 二级引导加载程序加载特定应用程序镜像,并验证应用程序的 {IDF_TARGET_SBV2_SCHEME} 签名。若验证通过,则执行应用程序镜像。 -.. only:: SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED - 默认情况下,{IDF_TARGET_NAME} 禁用 ECDSA-P192 曲线。如果提供的安全启动签名密钥使用的是 ECDSA-P192 曲线,为配置安全启动,系统将尝试启用 ECDSA-P192 曲线模式。然而,如果该曲线模式已被锁定,则无法启用 ECDSA-P192。在这种情况下,无法使用 ECDSA-P192 密钥配置安全启动。用户必须改为提供基于 ECDSA-P256 曲线或基于 RSA 的签名密钥。 优势 ---- @@ -254,7 +252,7 @@ .. only:: SOC_SECURE_BOOT_V2_ECC - .. list-table:: ECDSA-256 / ECDSA-192 签名块的内容 + .. list-table:: ECDSA-256 签名块的内容 :widths: 10 10 40 :header-rows: 1 @@ -275,7 +273,7 @@ - 仅针对镜像内容的 SHA-256 哈希值,不包括签名块。 * - 36 - 1 - - 曲线 ID。1 代表 NIST192p 曲线,2 代表 NIST256p 曲线。 + - 曲线 ID。2 代表 NIST256p 曲线。 * - 37 - 64 - ECDSA 公钥:32 字节的 X 坐标,后跟 32 字节的 Y 坐标。 @@ -530,9 +528,7 @@ Secure Boot v2 签名验证也可以在 OTA 更新期间验证数据分区镜像 - 一旦启用安全启动,就无法再对 eFuse 密钥进行读保护,这可以避免攻击者对存储公共密钥摘要的 eFuse 块进行读保护,进而导致系统无法验证和处理签名,系统服务无法正常运行。有关读保护密钥的更多信息,请参阅下方详细说明。 -.. only:: SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED - 启用安全启动后,ECDSA 曲线模式将锁定为写保护状态。因此,如果启用前未将曲线模式设置为使用 ECDSA-P192 密钥,那么之后将无法再配置或使用 ECDSA_DS 外设中的 ECDSA-P192 曲线。 烧录读保护密钥 ~~~~~~~~~~~~~~ @@ -581,11 +577,11 @@ Secure Boot v2 签名验证也可以在 OTA 更新期间验证数据分区镜像 .. only:: SOC_ECDSA_SUPPORT_CURVE_P384 - 传递 ``--version 2 --scheme ecdsa384``、 ``--version 2 --scheme ecdsa256`` 或 ``--version 2 --scheme ecdsa192`` 选择 ECDSA 方案,生成相应的 ECDSA 私钥。 + 传递 ``--version 2 --scheme ecdsa384`` 或 ``--version 2 --scheme ecdsa256`` 选择 ECDSA 方案,生成相应的 ECDSA 私钥。 .. only:: not SOC_ECDSA_SUPPORT_CURVE_P384 - 传递 ``--version 2 --scheme ecdsa256`` 或 ``--version 2 --scheme ecdsa192`` 选择 ECDSA 方案,生成相应的 ECDSA 私钥。 + 传递 ``--version 2 --scheme ecdsa256`` 选择 ECDSA 方案,生成相应的 ECDSA 私钥。 签名密钥的强度取决于 (a) 系统的随机数源和 (b) 所用算法的正确性。对于生产设备,建议从具有高质量熵源的系统生成签名密钥,并使用最佳的可用 {IDF_TARGET_SBV2_SCHEME} 密钥生成工具。 @@ -601,12 +597,6 @@ Secure Boot v2 签名验证也可以在 OTA 更新期间验证数据分区镜像 .. only:: SOC_SECURE_BOOT_V2_ECC - 生成 ECC NIST192p 曲线密钥 - - .. code-block:: - - openssl ecparam -name prime192v1 -genkey -noout -out my_secure_boot_signing_key.pem - 生成 ECC NIST256p 曲线密钥 .. code-block:: @@ -728,7 +718,7 @@ Secure Boot v2 签名验证也可以在 OTA 更新期间验证数据分区镜像 .. note:: - 如果 Secure Boot v2 配置为使用 ECDSA P-384 签名方案,则所有用于签名的密钥必须为 ECDSA-P384 密钥。不支持与 P-384 同时使用其他椭圆曲线(例如 P-192 或 P-256)密钥,否则在启动过程中会导致签名验证失败。 + 如果 Secure Boot v2 配置为使用 ECDSA P-384 签名方案,则所有用于签名的密钥必须为 ECDSA-P384 密钥。不支持与 P-384 同时使用其他椭圆曲线(例如 P-256)密钥,否则在启动过程中会导致签名验证失败。 .. _secure-boot-v2-key-revocation: diff --git a/docs/zh_CN/security/security-features-enablement-workflows.rst b/docs/zh_CN/security/security-features-enablement-workflows.rst index 2773fece365..6c45c5aa101 100644 --- a/docs/zh_CN/security/security-features-enablement-workflows.rst +++ b/docs/zh_CN/security/security-features-enablement-workflows.rst @@ -448,13 +448,9 @@ flash 加密指南 espsecure generate-signing-key --version 2 --scheme ecdsa256 secure_boot_signing_key.pem - .. only:: not SOC_ECDSA_SUPPORT_CURVE_P384 - - 将上述命令中的方案更改为 ``ecdsa192``,可生成 ecdsa192 私钥。 - .. only:: SOC_ECDSA_SUPPORT_CURVE_P384 - 将上述命令中的方案更改为 ``ecdsa384`` 或 ``ecdsa192``,可生成 ecdsa384 或 ecdsa192 私钥。 + 将上述命令中的方案更改为 ``ecdsa384``,可生成 ecdsa384 私钥。 .. only:: SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS diff --git a/tools/idf_py_actions/help_custom_targets_skip.py b/tools/idf_py_actions/help_custom_targets_skip.py index b3d25d75bd9..f2cef3f0c71 100644 --- a/tools/idf_py_actions/help_custom_targets_skip.py +++ b/tools/idf_py_actions/help_custom_targets_skip.py @@ -67,9 +67,13 @@ IDF_PY_HELP_SKIP_TARGETS = frozenset( 'mbedcrypto', 'mbedtls', 'mbedx509', - 'p256m', + 'p256-m', 'rebuild_cache', 'tfpsacrypto', + 'extras', + 'platform', + 'pqcp', + 'utilities', } ) diff --git a/tools/idf_py_actions/serial_ext.py b/tools/idf_py_actions/serial_ext.py index 3d8e2c38a13..02b962520a6 100644 --- a/tools/idf_py_actions/serial_ext.py +++ b/tools/idf_py_actions/serial_ext.py @@ -850,7 +850,7 @@ def action_extensions(base_actions: dict, project_path: str) -> dict: 'help': ( 'Generate a private key for signing secure boot images as per the secure boot version.' ' Key file is generated in PEM format, Secure Boot V1 - ECDSA NIST256p private key.' - ' Secure Boot V2 - RSA 3072, ECDSA NIST384p, ECDSA NIST256p, ECDSA NIST192p private key.' + ' Secure Boot V2 - RSA 3072, ECDSA NIST384p, ECDSA NIST256p private key.' ), 'options': [ { @@ -862,7 +862,7 @@ def action_extensions(base_actions: dict, project_path: str) -> dict: { 'names': ['--scheme', '-s'], 'help': ('Scheme of secure boot signing.'), - 'type': click.Choice(['rsa3072', 'ecdsa192', 'ecdsa256', 'ecdsa384']), + 'type': click.Choice(['rsa3072', 'ecdsa256', 'ecdsa384']), }, ], 'arguments': [ diff --git a/tools/test_apps/security/secure_boot/pytest_secure_boot.py b/tools/test_apps/security/secure_boot/pytest_secure_boot.py index 51f8ef1acec..d2c56ad2689 100644 --- a/tools/test_apps/security/secure_boot/pytest_secure_boot.py +++ b/tools/test_apps/security/secure_boot/pytest_secure_boot.py @@ -24,12 +24,10 @@ SIGNATURE_TYPE_RSA = 0 SIGNATURE_TYPE_RSA_3072 = 1 SIGNATURE_TYPE_ECDSA = 10 -SIGNATURE_TYPE_ECDSA_P192 = 11 SIGNATURE_TYPE_ECDSA_P256 = 12 SIGNATURE_TYPE_ECDSA_P384 = 13 SIGNATURE_TYPE_RSA_3072_SIZE = 384 -SIGNATURE_TYPE_ECDSA_P192_SIZE = 64 SIGNATURE_TYPE_ECDSA_P256_SIZE = 64 SIGNATURE_TYPE_ECDSA_P384_SIZE = 96 @@ -52,7 +50,7 @@ SECURE_BOOT_ECDSA_P384_TARGETS = ['esp32c5'] CONFIGS_SECURE_BOOT_ECDSA = list( itertools.chain( - itertools.product(['ecdsa_p192', 'ecdsa_p256'], SECURE_BOOT_ECDSA_TARGETS), + itertools.product(['ecdsa_p256'], SECURE_BOOT_ECDSA_TARGETS), itertools.product(['ecdsa_p384'], SECURE_BOOT_ECDSA_P384_TARGETS), ) ) @@ -98,7 +96,7 @@ def corrupt_sig_block(sig_block, seed=0, corrupt_sig=True, corrupt_crc=False, si if signature_type == SIGNATURE_TYPE_RSA_3072: data = sig_block[:812] new_sig = sig = sig_block[812:1196] - elif signature_type in [SIGNATURE_TYPE_ECDSA_P192, SIGNATURE_TYPE_ECDSA_P256]: + elif signature_type in [SIGNATURE_TYPE_ECDSA_P256]: data = sig_block[:101] new_sig = sig = sig_block[101:165] elif signature_type == SIGNATURE_TYPE_ECDSA_P384: @@ -269,9 +267,7 @@ def get_signature_type_size(dut: Dut, signature_type: int) -> int: if signature_type == SIGNATURE_TYPE_RSA: signature_type_size = SIGNATURE_TYPE_RSA_3072_SIZE elif signature_type == SIGNATURE_TYPE_ECDSA: - if dut.app.sdkconfig.get('CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_192_BITS'): - signature_type_size = SIGNATURE_TYPE_ECDSA_P192_SIZE - elif dut.app.sdkconfig.get('CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS'): + if dut.app.sdkconfig.get('CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS'): signature_type_size = SIGNATURE_TYPE_ECDSA_P256_SIZE elif dut.app.sdkconfig.get('CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_384_BITS'): signature_type_size = SIGNATURE_TYPE_ECDSA_P384_SIZE diff --git a/tools/test_apps/security/secure_boot/sdkconfig.ci.ecdsa_p192 b/tools/test_apps/security/secure_boot/sdkconfig.ci.ecdsa_p192 deleted file mode 100644 index ebcb66d954a..00000000000 --- a/tools/test_apps/security/secure_boot/sdkconfig.ci.ecdsa_p192 +++ /dev/null @@ -1,9 +0,0 @@ - -CONFIG_PARTITION_TABLE_OFFSET=0xD000 - -CONFIG_SECURE_BOOT=y -CONFIG_SECURE_BOOT_V2_ENABLED=y -CONFIG_SECURE_SIGNED_APPS_ECDSA_V2_SCHEME=y -CONFIG_SECURE_BOOT_ECDSA_KEY_LEN_256_BITS=y -CONFIG_SECURE_BOOT_SIGNING_KEY="test_ecdsa_p192_key.pem" -CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES=y diff --git a/tools/test_apps/security/secure_boot/test_ecdsa_p192_key.pem b/tools/test_apps/security/secure_boot/test_ecdsa_p192_key.pem deleted file mode 100644 index 2286950ac85..00000000000 --- a/tools/test_apps/security/secure_boot/test_ecdsa_p192_key.pem +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MF8CAQEEGCqtXL4T69v9OhhrHcI0kQNC0NFkmOQ6DqAKBggqhkjOPQMBAaE0AzIA -BDvdwlHoSE5QQ6JBU0Ovy2LjEEuoXVwpPebH3Z87B1ByYLWPZp8XhXWl7Vj7wFK7 -dw== ------END EC PRIVATE KEY-----