Skip to content

Commit

Permalink
Merge branch 'feature/support_mbedtls_ecp_fixed_point_configurable' i…
Browse files Browse the repository at this point in the history
…nto 'master'

feat(mbedtls): support ecp fixed-point multiplication configurable

See merge request espressif/esp-idf!25152
  • Loading branch information
esp-jiangguangming committed Aug 8, 2023
2 parents 2bc2a35 + b73d35d commit eaca331
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
10 changes: 10 additions & 0 deletions components/mbedtls/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,16 @@ menu "mbedTLS"

Disabling this option saves some code size.

config MBEDTLS_ECP_FIXED_POINT_OPTIM
bool "Enable fixed-point multiplication optimisations"
depends on MBEDTLS_ECP_C
default y
help
This configuration option enables optimizations to speedup (about 3 ~ 4 times) the ECP
fixed point multiplication using pre-computed tables in the flash memory.
Disabling this configuration option saves flash footprint (about 29KB if all Elliptic Curve selected)
in the application binary.

# end of Elliptic Curve options

config MBEDTLS_POLY1305_C
Expand Down
13 changes: 13 additions & 0 deletions components/mbedtls/port/include/mbedtls/esp_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,19 @@
#undef MBEDTLS_ECP_NIST_OPTIM
#endif

/**
* \def MBEDTLS_ECP_FIXED_POINT_OPTIM
*
* Enable speed up fixed-point multiplication.
*
* Comment this macro to disable FIXED POINT curves optimisation.
*/
#ifdef CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM
#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
#else
#define MBEDTLS_ECP_FIXED_POINT_OPTIM 0
#endif

/**
* \def MBEDTLS_ECDSA_DETERMINISTIC
*
Expand Down
2 changes: 2 additions & 0 deletions docs/en/api-guides/performance/size.rst
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ These include:
- :ref:`CONFIG_MBEDTLS_CCM_C`
- :ref:`CONFIG_MBEDTLS_GCM_C`
- :ref:`CONFIG_MBEDTLS_ECP_C` (Alternatively: Leave this option enabled but disable some of the elliptic curves listed in the sub-menu.)
- :ref:`CONFIG_MBEDTLS_ECP_NIST_OPTIM`
- :ref:`CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM`
- Change :ref:`CONFIG_MBEDTLS_TLS_MODE` if both server & client functionalities are not needed
- Consider disabling some cipher suites listed in the ``TLS Key Exchange Methods`` sub-menu (i.e. :ref:`CONFIG_MBEDTLS_KEY_EXCHANGE_RSA`)

Expand Down
4 changes: 3 additions & 1 deletion docs/zh_CN/api-guides/performance/size.rst
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ ESP-IDF 的 I/O 函数( ``printf()`` 和 ``scanf()`` 等)默认使用 Newlib

.. _minimizing_binary_mbedtls:

mbedTLS 功能
MbedTLS 功能
@@@@@@@@@@@@@@@@@@@@@

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

Expand Down

0 comments on commit eaca331

Please sign in to comment.