From e1cec0d941989e4c5fb3a876074e3d56e308c18a Mon Sep 17 00:00:00 2001 From: Ashish Sharma Date: Fri, 28 Mar 2025 15:46:48 +0800 Subject: [PATCH] feat(mbedtls): new config to allow weak cert verification --- components/mbedtls/Kconfig | 7 +++++++ .../mbedtls/port/include/mbedtls/esp_config.h | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig index 88df49340c..c4dceb924d 100644 --- a/components/mbedtls/Kconfig +++ b/components/mbedtls/Kconfig @@ -1215,4 +1215,11 @@ menu "mbedTLS" which is added through vfs component for ESP32 based targets or by the host system when the target is Linux. + config MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION + bool "Allow weak certificate verification" + default n + help + This options allows weak certificate verification by skipping the hostname verification. + It is not recommended to use this option. + endmenu # mbedTLS diff --git a/components/mbedtls/port/include/mbedtls/esp_config.h b/components/mbedtls/port/include/mbedtls/esp_config.h index 3325a9dba0..488c3fbe8b 100644 --- a/components/mbedtls/port/include/mbedtls/esp_config.h +++ b/components/mbedtls/port/include/mbedtls/esp_config.h @@ -2084,6 +2084,21 @@ #undef MBEDTLS_ERROR_C #endif +/** + * \def MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME + * + * Caller: library/ssl_tls.c + * + * Allow weak certificate verification without a hostname. + * This option is not recommended for production use. + */ + +#if CONFIG_MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION +#define MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME +#else +#undef MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME +#endif + /** * \def MBEDTLS_GCM_C *