Commit graph

103 commits

Author SHA1 Message Date
hanzhijian
81accb0832 apps: fix distclean for partial builds and residual .kconfig files
The current distclean implementation has two issues:

1. Application.mk does not remove .kconfig on distclean, so stale
   config fragments from earlier builds can pollute subsequent ones.

2. Several external-library Makefiles (lame, libshvc, libulut) run
   "make -C <subdir> distclean" without checking whether the
   subdirectory exists.  When the library was never downloaded (common
   in CI partial-build environments), distclean fails with "No such
   file or directory".

Fix:

- Application.mk: add $(call DELFILE, .kconfig) to the distclean
  target so that .kconfig is cleaned along with .built, .depend, etc.

- audioutils/lame/Makefile: guard the distclean recipe with
  "if [ -d $(DST_PATH) ]; then ...; fi" and use $(MAKE) instead
  of bare make.

- netutils/libshvc/Makefile, netutils/libulut/Makefile: same
  directory-existence guard for their distclean recipes.

- crypto/wolfssl/Makefile: change "distclean:" to "distclean::"
  (double-colon) so it does not override the distclean:: rule
  inherited from Application.mk.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
2026-07-09 09:25:33 +08:00
aviralgarg05
da143595e1 apps: add missing module metadata for executable tools
Add the missing module metadata for the executable ELF helpers used by the package fixture flow so the generated artifacts describe their target and type consistently.

Also fix the existing embedlog spelling issue that is picked up by the current apps check, keeping this branch clean under CI.

Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-06-22 22:27:07 +08:00
Filipe Cavalcanti
3591378113 crypto/mbedtls: expose include paths as public
Expose include paths as public when using CMake.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-04-10 12:23:37 -03:00
Bartosz Wawrzynek
f09d0b2e09 apps: Fix minor issues for latest toolchains
- crypto/mbedtls: Add -Wno-cpp flag to suppress warnings
- interpreters/quickjs: Add flags to suppress warnings
- lte/alt1250: Fix spelling issues in comments
- system/dd: Add missing includes for modern compilers
- system/zlib: Add -Wno-cpp flag
- testing/cxx: Include missing algorithm header

Signed-off-by: Bartosz <bartol2205@gmail.com>
2026-01-23 10:00:52 +08:00
hujun5
19dcc896d7 sched/tcb: add a reference count to the TCB to prevent it from being deleted.
To replace the large lock with smaller ones and reduce the large locks related to the TCB,
in many scenarios, we only need to ensure that the TCB won't be released
instead of locking, thus reducing the possibility of lock recursion.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 11:06:12 -03:00
makejian
57ced95c07 crypto/openssl-wrapper: align SSL_CTX_new declaration with OpenSSL
Remove the extra rngctx parameter from SSL_CTX_new() to match
the standard OpenSSL API signature:
  SSL_CTX *SSL_CTX_new(const SSL_METHOD *method)

This improves compatibility with code written for OpenSSL.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 19:25:02 +08:00
makejian
690d8bddce crypto/openssl-wrapper: fix SSL error code mapping
Map mbedtls error codes to OpenSSL standard return codes in
SSL_connect/SSL_do_handshake:
- Return 1 on success
- Return 0 on controlled shutdown
- Return -1 on fatal error (was returning mbedtls error codes)

This aligns the return values with OpenSSL specification where
SSL_get_error() should be called to get the actual error reason.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 19:25:02 +08:00
makejian
825007aafb crypto/openssl-wrapper: export SSL_CTX_load_verify_file and SSL_CTX_load_verify_dir
Export SSL_CTX_load_verify_file() and SSL_CTX_load_verify_dir()
interfaces to allow loading CA certificates from file or directory.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 19:25:02 +08:00
makejian
d2902008fe openssl-wrapper: fix code style compliance
Fix coding style issues in OpenSSL/MbedTLS wrapper implementation:
- Align whitespace and indentation
- Fix line formatting
- Ensure consistent code style per NuttX standards

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-19 22:51:14 +08:00
makejian
bafe30898a openssl-wrapper: mapping more error code whitin mbedtls and openssl when ssl error
VELAPLATFO-66562

Change-Id: Ibb1446a7fcae1d2bc09d75052466a6ce084103b8
Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-19 22:51:14 +08:00
makejian
49e2592e34 openssl-mbedtls-wrapper: export SSL_ASSERT* macro
VELAPLATFO-62586

Change-Id: I2ceac930c87196a16ea7ddf5e4130bb991b51025
Signed-off-by: makejian <makejian@xiaomi.com>
(cherry picked from commit d0547662d5006ec0a348d89d3d7e251ef4bb183c)
2026-01-19 22:51:14 +08:00
makejian
94ffd5e9f0 openssl_wrapper_mbedtls: extend openssl interfaces in ssl module for mqtt
VELAPLATFO-62586

Change-Id: I3b56b028e76aee118ed90211c097ac3fe86bc129
Signed-off-by: makejian <makejian@xiaomi.com>
(cherry picked from commit 7a567e98489f64b740044b9ce4066fa8d41af359)
2026-01-19 22:51:14 +08:00
makejian
33d5062ba6 openssl_wrapper_mbedtls: support bio interfaces in openssl
VELAPLATFO-62586

