mbedtls: support configuration of PSK maximum length via Kconfig

So far maximum PSK length was configured by mbedTLS as 32 bytes.
Introduce Kconfig option that will configure it instead of relying on
default value from mbedTLS library, so that user can easily adjust that
value to application needs.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This commit is contained in:
Marcin Niestroj 2021-11-08 13:45:28 +01:00 committed by Christopher Friedt
commit c32b524d6d
2 changed files with 18 additions and 0 deletions

View file

@ -73,6 +73,20 @@ config MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
config MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
bool "Enable the RSA-PSK based ciphersuite modes"
config MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED
bool
default y if MBEDTLS_KEY_EXCHANGE_PSK_ENABLED || \
MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED || \
MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED || \
MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
config MBEDTLS_PSK_MAX_LEN
int "Max size of TLS pre-shared keys"
default 32
depends on MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED
help
Max size of TLS pre-shared keys, in bytes.
config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
bool "Enable the RSA-only based ciphersuite modes"
default y if !NET_L2_OPENTHREAD

View file

@ -86,6 +86,10 @@
#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
#endif
#if defined(CONFIG_MBEDTLS_PSK_MAX_LEN)
#define MBEDTLS_PSK_MAX_LEN CONFIG_MBEDTLS_PSK_MAX_LEN
#endif
#if defined(CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
#endif