Skip to content

Commit 21dcce2

Browse files
committed
tinycrypto: add unix as compile flags to use dev/random
Add UNIX platform flag to tinycrypto build configuration to enable access to /dev/random for secure random number generation. Signed-off-by: makejian <makejian@xiaomi.com>
1 parent 2b0a4a2 commit 21dcce2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

crypto/tinycrypt/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ if(CONFIG_TINYCRYPT)
6464
# Sources
6565
# ############################################################################
6666

67+
list(APPEND CFLAGS -Dunix)
6768
set(CSRCS
6869
${TINYCRYPT_DIR}/lib/source/utils.c ${TINYCRYPT_DIR}/lib/source/ecc.c
6970
${TINYCRYPT_DIR}/lib/source/ecc_platform_specific.c)
@@ -120,7 +121,7 @@ if(CONFIG_TINYCRYPT)
120121
if(CONFIG_TINYCRYPT_TEST)
121122
list(APPEND CSRCS ${TINYCRYPT_DIR}/tests/test_ecc_utils.c)
122123
list(APPEND INCDIR ${TINYCRYPT_DIR}/tests/include)
123-
set(CFLAGS -Dhex2bin=ltp_hex2bin -DENABLE_TESTS)
124+
list(APPEND CFLAGS -DENABLE_TESTS)
124125

125126
nuttx_add_application(
126127
NAME

crypto/tinycrypt/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ distclean::
4848
$(Q) rm -rf $(TINYCRYPT_UNPACKNAME)
4949
endif
5050

51+
CFLAGS += ${DEFINE_PREFIX}unix
5152
CSRCS += tinycrypt/lib/source/utils.c
5253

5354
ifeq ($(CONFIG_TINYCRYPT_ECC),y)
@@ -105,8 +106,7 @@ endif
105106

106107
ifeq ($(CONFIG_TINYCRYPT_TEST),y)
107108
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/crypto/tinycrypt/tinycrypt/tests/include
108-
CFLAGS +=-Dhex2bin=ltp_hex2bin
109-
CFLAGS +=-DENABLE_TESTS
109+
CFLAGS += -DENABLE_TESTS
110110
CSRCS += tinycrypt/tests/test_ecc_utils.c
111111
PRIORITY = $(CONFIG_TINYCRYPT_TEST_PRIORITY)
112112
STACKSIZE = $(CONFIG_TINYCRYPT_TEST_STACKSIZE)

0 commit comments

Comments
 (0)