1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-05 19:35:48 +03:00
Commit Graph

18895 Commits

Author SHA1 Message Date
Dave Rodgman
287ab6edb2 Update header
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-03 12:58:29 +00:00
Dave Rodgman
625458b990 Update header
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-03 12:57:37 +00:00
Dave Rodgman
0f2971a968 Update headers
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-03 12:54:54 +00:00
Dave Rodgman
1146161e93 Add Changelog for license
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-03 12:06:31 +00:00
Dave Rodgman
bf7805fa17 Update documentation
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-03 12:05:25 +00:00
Dave Rodgman
7ff7965561 Update headers
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-03 12:04:52 +00:00
Dave Rodgman
1df57fcc0e Merge pull request #8196 from tgonzalezorlandoarm/tg/check_test_cases
Backport 2.28: Make check_test_cases.py recognize test case name templates in ssl-opt.sh
2023-11-02 12:22:40 +00:00
Gilles Peskine
9043a2fc0b Fix type annotation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-31 09:32:36 +00:00
Gilles Peskine
e25a619824 Remove dead code
Do explain why we don't test a smaller buffer in addition to testing the
nominal size and a larger buffer.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-31 09:32:36 +00:00
Tomás González
2bff1bfd47 New test suite for the low-level hash interface
Some basic test coverage for now:

* Nominal operation.
* Larger output buffer.
* Clone an operation and use it after the original operation stops.

Generate test data automatically. For the time being, only do that for
hashes that Python supports natively. Supporting all algorithms is future
work.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-31 09:32:35 +00:00
Tomás González
734d22c03e Move PSA information and dependency automation into their own module
This will let us use these features from other modules (yet to be created).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-31 09:31:20 +00:00
Paul Elliott
f29cc32a06 Merge pull request #8390 from gilles-peskine-arm/20231017-misc-cleanup-2.28
Backport 2.28: Cleanups in test code
2023-10-30 18:07:47 +00:00
Tomás González
aaea3a3148 check_test_cases: Unify walk_compat_sh and walk_opt_sh into one
walk_compat_sh and walk_opt_sh are basically the same now, so:

 * Merge them into one function.
 * Use the --list-test-cases option for both of them.
 * Rename this merged function as collect_from_script which seems
   more appropriate as since it isn't iterating the script but
   calling it.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-30 14:23:57 +00:00
Tomás González
cbb2e45e96 ssl-opt: Introduce --list-test-cases option
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-30 14:23:56 +00:00
Bence Szépkúti
3ccb844117 Merge pull request #8373 from sergio-nsk/sergio-nsk/8372/1
Backport 2.28: Fix compiling AESNI in Mbed-TLS with clang on Windows
2023-10-26 15:59:05 +00:00
Gilles Peskine
c8d89a164d Merge pull request #8421 from gilles-peskine-arm/test-datax-chdir-2.28
Backport 2.28: Support running unit tests from another directory
2023-10-26 15:54:50 +00:00
Gilles Peskine
f38e2fe97b Merge pull request #8118 from gilles-peskine-arm/ssl-progs-usage-2.28
Backport 2.28: Fix usage & error reporting in SSL programs
2023-10-25 17:03:23 +00:00
Gilles Peskine
e3d1c76818 Fix invocation with explicit .datax file
Don't chdir when invoking a test suite executable with an explicit .datax
file. The point of the chdir is to automatically find the .datax file (and
the relative location of the data_files directory) in typical cases. This
conflicts with the expectation that passing a relative path to a .datax file
will work.

