Skip to content

Commit eaca331

Browse files
Merge branch 'feature/support_mbedtls_ecp_fixed_point_configurable' into 'master'
feat(mbedtls): support ecp fixed-point multiplication configurable See merge request espressif/esp-idf!25152
2 parents 2bc2a35 + b73d35d commit eaca331

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

components/mbedtls/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,16 @@ menu "mbedTLS"
982982

983983
Disabling this option saves some code size.
984984

985+
config MBEDTLS_ECP_FIXED_POINT_OPTIM
986+
bool "Enable fixed-point multiplication optimisations"
987+
depends on MBEDTLS_ECP_C
988+
default y
989+
help
990+
This configuration option enables optimizations to speedup (about 3 ~ 4 times) the ECP
991+
fixed point multiplication using pre-computed tables in the flash memory.
992+
Disabling this configuration option saves flash footprint (about 29KB if all Elliptic Curve selected)
993+
in the application binary.
994+
985995
# end of Elliptic Curve options
986996

987997
config MBEDTLS_POLY1305_C

components/mbedtls/port/include/mbedtls/esp_config.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,19 @@
488488
#undef MBEDTLS_ECP_NIST_OPTIM
489489
#endif
490490

491+
/**
492+
* \def MBEDTLS_ECP_FIXED_POINT_OPTIM
493+
*
494+
* Enable speed up fixed-point multiplication.
495+
*
496+
* Comment this macro to disable FIXED POINT curves optimisation.
497+
*/
498+
#ifdef CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM
499+
#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
500+
#else
501+
#define MBEDTLS_ECP_FIXED_POINT_OPTIM 0
502+
#endif
503+
491504
/**
492505
* \def MBEDTLS_ECDSA_DETERMINISTIC
493506
*

docs/en/api-guides/performance/size.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ These include:
502502
- :ref:`CONFIG_MBEDTLS_CCM_C`
503503
- :ref:`CONFIG_MBEDTLS_GCM_C`
504504
- :ref:`CONFIG_MBEDTLS_ECP_C` (Alternatively: Leave this option enabled but disable some of the elliptic curves listed in the sub-menu.)
505+
- :ref:`CONFIG_MBEDTLS_ECP_NIST_OPTIM`
506+
- :ref:`CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM`
505507
- Change :ref:`CONFIG_MBEDTLS_TLS_MODE` if both server & client functionalities are not needed
506508
- Consider disabling some cipher suites listed in the ``TLS Key Exchange Methods`` sub-menu (i.e. :ref:`CONFIG_MBEDTLS_KEY_EXCHANGE_RSA`)
507509

docs/zh_CN/api-guides/performance/size.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ ESP-IDF 的 I/O 函数( ``printf()`` 和 ``scanf()`` 等)默认使用 Newlib
484484

485485
.. _minimizing_binary_mbedtls:
486486

487-
mbedTLS 功能
487+
MbedTLS 功能
488488
@@@@@@@@@@@@@@@@@@@@@
489489

490490
在 **Component Config** > **mbedTLS** 下有多个默认启用的 mbedTLS 功能,如果不需要,可以禁用相应功能以减小代码大小。
@@ -502,6 +502,8 @@ mbedTLS 功能
502502
- :ref:`CONFIG_MBEDTLS_CCM_C`
503503
- :ref:`CONFIG_MBEDTLS_GCM_C`
504504
- :ref:`CONFIG_MBEDTLS_ECP_C` (或者:启用此选项,但在子菜单中禁用部分椭圆曲线)
505+
- :ref:`CONFIG_MBEDTLS_ECP_NIST_OPTIM`
506+
- :ref:`CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM`
505507
- 如果不需要 mbedTLS 的服务器和客户端功能,可以修改 :ref:`CONFIG_MBEDTLS_TLS_MODE`
506508
- 可以考虑禁用在 ``TLS Key Exchange Methods`` 子菜单中列出的一些密码套件(例如 :ref:`CONFIG_MBEDTLS_KEY_EXCHANGE_RSA`),以减小代码大小。
507509

0 commit comments

Comments
 (0)