Change-Id: I5d7675c05dc3a52c1cb15a6132b969a19f848248
Signed-off-by: makejian <makejian@xiaomi.com>
(cherry picked from commit 409c86a062a816b56a3a48b1111102d12f24a48f)
2026-01-19 22:51:14 +08:00
makejian
056ba984e8 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>
2026-01-19 14:07:21 +08:00
YAMAMOTO Takashi
0e65af606f mbedtls: Add an option to build ssl_client2 test program
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
2025-08-28 14:57:45 +08:00
Niccolò Maggioni
d8dcc9926e crypto/libsodium: Update libsodium to 1.0.20
Update the libsodium crypto library to the latest 1.0.20 tagged release.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-13 22:10:12 +08:00
makejian
08fdbb03bb mbedtls-alt: aligned alternative implementation return value with mbedtls
mbedtls interfaces overwritten by nuttx crypto driver, change return value of mbedtls interfaces from return value of nuttx crypto driver into starndard return value of mbedtls

Signed-off-by: makejian <makejian@xiaomi.com>
2025-07-30 15:41:50 +08:00
raiden00pl
3764ab041a cmake: remove empty strings from FetchContent
remove empty strings from FetchContent to eliminate cmake build warnings like this:

CMake Warning (dev) at /usr/share/cmake/Modules/FetchContent.cmake:1564 (cmake_parse_arguments):
  The BUILD_COMMAND keyword was followed by an empty string or no value at
  all.  Policy CMP0174 is not set, so cmake_parse_arguments() will unset the
  ARG_BUILD_COMMAND variable rather than setting it to an empty string.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-03-30 14:20:21 +08:00
zhanghongyu
fc142045a4 mbedtls: add MBEDTLS_SSL_COOKIE_C to Kconfig for manual configuration
current defconfig and mbedtls_config.h can not enable the definition
of MBEDTLS_SSL_COOKIE_C.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-03-24 21:49:36 +08:00
simbit18
a0dfd187d8 [Kconfig style] Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
Replace help => ---help---
Remove extra TABs

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-02-25 09:27:14 +01:00
Alin Jerpelea
5b68158154 crypto: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-19 15:25:28 +08:00
YAMAMOTO Takashi
53db7817d9 Remove all references to CONFIG_SCHED_ATEXIT
It has been removed a few years ago.
https://github.com/apache/nuttx/pull/6197
2024-12-18 17:42:24 +08:00
George Poulios
6600a5fd08 MbedTLS: patch warning when DTLS is off
This is to patch upstream MbedTLS issue:
  https://github.com/Mbed-TLS/mbedtls/issues/9425
that triggers a -Werror=undef when MBEDTLS_SSL_PROTO_DTLS
is undefined. There is no other way to silence that warning
and it breaks builds in systems with -Werror. Once the
upstream issue is resolved, this can be reverted.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2024-12-05 13:45:38 +08:00
George Poulios
0b3428942f Update MbedTLS 3.4.0 -> 3.6.2 and set it as default
Even though one could in theory simply set CONFIG_MBEDTLS_VERSION="3.6.2",
this commit is needed for 2 reasons:
  1. The patches need to be updated: 0001 works almost as-is (with fuzz 2)
     but 0002 hunk #4 fails and needed adjustment. Otherwise, the patches
     are identical.
  2. mbedtls_config.h needs to be updated: Following the same approach
     for the Kconfig this commit updates both Kconfig and mbedtls_config.h
     according to the changes:
       mbedtls$ git diff v3.4.0...v3.6.2 -- include/mbedtls/mbedtls_config.h

Minor edits also to crypto/controlse to comply with v3.6.2.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2024-12-01 17:57:21 +08:00
makejian
242b947342 crypto: remove MBEDTLS_CONFIG_FILE
* \def MBEDTLS_CONFIG_FILE
 *
 * If defined, this is a header which will be included instead of
 * `"mbedtls/mbedtls_config.h"`.
no need to specify MBEDTLS_CONFIG_FILE