(This is what I had originally intended, and what is documented in the
comment, but I forgot to add the argc check in the initial commit.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-25 17:47:42 +02:00
Gilles Peskine
290e008925 Define try_chdir everywhere
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-25 17:47:42 +02:00
Gilles Peskine
460cf76ef5 Note about the lack of Windows support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-25 17:47:42 +02:00
Gilles Peskine
994efa2aa0 Print a notice if chdir fails
Fixes -Wunused-result warning.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-25 17:47:42 +02:00
Gilles Peskine
9cc1255e99 Support running unit tests from another directory
When running a test suite, try to change to the directory containing the
executable. This allows running a test suite from any directory, and still
allow it to access its .datax file as well as data files (generally in
tests/data_files) used by individual test cases.

Only implemented on Unix-like systems and on Windows.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-25 17:47:42 +02:00
Dave Rodgman
37b8478ab8 Merge pull request #8403 from daverodgman/iar-fixes-2.28
Backport 2.28: Stop IAR warning about goto skipping variable definition
2023-10-23 14:59:33 +01:00
Tom Cosgrove
c6d562815d Merge pull request #8392 from lpy4105/backport-2.28/issue/support-cpuid-for-win32
Backport 2.28: Support cpuid for win32
2023-10-23 10:43:36 +00:00
Dave Rodgman
2af05c857a Stop IAR warning about goto skipping variable definition
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-10-23 11:04:36 +01:00
Pengyu Lv
e6cbec8ea7 all.sh: build_mingw: test build default config without MBEDTLS_AESNI_C
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-20 09:54:41 +08:00
Gilles Peskine
fa27636396 Close file on error path
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-19 17:24:23 +02:00
Gilles Peskine
bf8520080a Use modern macros for calloc in test code
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-19 17:24:23 +02:00
Dave Rodgman
3ca2f5cd01 Make TEST_CALLOC_NONNULL more robust
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-10-19 17:24:23 +02:00
Gilles Peskine
7e36ad1f5c Merge pull request #7983 from gilles-peskine-arm/sample-program-demos-2.28
Backport 2.28: Run sample program demo scripts in all.sh
2023-10-19 15:11:00 +00:00
Pengyu Lv
b2ca03251d all.sh: build_mingw: test AESNI intrinsics
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-19 17:17:19 +08:00
Pengyu Lv
c5d9d2d67e Reword the changelog entry
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-19 16:52:01 +08:00
Pengyu Lv
f24a85fd5e Add a changelog entry
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-19 16:52:01 +08:00
Pengyu Lv
f3c6e2ee34 aesni: select __cpuid impl based on compiler type
MinGW provides both kinds of implementations of `__cpuid`,
but since `cpuid.h` is provided by GNUC, so we should choose
the implementation by the compiler type instead of OS type.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-19 16:45:37 +08:00
Pengyu Lv
79d7faf030 aesni: declare cpuinfo as int
Change the type of array that stores the cpuinfo
data to int[4] to match the signature of `__cpuinfo`
in `intrin.h` header file.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-19 16:45:37 +08:00
Pengyu Lv
2856e076e6 aesni: support cpuid on WIN32
`__cpuid` has two kinds of signatures in different
headers depending on the target OS. We make it
consistent between the usages ang the included header.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-19 16:45:36 +08:00
Sergey Markelov
9902a6b752 Fix #8372 - Error compiling AESNI in Mbed-TLS with clang on Windows
It can successfully compile w/ or w/o the clang options -maes -mpclmul.

Signed-off-by: Sergey Markelov <sergey@solidstatenetworks.com>
2023-10-18 20:26:01 -07:00
Dave Rodgman
72aa683aae Introduce TEST_CALLOC_NONNULL
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-10-18 18:14:56 +02:00
Gilles Peskine
ce9c4f52c4 Remove redundant null check
crl_file is a test argument and can't be null. Besides the code above
already assumes that it's non-null.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-18 18:13:39 +02:00
valerio
5b5da941a4 test: proper positioning of USE_PSA_INIT + fixed some exit labels
Very partial backport of 32f2ac9a18

Signed-off-by: valerio <valerio.setti@nordicsemi.no>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-18 18:12:39 +02:00
Gilles Peskine
11f41793f8 Fix missing initializations on some error paths
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-18 18:12:36 +02:00
Gilles Peskine
5fdd0bddb4 Convey that it's ok for mbedtls_ssl_session_save to fail
mbedtls_ssl_session_save() always outputs the output length, even on error.
Here, we're only calling it to get the needed output length, so it's ok to
ignore the return value. Convey this to linters.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-18 17:45:25 +02:00
Manuel Pégourié-Gonnard
0ee9dacb4d Merge pull request #8122 from gilles-peskine-arm/ssl-test-no-legacy-2.28
Backport 2.28: Remove GNUTLS_LEGACY and OPENSSL_LEGACY (partly)
2023-10-18 07:13:15 +00:00
Bence Szépkúti
01902779a3 Merge pull request #8162 from yanrayw/2.28-save_stack_usage_pkwrite
Backport 2.28: pkwrite: use heap to save stack usage for writing keys in PEM string
2023-10-13 14:27:18 +00:00
Dave Rodgman
3841af02f5 Merge pull request #8349 from kasjer/kasjer/mbedtls-2.28/aes-rcon-rename
[Backport 2.28] Rename local variable in aes.c
2023-10-12 14:56:07 +00:00
Jerzy Kasenberg
1222ae67d5 Rename local variable in aes.c
This changes local variable name RCON to round_constants.

RCON being definition in xc32 compiler headers for some PIC32 register.
Without this change mynewt project for PIC32 platform fails to build due to
macro redefinition.

This does not changes behavior of library in any way.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-10-12 09:16:34 +02:00
Tom Cosgrove
44af43639c Merge pull request #8333 from yanrayw/2.28_aes_benchmark_cfb
Backport 2.28: Benchmark: add AES_CFB128 and AES_CFB8
2023-10-11 12:59:28 +00:00
Yanray Wang
c55060d42a benchmark: improve code readability
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-10-10 10:49:32 +08:00
Yanray Wang
c96db3bf25 benchmark: add AES_CFB8
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-10-10 10:49:32 +08:00
Yanray Wang
b382c2b0e7 benchmark: add AES_CFB128
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-10-10 10:49:32 +08:00