From b8892137f5dd89e9d16eec61fd6c99aa20b31b61 Mon Sep 17 00:00:00 2001 From: Li Jingyi Date: Fri, 26 Feb 2021 15:03:08 +0800 Subject: [PATCH] mbedtls: Add CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 for support GMSSL component The configure will be enabled for GMSSL component and disabled as default because of it doesn't provide by IDF project. --- components/mbedtls/CMakeLists.txt | 14 ++++++++++++++ components/mbedtls/Kconfig | 7 +++++++ components/mbedtls/component.mk | 14 ++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index 7ea847fdab..cd4ed428ba 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -71,6 +71,20 @@ get_target_property(src_tls mbedtls SOURCES) list(REMOVE_ITEM src_tls net_sockets.c) set_property(TARGET mbedtls PROPERTY SOURCES ${src_tls}) +if(CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1) +get_target_property(src_tls mbedtls SOURCES) +list(REMOVE_ITEM src_tls ssl_ciphersuites.c ssl_cli.c ssl_tls.c) +set_property(TARGET mbedtls PROPERTY SOURCES ${src_tls}) + +get_target_property(src_crypto mbedcrypto SOURCES) +list(REMOVE_ITEM src_crypto cipher_wrap.c ecdsa.c ecp.c ecp_curves.c oid.c pk_wrap.c) +set_property(TARGET mbedcrypto PROPERTY SOURCES ${src_crypto}) + +get_target_property(src_x509 mbedx509 SOURCES) +list(REMOVE_ITEM src_x509 x509_crt.c) +set_property(TARGET mbedx509 PROPERTY SOURCES ${src_x509}) +endif() + set(mbedtls_targets mbedtls mbedcrypto mbedx509) set(mbedtls_target_sources "${COMPONENT_DIR}/port/mbedtls_debug.c" diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig index 54cfab71cf..bc7430826b 100644 --- a/components/mbedtls/Kconfig +++ b/components/mbedtls/Kconfig @@ -538,6 +538,13 @@ menu "mbedTLS" depends on MBEDTLS_TLS_ENABLED default y + config MBEDTLS_SSL_PROTO_GMTSSL1_1 + bool "Support GM/T SSL 1.1 protocol" + depends on MBEDTLS_TLS_ENABLED + default n + help + Provisions for GM/T SSL 1.1 support + config MBEDTLS_SSL_PROTO_DTLS bool "Support DTLS protocol (all versions)" default n diff --git a/components/mbedtls/component.mk b/components/mbedtls/component.mk index 465fb5c16f..00e3d20bf0 100644 --- a/components/mbedtls/component.mk +++ b/components/mbedtls/component.mk @@ -9,6 +9,20 @@ COMPONENT_SRCDIRS := mbedtls/library port port/$(IDF_TARGET) port/sha port/sha/p COMPONENT_OBJEXCLUDE := mbedtls/library/net_sockets.o +ifdef CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 +COMPONENT_OBJEXCLUDE += \ +mbedtls/library/ssl_ciphersuites.o \ +mbedtls/library/ecp.o \ +mbedtls/library/cipher_wrap.o \ +mbedtls/library/oid.o \ +mbedtls/library/ecp_curves.o \ +mbedtls/library/pk_wrap.o \ +mbedtls/library/ecdsa.o \ +mbedtls/library/x509_crt.o \ +mbedtls/library/ssl_tls.o \ +mbedtls/library/ssl_cli.o +endif + COMPONENT_SUBMODULES += mbedtls