Skip to content

Commit 5888428

Browse files
tejlmandgalak
authored andcommitted
mbedtls: kconfig: created MBEDTLS_PROMPTLESS and CUSTOM_MBEDTLS_CFG_FILE
Introducing MBEDTLS_PROMPTLESS and CUSTOM_MBEDTLS_CFG_FILE settings. The MBEDTLS_PROMPTLESS can be set to true whenever configuration of mbedTLS is done from a subsystem or module. Such an example is OpenThread, which selects mbedTLS for some predefined crypto settings using OPENTHREAD_MBEDTLS=y. Unfortunately, extensive use of select can easily cause stuck symbol syndrome making it harder than neccesarry for users to later reconfigure as they easily get stuck in incompatible configurations. Providing a MBEDTLS_PROMPTLESS allows such configurations to disable the MBEDTLS prompt itself when selected but avoid stuck symbol if user select another security configuration. Similar with CUSTOM_MBEDTLS_CFG_FILE which ensures that user must explicitly select this symbol before providing a custom mbedTLS config file. Today, other parts the Kconfig tree may set a default value for MBEDTLS_CFG_FILE but that value is stuck and thus changed Kconfig selections elsewhere in the tree will not adjust the value. Introducing CUSTOM_MBEDTLS_CFG_FILE ensures it is known when the user has provided the value. Signed-off-by: Torsten Rasmussen <[email protected]> Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent c509710 commit 5888428

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

modules/mbedtls/Kconfig

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@
55

66
config ZEPHYR_MBEDTLS_MODULE
77
bool
8+
config MBEDTLS_PROMPTLESS
9+
bool
10+
help
11+
Symbol to disable the prompt for MBEDTLS selection.
12+
This symbol may be used internally in a Kconfig tree to hide the
13+
mbed TLS menu prompt and instead handle the selection of MBEDTLS from
14+
dependent sub-configurations and thus preven stuck symbol behavior.
15+
816

917
menuconfig MBEDTLS
10-
bool "mbedTLS Support"
18+
bool "mbed TLS Support" if !MBEDTLS_PROMPTLESS
1119
help
1220
This option enables the mbedTLS cryptography library.
1321

@@ -32,8 +40,15 @@ config MBEDTLS_LIBRARY
3240

3341
endchoice
3442

43+
config CUSTOM_MBEDTLS_CFG_FILE
44+
bool "Custom mbed TLS configuration file"
45+
help
46+
Allow user defined input for the MBEDTLS_CFG_FILE setting.
47+
You can specify the actual configuration file using the
48+
MBEDTLS_CFG_FILE setting.
49+
3550
config MBEDTLS_CFG_FILE
36-
string "mbed TLS configuration file"
51+
string "mbed TLS configuration file" if CUSTOM_MBEDTLS_CFG_FILE
3752
depends on MBEDTLS_BUILTIN
3853
default "config-tls-generic.h"
3954
help

samples/drivers/crypto/prj_mtls_shim.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CONFIG_LOG_MODE_MINIMAL=y
33
CONFIG_MBEDTLS=y
44
CONFIG_MBEDTLS_BUILTIN=y
55
CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h"
6+
CONFIG_CUSTOM_MBEDTLS_CFG_FILE=y
67
CONFIG_MBEDTLS_HEAP_SIZE=512
78
CONFIG_MBEDTLS_CIPHER_CCM_ENABLED=y
89
CONFIG_MBEDTLS_CIPHER_GCM_ENABLED=y

0 commit comments

Comments
 (0)