Skip to content

Commit 27f11f8

Browse files
committed
Merge branch 'feat/mbedtls_size_optimization' into 'master'
Fix the increase in build size of mbedtls while upgrading to v3.x See merge request espressif/esp-idf!34179
2 parents e1e3c17 + 4cdfdac commit 27f11f8

File tree

7 files changed

+35
-5
lines changed

7 files changed

+35
-5
lines changed

components/esp_security/test_apps/.build-test-rules.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
components/esp_security/test_apps/crypto_drivers:
44
enable:
55
- if: ((SOC_HMAC_SUPPORTED == 1) or (SOC_DIG_SIGN_SUPPORTED == 1)) or (SOC_KEY_MANAGER_SUPPORTED == 1)
6+
depends_components:
7+
- esp_security

components/hal/.build-test-rules.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
components/hal/test_apps/crypto:
22
depends_components:
33
- efuse
4+
- mbedtls
5+
- esp_security
46

57
components/hal/test_apps/hal_i2c:
68
disable:

components/mbedtls/Kconfig

+11-3
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,14 @@ menu "mbedTLS"
667667
help
668668
Enable MBEDTLS_SHA512_C adds support for SHA-384 and SHA-512.
669669

670+
config MBEDTLS_SHA3_C
671+
bool "Enable the SHA3 cryptographic hash algorithm"
672+
default n
673+
help
674+
Enabling MBEDTLS_SHA3_C adds support for SHA3.
675+
Enabling this configuration option increases the flash footprint
676+
by almost 4KB.
677+
670678
choice MBEDTLS_TLS_MODE
671679
bool "TLS Protocol Role"
672680
default MBEDTLS_TLS_SERVER_AND_CLIENT
@@ -1103,12 +1111,12 @@ menu "mbedTLS"
11031111
config MBEDTLS_ECP_FIXED_POINT_OPTIM
11041112
bool "Enable fixed-point multiplication optimisations"
11051113
depends on MBEDTLS_ECP_C
1106-
default y
1114+
default n
11071115
help
11081116
This configuration option enables optimizations to speedup (about 3 ~ 4 times) the ECP
11091117
fixed point multiplication using pre-computed tables in the flash memory.
1110-
Disabling this configuration option saves flash footprint (about 29KB if all Elliptic Curve selected)
1111-
in the application binary.
1118+
Enabling this configuration option increases the flash footprint
1119+
(about 29KB if all Elliptic Curve selected) in the application binary.
11121120

11131121
# end of Elliptic Curve options
11141122

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

+15
Original file line numberDiff line numberDiff line change
@@ -2560,6 +2560,21 @@
25602560
#undef MBEDTLS_SHA512_C
25612561
#endif
25622562

2563+
/**
2564+
* \def MBEDTLS_SHA3_C
2565+
*
2566+
* Enable the SHA3 cryptographic hash algorithm.
2567+
*
2568+
* Module: library/sha3.c
2569+
*
2570+
* This module adds support for SHA3.
2571+
*/
2572+
#ifdef CONFIG_MBEDTLS_SHA3_C
2573+
#define MBEDTLS_SHA3_C
2574+
#else
2575+
#undef MBEDTLS_SHA3_C
2576+
#endif
2577+
25632578
/**
25642579
* \def MBEDTLS_SSL_CACHE_C
25652580
*

components/mbedtls/test_apps/.build-test-rules.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ components/mbedtls/test_apps:
77
- if: CONFIG_NAME == "ecdsa_sign" and SOC_ECDSA_SUPPORTED != 1
88
depends_components:
99
- efuse
10-
depends_filepatterns:
11-
- components/mbedtls/port/ecdsa/*
10+
- mbedtls
11+
- esp_security
12+
- esp_mm

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

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ These include:
194194
- :ref:`CONFIG_MBEDTLS_HAVE_TIME`
195195
- :ref:`CONFIG_MBEDTLS_ECDSA_DETERMINISTIC`
196196
- :ref:`CONFIG_MBEDTLS_SHA512_C`
197+
- :ref:`CONFIG_MBEDTLS_SHA3_C`
197198
- :ref:`CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS`
198199
- :ref:`CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS`
199200
- :ref:`CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION`

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

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ MbedTLS 功能
194194
- :ref:`CONFIG_MBEDTLS_HAVE_TIME`
195195
- :ref:`CONFIG_MBEDTLS_ECDSA_DETERMINISTIC`
196196
- :ref:`CONFIG_MBEDTLS_SHA512_C`
197+
- :ref:`CONFIG_MBEDTLS_SHA3_C`
197198
- :ref:`CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS`
198199
- :ref:`CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS`
199200
- :ref:`CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION`

0 commit comments

Comments
 (0)