This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 0e65af606 mbedtls: Add an option to build ssl_client2 test program
0e65af606 is described below
commit 0e65af606f53f3fa0ba52a86514ef7d23986887a
Author: YAMAMOTO Takashi <[email protected]>
AuthorDate: Tue Aug 26 16:12:42 2025 +0900
mbedtls: Add an option to build ssl_client2 test program
Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
crypto/mbedtls/.gitignore | 1 +
crypto/mbedtls/Kconfig | 25 +++++++++++++++++++++++++
crypto/mbedtls/Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+)
diff --git a/crypto/mbedtls/.gitignore b/crypto/mbedtls/.gitignore
index d96514d8d..247a661f5 100644
--- a/crypto/mbedtls/.gitignore
+++ b/crypto/mbedtls/.gitignore
@@ -1,2 +1,3 @@
/mbedtls
+/mbedtls-framework
/*.zip
diff --git a/crypto/mbedtls/Kconfig b/crypto/mbedtls/Kconfig
index 9870a1b9e..53b043017 100644
--- a/crypto/mbedtls/Kconfig
+++ b/crypto/mbedtls/Kconfig
@@ -788,6 +788,31 @@ config MBEDTLS_APP_SELFTEST_STACKSIZE
endif # MBEDTLS_APP_SELFTEST
+config MBEDTLS_APP_SSL_CLIENT2
+ bool "Mbed TLS ssl_client2 sample program"
+ default n
+ ---help---
+ Enable the Mbed TLS ssl_client2
+
+if MBEDTLS_APP_SSL_CLIENT2
+
+config MBEDTLS_APP_SSL_CLIENT2_PROGNAME
+ string "Program name"
+ default "ssl_client2"
+ ---help---
+ This is the name of the program that will be used when the NSH
ELF
+ program is installed.
+
+config MBEDTLS_APP_SSL_CLIENT2_PRIORITY
+ int "ssl_client2 task priority"
+ default 100
+
+config MBEDTLS_APP_SSL_CLIENT2_STACKSIZE
+ int "ssl_client2 stack size"
+ default MBEDTLS_DEFAULT_TASK_STACKSIZE
+
+endif # MBEDTLS_APP_SSL_CLIENT2
+
endif # MBEDTLS_APPS
endif # CRYPTO_MBEDTLS
diff --git a/crypto/mbedtls/Makefile b/crypto/mbedtls/Makefile
index 3428aa0e9..330384111 100644
--- a/crypto/mbedtls/Makefile
+++ b/crypto/mbedtls/Makefile
@@ -37,6 +37,13 @@ UNPACK ?= unzip -q -o
MBEDTLS_UNPACKLIBDIR = $(MBEDTLS_UNPACKNAME)$(DELIM)library
MBEDTLS_UNPACKPROGDIR = $(MBEDTLS_UNPACKNAME)$(DELIM)programs
+MBEDTLS_FRAMEWORK_URL ?=
"https://github.com/Mbed-TLS/mbedtls-framework/archive"
+
+MBEDTLS_FRAMEWORK_VERSION = df3307f2b4fe512def60886024f7be8fd1523ccd
+MBEDTLS_FRAMEWORK_ZIP = $(MBEDTLS_FRAMEWORK_VERSION).zip
+
+MBEDTLS_FRAMEWORK_UNPACKNAME = mbedtls-framework
+
# This lets Mbed TLS better use some of the POSIX features we have
CFLAGS += ${DEFINE_PREFIX}unix
@@ -64,6 +71,10 @@ $(MBEDTLS_ZIP):
@echo "Downloading: $(MBEDTLS_URL)/$(MBEDTLS_ZIP)"
$(Q) curl -O -L $(MBEDTLS_URL)/$(MBEDTLS_ZIP)
+$(MBEDTLS_FRAMEWORK_ZIP):
+ @echo "Downloading: $(MBEDTLS_FRAMEWORK_URL)/$(MBEDTLS_FRAMEWORK_ZIP)"
+ $(Q) curl -O -L $(MBEDTLS_FRAMEWORK_URL)/$(MBEDTLS_FRAMEWORK_ZIP)
+
$(MBEDTLS_UNPACKNAME): $(MBEDTLS_ZIP)
@echo "Unpacking: $(MBEDTLS_ZIP) -> $(MBEDTLS_UNPACKNAME)"
$(Q) $(UNPACK) $(MBEDTLS_ZIP)
@@ -73,6 +84,11 @@ $(MBEDTLS_UNPACKNAME): $(MBEDTLS_ZIP)
$(Q) patch -p1 -d $(MBEDTLS_UNPACKNAME) <
0003-Fix-MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT-warning.patch
$(Q) touch $(MBEDTLS_UNPACKNAME)
+$(MBEDTLS_FRAMEWORK_UNPACKNAME): $(MBEDTLS_FRAMEWORK_ZIP)
+ @echo "Unpacking: $(MBEDTLS_ZIP) -> $(MBEDTLS_FRAMEWORK_UNPACKNAME)"
+ $(Q) $(UNPACK) $(MBEDTLS_FRAMEWORK_ZIP)
+ $(Q) mv mbedtls-framework-$(MBEDTLS_FRAMEWORK_VERSION)
$(MBEDTLS_FRAMEWORK_UNPACKNAME)
+
# Download and unpack tarball if no git repo found
ifeq ($(wildcard $(MBEDTLS_UNPACKNAME)/.git),)
context:: $(MBEDTLS_UNPACKNAME)
@@ -106,6 +122,33 @@ STACKSIZE += $(CONFIG_MBEDTLS_APP_SELFTEST_STACKSIZE)
MAINSRC += $(MBEDTLS_UNPACKPROGDIR)/test/selftest.c
endif
+ifeq ($(CONFIG_MBEDTLS_APP_SSL_CLIENT2),y)
+
+PROGNAME += $(CONFIG_MBEDTLS_APP_SSL_CLIENT2_PROGNAME)
+PRIORITY += $(CONFIG_MBEDTLS_APP_SSL_CLIENT2_PRIORITY)
+STACKSIZE += $(CONFIG_MBEDTLS_APP_SSL_CLIENT2_STACKSIZE)
+
+MAINSRC += $(MBEDTLS_UNPACKPROGDIR)/ssl/ssl_client2.c
+CSRCS += $(MBEDTLS_UNPACKPROGDIR)/ssl/ssl_test_lib.c
+CSRCS += $(MBEDTLS_UNPACKPROGDIR)/test/query_config.c
+CSRCS += $(MBEDTLS_UNPACKNAME)/tests/src/certs.c
+CSRCS += $(MBEDTLS_FRAMEWORK_UNPACKNAME)/tests/src/helpers.c
+CSRCS += $(MBEDTLS_FRAMEWORK_UNPACKNAME)/tests/src/psa_crypto_helpers.c
+CFLAGS += ${INCDIR_PREFIX}$(MBEDTLS_UNPACKLIBDIR)
+CFLAGS += ${INCDIR_PREFIX}$(MBEDTLS_UNPACKNAME)/tests/include
+CFLAGS += ${INCDIR_PREFIX}$(MBEDTLS_FRAMEWORK_UNPACKNAME)/tests/include
+CFLAGS += ${INCDIR_PREFIX}$(MBEDTLS_FRAMEWORK_UNPACKNAME)/tests/programs
+endif
+
+# Download and unpack tarball if no git repo found
+ifeq ($(wildcard $(MBEDTLS_FRAMEWORK_UNPACKNAME)/.git),)
+context:: $(MBEDTLS_FRAMEWORK_UNPACKNAME)
+
+distclean::
+ $(call DELDIR, $(MBEDTLS_FRAMEWORK_UNPACKNAME))
+ $(call DELFILE, $(MBEDTLS_FRAMEWORK_ZIP))
+endif
+
endif
# Configuration alternative implementation