This is an automated email from the ASF dual-hosted git repository.

jiuzhudong 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 056ba984e tinycrypto: add unix as compile flags to use dev/random
056ba984e is described below

commit 056ba984e8ee26ceb5ca172b63935eef0f4425f3
Author: makejian <[email protected]>
AuthorDate: Tue Jan 21 22:31:27 2025 +0800

    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 <[email protected]>
---
 crypto/tinycrypt/CMakeLists.txt | 3 ++-
 crypto/tinycrypt/Makefile       | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/crypto/tinycrypt/CMakeLists.txt b/crypto/tinycrypt/CMakeLists.txt
index a44ed6234..c75ae88c6 100644
--- a/crypto/tinycrypt/CMakeLists.txt
+++ b/crypto/tinycrypt/CMakeLists.txt
@@ -64,6 +64,7 @@ if(CONFIG_TINYCRYPT)
   # Sources
   # 
############################################################################
 
+  list(APPEND CFLAGS -Dunix)
   set(CSRCS
       ${TINYCRYPT_DIR}/lib/source/utils.c ${TINYCRYPT_DIR}/lib/source/ecc.c
       ${TINYCRYPT_DIR}/lib/source/ecc_platform_specific.c)
@@ -120,7 +121,7 @@ if(CONFIG_TINYCRYPT)
   if(CONFIG_TINYCRYPT_TEST)
     list(APPEND CSRCS ${TINYCRYPT_DIR}/tests/test_ecc_utils.c)
     list(APPEND INCDIR ${TINYCRYPT_DIR}/tests/include)
-    set(CFLAGS -Dhex2bin=ltp_hex2bin -DENABLE_TESTS)
+    list(APPEND CFLAGS -DENABLE_TESTS)
 
     nuttx_add_application(
       NAME
diff --git a/crypto/tinycrypt/Makefile b/crypto/tinycrypt/Makefile
index 6b3930a91..70cee2435 100644
--- a/crypto/tinycrypt/Makefile
+++ b/crypto/tinycrypt/Makefile
@@ -48,6 +48,7 @@ distclean::
        $(Q) rm -rf $(TINYCRYPT_UNPACKNAME)
 endif
 
+CFLAGS += ${DEFINE_PREFIX}unix
 CSRCS += tinycrypt/lib/source/utils.c
 
 ifeq ($(CONFIG_TINYCRYPT_ECC),y)
@@ -105,8 +106,7 @@ endif
 
 ifeq ($(CONFIG_TINYCRYPT_TEST),y)
        CFLAGS    += 
${INCDIR_PREFIX}$(APPDIR)/crypto/tinycrypt/tinycrypt/tests/include
-       CFLAGS    +=-Dhex2bin=ltp_hex2bin
-       CFLAGS    +=-DENABLE_TESTS
+       CFLAGS    += -DENABLE_TESTS
        CSRCS     += tinycrypt/tests/test_ecc_utils.c
        PRIORITY   = $(CONFIG_TINYCRYPT_TEST_PRIORITY)
        STACKSIZE  = $(CONFIG_TINYCRYPT_TEST_STACKSIZE)

Reply via email to