1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00
Commit Graph

17518 Commits

Author SHA1 Message Date
Zhangsen Wang
9d5b399b5d rebase with latest 2.28 branch 2022-08-16 03:27:48 +00:00
Werner Lewis
60b50e18fe Add test for ECP group metadata
Test cases added to check curve parameters and information for each
curve supported. Expected parameters are taken from references: SEC 2
for NIST, RFC 5639 for Brainpool, and RFC 7748 for curve25519/curve448.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-15 15:49:18 +01:00
Werner Lewis
938dc19ef2 Add auxiliary ECP comparison function
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-15 12:57:48 +01:00
Dave Rodgman
a77287f8fa Merge pull request #6182 from wernerlewis/ecp_set_zero_2.28
[Backport 2.28] Add tests for mbedtls_ecp_set_zero
2022-08-11 16:43:11 +01:00
Dave Rodgman
3469f7a732 Merge pull request #6187 from daverodgman/backport-iar-fatal-warnings
Backport 2.28: cmake: IAR support option( MBEDTLS_FATAL_WARNINGS)
2022-08-09 13:50:23 +01:00
savent
a37f5c1da3 cmake: IAR support option( MBEDTLS_FATAL_WARNINGS)
IAR toolchain makes some warning, forcing 'warning as error' is not for sure.