Signed-off-by: makejian <makejian@xiaomi.com>
2024-11-01 17:02:10 +08:00
makejian
84292d5013 mbedtls: compile warning fix
- apps/crypto/openssl_mbedtls_wrapper/mbedtls/err.c
- apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c

Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
xuxin19
597c701518 cmake:add openssl_mbedtls_wrapper cmake build support
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-27 20:57:11 +08:00
makejian
fbcc320321 openssl_mbedtls_wrapper: Implement SHA1 Interface
Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
makejian
42e0e4c6b2 openssl_mbedtls_wrapper: support X509_new()
Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
cuiziwei
6721ae3555 fix build warning.
CC:  vfs/fs_lseek.c /home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c: In function ‘HMAC_CTX_new’:
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
   57 |       (mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
      |                               ^~~~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:28:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
   27 | #include <mbedtls/hmac_drbg.h>
  +++ |+#include <stdlib.h>
   28 | #include <mbedtls/md.h>
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: warning: incompatible implicit declaration of built-in function ‘malloc’ [-Wbuiltin-declaration-mismatch]
   57 |       (mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
      |                               ^~~~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c: In function ‘HMAC_CTX_free’:
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
  126 |   free(ctx);
      |   ^~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: warning: incompatible implicit declaration of built-in function ‘free’ [-Wbuiltin-declaration-mismatch]
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-27 20:57:11 +08:00
makejian
f7582e34e5 openssl_mbedtls_wrapper: add ssl wrapper from libwebsockets
Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
yanghuatao
f1ace3774f apps/crypto: Add project openssl_mbedtls_wrapper
Add openssl mbedtls wrapper project

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-10-27 20:57:11 +08:00
makejian
6588ce4840 apps/mbedtls: add compilation configuration
1.Supplement cmake to compile POLY1305/RIPEMD160/Bignum algorithms
2.Add blowfish and arc4 algorithm configuration

Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-17 08:54:55 +08:00
makejian
e42de5d36d mbedtls-alt/bignum: add bignum alternative implementation via /dev/mpi
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-30 15:26:42 +08:00
makejian
194269dbb8 mbedtls-alt/poly1305-alt: add poly1305 alternative implementation
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-30 15:26:42 +08:00
makejian
83d3256f91 mbedtls-alt/ripemd160: add ripemd160 alternative implementation
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-30 15:26:42 +08:00
makejian
4fc6e7ca0c mbedtls-alt/aes-alt: Illegal parameter detection for aes related functions
(1)aes-xts sets the key length to only 256 and 512 bits
(2)when the key length of aes-xts is 512 bits, MAX_KEY_SIZE needs to be expanded to 64 bytes.
(3)check invalid input length and mode

Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-30 15:26:42 +08:00
makejian
b05c967ae6 mbedtls-alt/dev-alt: complement cloning capability
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-30 15:26:42 +08:00
makejian
4cc575ebc5 crypto/libsodium: fix libsodium compilation warning
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-29 22:57:49 +02:00
makejian
c6f00c09c9 mbedtls: 'MBEDTLS_X509_CRT_POOL' depends on 'MBEDTLS_THREADING_C'
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-29 22:09:56 +02:00
makejian
54d388bb64 mbedtls/Kconfig: MBEDTLS_DEBUG_C depends on DEBUG_CRYPTO_INFO
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-29 22:09:56 +02:00
makejian
9a1a8d3ca3 mbedtls/psa: provides PSA method for using hardware random driver
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-19 08:36:46 +08:00
makejian
96b220659d apps/mbedtls-alt: support cmac
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-19 08:36:46 +08:00
xuxin19
cfe229c67f cmake:bugfix fix mbedtls missing source and depend issue
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-13 23:16:26 +08:00
xuxin19
d4becc8e46 cmake:bugfix export uORB headers fix compile error
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-13 23:16:26 +08:00
xuxin19
3fe177825a cmake:export tinycrypt headers
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-13 23:16:26 +08:00
zhanghongyu
b883eb5929 mbedtls: fix build error when libcxx is enabled.
if  !defined(unix) && !defined(__unix) && !defined(__unix__) && \
    !defined(__APPLE__) && !defined(_WIN32) && !defined(__QNXNTO__) && \
    !defined(__HAIKU__) && !defined(__midipix__)
error
   "Platform entropy sources only work on Unix and Windows, see MBEDTLS_NO_PLATFORM_ENTROPY in mbedtls_config.h"

nuttx/libs/libxx/libcxx/include/__config
nuttx/libs/libxx/libcxx/include/limits.h:40,
apps/crypto/mbedtls/mbedtls/include/mbedtls/check_config.h:31,
apps/crypto/mbedtls/mbedtls/include/mbedtls/build_info.h:151,
apps/crypto/mbedtls/mbedtls/library/common.h:26,
apps/crypto/mbedtls/mbedtls/library/entropy_poll.c:25

if defined(__NuttX__)
undef __linux__
undef __APPLE__
undef __FreeBSD__
undef __GLIBC__
undef __NetBSD__
undef _WIN32
undef __sun__
undef _AIX
/ For the current use of the __unix__ macro in this library,
/ NuttX is not __unix__.
/ This might need to be revisited in future.
undef __unix__
endif

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:27:59 +08:00
cuiziwei
dcf1a05956 fix build warning to [-Wstringop-overflow=].
mbedtls/library/alignment.h:98:5: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
   98 |     memcpy(p, &x, sizeof(x));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
mbedtls/library/cmac.c: In function 'mbedtls_cipher_cmac_finish':
mbedtls/library/cmac.c:288:19: note: at offset 20 into destination object 'M_last' of size 16
  288 |     unsigned char M_last[MBEDTLS_CIPHER_BLKSIZE_MAX];
      |                   ^~~~~~

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-08-20 15:27:34 +08:00
Andre Heinemans
cecc2e762b controlse: add accesslib for the se05x secure element 2024-04-21 11:20:12 +08:00
xuxin19
38d30f9984 matter cmake:fix matter_generate_args_tmp_file call error
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-03-15 01:26:22 +08:00