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 d3d704fdd porting libtomcrypt tests cases,update make config.
d3d704fdd is described below

commit d3d704fddb9b4e5964e5a2e616cc149fbb6a6e3e
Author: zhangchao53 <[email protected]>
AuthorDate: Wed Mar 29 15:49:20 2023 +0800

    porting libtomcrypt tests cases,update make config.
    
    Signed-off-by: zhangchao53 <[email protected]>
---
 crypto/libtomcrypt/Kconfig  | 24 ++++++++++++++++++++++++
 crypto/libtomcrypt/Makefile | 20 +++++++++++++++++++-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/crypto/libtomcrypt/Kconfig b/crypto/libtomcrypt/Kconfig
index ca8fc3f4e..fcf223231 100644
--- a/crypto/libtomcrypt/Kconfig
+++ b/crypto/libtomcrypt/Kconfig
@@ -79,4 +79,28 @@ endif # LIBTOMCRYPT_HASHSUM
 
 endif # LIBTOMCRYPT_DEMOS
 
+menuconfig LIBTOMCRYPT_TEST
+       tristate "Enable LibTomCrypt tests"
+       default n
+       ---help---
+               Enable LibTomCrypt tests.
+
+if LIBTOMCRYPT_TEST
+
+config LIBTOMCRYPT_TEST_PROGNAME
+       string "Program name"
+       default "libtomcrypt_test"
+       ---help---
+               LibTomCrypt test priority program name
+
+config LIBTOMCRYPT_TEST_PRIORITY
+       int "LibTomCrypt test priority"
+       default 100
+
+config LIBTOMCRYPT_TEST_STACKSIZE
+       int "LibTomCrypt test stack size"
+       default DEFAULT_TASK_STACKSIZE
+
+endif # LIBTOMCRYPT_TEST
+
 endif # CRYPTO_LIBTOMCRYPT
diff --git a/crypto/libtomcrypt/Makefile b/crypto/libtomcrypt/Makefile
index 9d9e3f388..6911fe503 100644
--- a/crypto/libtomcrypt/Makefile
+++ b/crypto/libtomcrypt/Makefile
@@ -440,7 +440,8 @@ CSRCS += \
 
 CFLAGS += -DLTC_SOURCE -DLTM_DESC
 CFLAGS += -Wno-deprecated-declarations
-
+CFLAGS += -Dblake2s_init=libtomcrypt_blake2s_init
+CFLAGS += -Dmd5_init=libtomcrypt_md5_init
 #CFLAGS += -Wno-format
 
 ifneq ($(CONFIG_LIBTOMCRYPT_DEMOS),)
@@ -463,6 +464,23 @@ endif
 
 endif
 
+ifneq ($(CONFIG_LIBTOMCRYPT_TEST),)
+${shell mkdir -p $(BOARD_DIR)/resource/libtomcrypt}
+${shell cp libtomcrypt/tests/*.key $(BOARD_DIR)/resource/libtomcrypt}
+${shell cp libtomcrypt/tests/*.der $(BOARD_DIR)/resource/libtomcrypt}
+CFLAGS += -DKEY_DIR=\"/resource/libtomcrypt\"
+CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/crypto/libtomcrypt/libtomcrypt/tests
+CFLAGS += -Dbase64_decode=libtomcrypt_base64_decode
+CFLAGS += -Dbase64_encode=libtomcrypt_encode
+NEWSRC := $(wildcard libtomcrypt/tests/*.c)
+CSRCS += $(filter-out $(LIBTOMCRYPT_UNPACKNAME)/tests/test.c, $(NEWSRC))
+MAINSRC += $(LIBTOMCRYPT_UNPACKNAME)/tests/test.c
+
+PROGNAME += $(CONFIG_LIBTOMCRYPT_TEST_PROGNAME)
+PRIORITY  += $(CONFIG_LIBTOMCRYPT_TEST_PRIORITY)
+STACKSIZE += $(CONFIG_LIBTOMCRYPT_TEST_STACKSIZE)
+endif
+
 $(LIBTOMCRYPT_ZIP):
        @echo "Downloading: $(LIBTOMCRYPT_ZIP)"
        $(Q) curl -O -L $(CONFIG_LIBTOMCRYPT_URL)/$(LIBTOMCRYPT_ZIP)

Reply via email to