Skip to content

Commit

Permalink
Merge branch 'feat/mbedtls_size_optimization_v5.3' into 'release/v5.3'
Browse files Browse the repository at this point in the history
Fix the increase in build size of mbedtls while upgrading to v3.x (v5.3)

See merge request espressif/esp-idf!34252
  • Loading branch information
mahavirj committed Oct 28, 2024
2 parents d926a92 + 18998dd commit 921a8a7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
14 changes: 11 additions & 3 deletions components/mbedtls/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,14 @@ menu "mbedTLS"
help
Enable MBEDTLS_SHA512_C adds support for SHA-384 and SHA-512.

config MBEDTLS_SHA3_C
bool "Enable the SHA3 cryptographic hash algorithm"
default n
help
Enabling MBEDTLS_SHA3_C adds support for SHA3.
Enabling this configuration option increases the flash footprint
by almost 4KB.

choice MBEDTLS_TLS_MODE
bool "TLS Protocol Role"
default MBEDTLS_TLS_SERVER_AND_CLIENT
Expand Down Expand Up @@ -1086,12 +1094,12 @@ menu "mbedTLS"
config MBEDTLS_ECP_FIXED_POINT_OPTIM
bool "Enable fixed-point multiplication optimisations"
depends on MBEDTLS_ECP_C
default y
default n
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.
Enabling this configuration option increases the flash footprint
(about 29KB if all Elliptic Curve selected) in the application binary.

# end of Elliptic Curve options

Expand Down
15 changes: 15 additions & 0 deletions components/mbedtls/port/include/mbedtls/esp_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2531,6 +2531,21 @@
#undef MBEDTLS_SHA512_C
#endif

/**
* \def MBEDTLS_SHA3_C
*
* Enable the SHA3 cryptographic hash algorithm.
*
* Module: library/sha3.c
*
* This module adds support for SHA3.
*/
#ifdef CONFIG_MBEDTLS_SHA3_C
#define MBEDTLS_SHA3_C
#else
#undef MBEDTLS_SHA3_C
#endif

/**
* \def MBEDTLS_SSL_CACHE_C
*
Expand Down
1 change: 1 addition & 0 deletions docs/en/api-guides/performance/size.rst
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ These include:
- :ref:`CONFIG_MBEDTLS_HAVE_TIME`
- :ref:`CONFIG_MBEDTLS_ECDSA_DETERMINISTIC`
- :ref:`CONFIG_MBEDTLS_SHA512_C`
- :ref:`CONFIG_MBEDTLS_SHA3_C`
- :ref:`CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS`
- :ref:`CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS`
- :ref:`CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION`
Expand Down
1 change: 1 addition & 0 deletions docs/zh_CN/api-guides/performance/size.rst
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ MbedTLS 功能
- :ref:`CONFIG_MBEDTLS_HAVE_TIME`
- :ref:`CONFIG_MBEDTLS_ECDSA_DETERMINISTIC`
- :ref:`CONFIG_MBEDTLS_SHA512_C`
- :ref:`CONFIG_MBEDTLS_SHA3_C`
- :ref:`CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS`
- :ref:`CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS`
- :ref:`CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION`
Expand Down

0 comments on commit 921a8a7

Please sign in to comment.