Skip to content

Commit 6c68068

Browse files
tomi-fontFlavio Ceolin
authored andcommitted
modules: mbedtls: remove default-enabling of hash algorithms
Do not enable hash algorithms except SHA-256 by default. This unnecessarily inflates the final code size even if not all the enabled hash algorithms are actually used. SHA-256 is (for now) kept enabled by default because many configurations across the code base assume that there is some hash algorithm available without needing to enable it. Signed-off-by: Tomi Fontanilles <[email protected]>
1 parent 1ae3578 commit 6c68068

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

modules/mbedtls/Kconfig.tls-generic

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,14 @@ config MBEDTLS_HASH_ALL_ENABLED
215215
select MBEDTLS_HASH_SHA512_ENABLED
216216

217217
config MBEDTLS_HASH_SHA256_ENABLED
218-
bool "SHA256 hash"
219-
default y if !NET_L2_OPENTHREAD
218+
bool "SHA224 and SHA256 hashes"
220219

221220
config MBEDTLS_HASH_SHA384_ENABLED
222221
bool "SHA384 hash"
223-
default y if !NET_L2_OPENTHREAD
224222
select MBEDTLS_HASH_SHA512_ENABLED
225223

226224
config MBEDTLS_HASH_SHA512_ENABLED
227225
bool "SHA512 hash"
228-
default y if !NET_L2_OPENTHREAD
229226

230227
comment "Supported cipher modes"
231228

@@ -320,11 +317,9 @@ config MBEDTLS_MAC_MD4_ENABLED
320317

321318
config MBEDTLS_MAC_MD5_ENABLED
322319
bool "MD5 hash algorithm"
323-
default y if !NET_L2_OPENTHREAD
324320

325321
config MBEDTLS_MAC_SHA1_ENABLED
326322
bool "SHA1 hash algorithm"
327-
default y if !NET_L2_OPENTHREAD
328323

329324
config MBEDTLS_MAC_SHA256_ENABLED
330325
bool "SHA-224 and SHA-256 hash algorithms"

modules/mbedtls/configs/config-tls-generic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
#define MBEDTLS_X509_CRT_PARSE_C
395395
#endif
396396

397-
#if defined (CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT) && \
397+
#if defined(CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT) && \
398398
defined(MBEDTLS_X509_CRT_PARSE_C)
399399
#define MBEDTLS_PEM_PARSE_C
400400
#define MBEDTLS_BASE64_C

0 commit comments

Comments
 (0)