Signed-off-by: savent <savent_gate@outlook.com>
2022-08-09 10:54:13 +01:00
Werner Lewis
55a3285faf Add test case for mbedtls_ecp_set_zero
Tests function with various ECP point conditions, covering freshly
initialized, zeroed, non-zero, and freed points.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-08 17:24:24 +01:00
Gilles Peskine
2c08ac7842 Merge pull request #6157 from daverodgman/chacha-psa-defines-backport
backport 2.28: MBEDTLS_POLY1305_C and MBEDTLS_CHACHA20_C are needed when PSA_WANT_ALG_CHACHA20_POLY1305 is defined
2022-08-05 11:03:49 +02:00
Gilles Peskine
da126214ce Merge pull request #6071 from wernerlewis/bignum_test_radix_2.28
[Backport 2.28] Remove radix argument from bignum test functions
2022-08-05 11:01:13 +02:00
Gilles Peskine
f222b8e041 Merge pull request #6161 from daverodgman/backport-cert-symlink
Backport 2.28: x509_crt: handle properly broken links when looking for certificates
2022-08-03 13:05:31 +02:00
Gilles Peskine
ddc3845782 Merge pull request #6168 from mman/mbedtls-2.28
Use double quotes to include private header file psa_crypto_cipher.h
2022-08-03 13:05:00 +02:00
Martin Man
43dedd8afe Use double quotes to include private header file psa_crypto_cipher.h
Signed-off-by: Martin Man <mman@martinman.net>
Co-authored-by: Tom Cosgrove <81633263+tom-cosgrove-arm@users.noreply.github.com>
2022-08-02 13:36:18 +02:00
Zhangsen Wang
1c981f5c84 skip test with openssl client because it will timeout with certain seed due to an openssl bug
Signed-off-by: Zhangsen Wang <zhangsen.wang@arm.com>
2022-08-02 06:18:40 +00:00
Werner Lewis
df336842a9 Use upper case for bignum string comparison
Test data which is compared as a hex string now uses upper case to
match output of mbedtls_mpi_write_string() output. This removes usage
of strcasecmp().

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-01 15:57:06 +01:00
Werner Lewis
d487776a61 Remove radix from added test cases
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-01 15:57:06 +01:00
Werner Lewis
3d52e445cc Fix formatting in bignum test functions
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-01 15:57:06 +01:00
Werner Lewis
3e005f3efc Remove remaining bignum radix args
Functions which are not covered by script, changes made to use radix
16.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-01 15:57:06 +01:00
Werner Lewis
955a0bb18f Remove radix arg from bignum tests
Cases where radix was explictly declared are removed in most cases,
replaced using script. bignum arguments are represented as hexadecimal
strings. This reduces clutter in test data and makes bit patterns
clearer.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-01 15:57:06 +01:00
Werner Lewis
24b6078306 Remove radix arg from mbedtls_test_read_mpi
All uses have radix argument removed, using script.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-01 15:57:02 +01:00
Bence Szépkúti
454fdc2501 Merge pull request #6160 from tom-cosgrove-arm/fix-typos-in-md-files-2.28
Backport 2.28: Fix typographical errors in .md files found by cspell
2022-08-01 10:06:31 +02:00
Dave Rodgman
62067bc82f Merge pull request #6156 from daverodgman/microblaze-littleendian-backport-2.28
Microblaze littleendian backport 2.28
2022-07-29 17:08:16 +01:00
Dave Rodgman
6f227ee8e8 Remove use of lstat
lstat is not available on some platforms (e.g. Ubuntu 16.04). In this
particular case stat is sufficient.

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-29 14:27:52 +01:00
Dave Rodgman
626b37859c Add Changelog entry
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-29 14:27:52 +01:00
Dave Rodgman
2958bb3761 Spelling and grammar improvements
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-29 14:27:52 +01:00
Dave Rodgman
168bcd684b Don't increase failure count for dangling symlinks
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-29 14:27:52 +01:00
Eduardo Silva
32ffb2b8bc x509_crt: handle properly broken links when looking for certificates
On non-windows environments, when loading certificates from a given
path through mbedtls_x509_crt_parse_path() function, if a symbolic
link is found and is broken (meaning the target file don't exists),
the function is returning MBEDTLS_ERR_X509_FILE_IO_ERROR which is
not honoring the default behavior of just skip the bad certificate file
and increase the counter of wrong files.

The problem have been raised many times in our open source project
called Fluent Bit which depends on MbedTLS:

https://github.com/fluent/fluent-bit/issues/843#issuecomment-486388209

The expected behavior is that if a simple certificate cannot be processed,
it should just be skipped.

This patch implements a workaround with lstat(2) and stat(2) to determinate
first if the entry found in the directory is a symbolic link or not, if is
a simbolic link, do a proper stat(2) for the target file, otherwise process
normally. Upon find a broken symbolic link it will increase the counter of
not processed certificates.

Signed-off-by: Eduardo Silva <eduardo@treaure-data.com>
2022-07-29 14:27:50 +01:00
Tom Cosgrove
c71bc7b7d3 Fix typographical errors in .md files found by cspell
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-07-29 13:54:52 +01:00
Dave Rodgman
8934db7b8e Merge pull request #6143 from tom-cosgrove-arm/fix-comments-in-docs-and-comments-2.28
Backport 2.28: Fix a/an typos in doxygen and other comments
2022-07-29 12:59:14 +01:00
Summer Qin
aba50444d3 Add MBEDTLS_POLY1305_C and MBEDTLS_CHACHA20_C
MBEDTLS_POLY1305_C and MBEDTLS_CHACHA20_C are needed
when PSA_WANT_ALG_CHACHA20_POLY1305 is defined

Signed-off-by: Summer Qin <summer.qin@arm.com>
2022-07-29 11:46:20 +01:00
Dave Rodgman
7d4a8da1b7 Add Changelog entry
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-29 11:34:26 +01:00
Kazuyuki Kimura
90b99bf964 fix issue #2020
Fixed a bug that the little-endian Microblaze does not work when MBEDTLS_HAVE_ASM is defined.

Signed-off-by: Kazuyuki Kimura <kim@wing.ocn.ne.jp>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-29 11:33:57 +01:00
Tom Cosgrove
5205c976da Fix a/an typos in doxygen and other comments
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-07-28 06:12:08 +01:00
Dave Rodgman
5048045f25 Merge pull request #6096 from tom-cosgrove-arm/bn_mul-fix-x86-pic-compilation-for-gcc-4-2.28
Backport 2.28: bn_mul.h: fix x86 PIC inline ASM compilation with GCC < 5
2022-07-21 17:34:52 +01:00
Dave Rodgman
59dca4b136 Merge pull request #6110 from daverodgman/add-missing-break-2.28
Add missing break - backport 2.28
2022-07-21 15:25:49 +01:00
Tuvshinzaya Erdenekhuu
e63492aeea Add missing break
In ''int execute_tests( int argc , const char ** argv )'' function,
switch case is missing break statement.

Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com>
2022-07-20 15:18:55 +01:00
Tom Cosgrove
accd50d4cd Add a ChangeLog entry
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-07-19 09:02:47 +01:00
Peter Korsgaard
9d9d45c6b2 bn_mul.h: fix x86 PIC inline ASM compilation with GCC < 5
Fixes #1910

With ebx added to the MULADDC_STOP clobber list to fix #1550, the inline
assembly fails to build with GCC < 5 in PIC mode with the following error:

include/mbedtls/bn_mul.h:46:13: error: PIC register clobbered by ‘ebx’ in ‘asm’

This is because older GCC versions treated the x86 ebx register (which is
used for the GOT) as a fixed reserved register when building as PIC.

This is fixed by an improved register allocator in GCC 5+.  From the release
notes:

Register allocation improvements: Reuse of the PIC hard register, instead of
using a fixed register, was implemented on x86/x86-64 targets.  This
improves generated PIC code performance as more hard registers can be used.

https://www.gnu.org/software/gcc/gcc-5/changes.html

As a workaround, detect this situation and disable the inline assembly,
similar to the MULADDC_CANNOT_USE_R7 logic.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2022-07-19 09:02:47 +01:00
Dave Rodgman
8bb9e46c7c Merge pull request #6082 from daverodgman/assemble-cl-case-backport2.28
Fix case of Mbed TLS in assemble_changelog.py - backport 2.28
2022-07-12 16:47:56 +01:00
Dave Rodgman
bdbc2ab3f4 Merge pull request #958 from Mbed-TLS/merge-into-2.28
Merge 2.28.1 into 2.28
2022-07-11 20:01:31 +01:00
Dave Rodgman
dd79db1001 Merge pull request #955 from Mbed-TLS/mbedtls-2.28.1rc0-pr
Mbed TLS 2.28.1rc0 pr
v2.28.1 mbedtls-2.28.1
2022-07-11 12:31:37 +01:00
Dave Rodgman
569d602890 Fix case of Mbed TLS in assemble_changelog.py
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-11 11:40:08 +01:00
Dave Rodgman
fe9d08fd12 Bump version
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-11 10:43:55 +01:00
Dave Rodgman
fa827b4b3d Minor tweaks to Changelog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-11 10:43:47 +01:00
Dave Rodgman
6743ec492e Assemble Changelog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-11 10:43:37 +01:00
Dave Rodgman
b51e0c7e56 Add correct .txt extension to Changelog entry
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-07-11 10:43:32 +01:00
Dave Rodgman
df275c4227 Merge remote-tracking branch 'restricted/mbedtls-2.28-restricted' into mbedtls-2.28.1rc0-pr 2022-07-11 10:42:55 +01:00
Paul Elliott
ada62f25a2 Merge pull request #6067 from AndrzejKurek/cid-session-resumption-2-28
[Backport 2.28] Fix DTLS 1.2 session resumption
2022-07-06 15:02:47 +01:00
Andrzej Kurek
135afdca1e Changelog rewording
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-07-06 06:48:48 -04:00
Andrzej Kurek
77473eba5d Clarify the need for calling mbedtls_ssl_derive_keys after extension parsing
Use a more straightforward condition to note that session resumption
is happening.
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-07-06 06:43:22 -04:00
Andrzej Kurek
33b731f637 Improve changelog wording
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-07-06 06:43:18 -04:00