52 Commits

Author SHA1 Message Date
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
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
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
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
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
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
makejian
8c95ab94d3 crypto/mbedtls: Unified configuration with mbedtls default configuration
The configuration of Kconfig used by the nuttx before is not consistent with the mbedtls default configuration. This patch update configuration is consistent with the default configuration.
Signed-off-by: makejian <makejian@xiaomi.com>
2023-10-18 21:18:35 +08:00
Junbo Zheng
3177a9be84 crypto/mbedtls: fix kconfig typo
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2023-10-06 20:49:06 +08:00
makejian
851a4aa904 crypto/mbedtls: load certificate memory optimization
Reducing the use of memory due to multiple network links loading certificates
Signed-off-by: makejian <makejian@xiaomi.com>
2023-09-25 14:49:39 +08:00
makejian
ab7fd12e1d mbedtls: use 'getrandom' to get system entropy
use getrandom to get system entropy and not dependent on config DEVURANDOM
Signed-off-by: makejian <makejian@xiaomi.com>
2023-09-19 00:41:24 +08:00
Daniel Appiagyei
b37e84b05f c++ compatibility: rename usages of reserved c++ keywords 'this' and 'public' 2023-09-16 19:45:52 +08:00
makejian
71276b6181 mbedtls-alt/md5: add md5 alternative implementation
add md5 alternative implementation via /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2023-09-12 10:01:16 +08:00
chao an
7dda7f1dee crypto/mbedtls: fix build break on sha256.c
Build break on Assemble compiler if -fno-omit-frame-pointer and -O3 enabled at same time

{standard input}: Assembler messages:
{standard input}:2560: Error: branch out of range
make[2]: *** [apps/Application.mk:170: mbedtls/library/sha256.o] Error 1

Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-11 16:33:05 +08:00
xuxin19
2432a62ab6 fix cmake code smell issues
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-09-04 23:19:26 +08:00
makejian
53878a53db mbedtls: set most of the functions of mbedtls to be configurable
(1)reduce size and improve compilation efficiency
(2)provide more options for greater flexibility
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-30 20:40:11 +08:00
makejian
11de514217 mbedtls: update Kconfig
update Kconfig for adapting version v3.4.0
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-27 21:44:10 +08:00
makejian
1274aa5c8a mbedtls: mbedtls_selftest depends on MBEDTLS_SSL_DTLS_CONNECTION_ID
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-25 17:02:44 +08:00
xuxin19
a091b91d83 cmake:replace custom_patch_target with PATCH_COMMAND
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-24 17:49:12 +02:00
Andre Heinemans
8757c6934c Added tools for NXP SE05x (secure element) 2023-08-22 10:12:31 +08:00
makejian
18280fdc25 mbedtls-alt: add aes alternative implementation
aes module of mbedtls use alternative implementation via /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-21 16:10:48 +08:00
simbit18
00a093e108 Fix Kconfig style
Replace help => ---help---
Add comments
2023-08-18 20:19:22 +08:00
makejian
c25f5e1955 crypto: fix formatting issues in commit #1932
(1) add 'FAR' in mbedtls_hardware_poll
(2) fix indentation issues in hash testcase
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-17 14:31:41 +08:00
makejian
af3ea2af03 mbedtls: add mbedtls sha256/sha512 alternative implementation
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-11 18:13:11 +08:00
makejian
558450f0ab mbedtls: add hardware entropy source via /dev/random
add hardware entropy from /dev/random
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-11 18:13:11 +08:00
makejian
4e016e2260 mbedtls: add nuttx crypto alternative implementation in mbedtls
(1)add dev_alt to manage /dev/crypto
(2)add sha_alt to alternate sha1 algorithm
(3)use new mbedtls_config.h to admin configs of mbedtls
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-11 18:13:11 +08:00
simbit18
2e98005608 crypto: Fix Kconfig style
Replace help => ---help---
Add comments
2023-08-09 19:24:17 +03:00
xuxin19
c93c0da4b0 cmake:migrate apps CMakeLists for mbedtls
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-03 05:53:05 -07:00
makejian
32aefa44c5 crypto/mbedtls: Bump Mbed TLS to version 3.4.0
Signed-off-by: makejian <makejian@xiaomi.com>
2023-07-30 22:21:52 -07:00
chao an
7cc325ae83 crypto/mbedtls: disable optimize on sim platform
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-23 18:05:26 +08:00
yinshengkai
bd2efd9f51 tools: replace DEFINE to DEFINE_PREFIX
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-11 01:18:32 +08:00
yinshengkai
ee4d8b738f Makefile: replace INCDIR to INCDIR_PREFIX
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-10 02:38:58 +08:00
yinshengkai
2c3c2edcb7 Makefile: Remove INCDIROPT
This option, which resolves to -w when CONFIG_CYGWIN_WINTOOL is
configured, is now appended to INCDIR in tools/Config.mk.

See git commit # 5eae32577e5d5226e5d3027c169eeb369f83f77d in the main
2022-10-25 13:48:16 +08:00
Xiang Xiao
4941182cc6 Make.defs: Change "ifeq ($(XXX),y)" to "ifneq ($(XXX),)
to support the tristate option correctly and unify the usage

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 14:59:08 +02:00
Huang Qi
2e2630e838 Don't download tarballs if a local git repo found
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-28 17:20:47 +08:00
Gustavo Henrique Nihei
8dd39b88c9 crypto/mbedtls: Fix occasional failures during Mbed TLS build
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-13 21:11:12 -06:00