Skip to content

Commit

Permalink
porting libtomcrypt tests cases,update make config.
Browse files Browse the repository at this point in the history
Signed-off-by: zhangchao53 <[email protected]>
  • Loading branch information
zhangchao53 authored and xiaoxiang781216 committed Aug 11, 2023
1 parent 12a2e14 commit d3d704f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
24 changes: 24 additions & 0 deletions crypto/libtomcrypt/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 19 additions & 1 deletion crypto/libtomcrypt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand All @@ -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)
Expand Down

0 comments on commit d3d704f

Please sign in to comment.