1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00
Commit Graph

1642 Commits

Author SHA1 Message Date
9d52c713b2 Merge remote-tracking branch 'restricted/mbedtls-2.28' into mbedtls-2.28-restricted 2024-01-26 10:27:26 +00:00
436b2ef633 Generate poisoning wrappers for AEAD
Modify wrapper generation script to generate poisoning calls and
regenerate wrappers.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-01-24 14:58:05 +00:00
001ae3349d Merge pull request #1143 from davidhorstmann-arm/memory-poisoning-runtime-enable-2.28
[Backport 2.28] Enable and disable memory poisoning at runtime
2024-01-24 14:46:52 +00:00
1b421b1005 Separate memory poisoning tests from generic ASan
Some platforms may support ASan but be C99-only (no C11 support).
These platforms will support ASan metatests but not memory poisoning,
which requires C11 features.

To allow for this, create a separate platform requirement, "poison",
in metatest.c to distinguish generic ASan metatests from ones that
require suppport for memory poisoning.

In practice our platforms support both, so run "poison" tests in
the same all.sh components where we run "asan" ones.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-01-17 15:37:54 +00:00
56fd26cee9 Merge pull request #8640 from bensze01/release_components_2.28
[Backport 2.28] Set OpenSSL/GnuTLS variables when running release components
2024-01-11 15:38:23 +00:00
a980aa0894 Disable PSA wrappers psa_collect_statuses builds
`psa_collect_statuses.py` runs `make RECORD_PSA_STATUS_COVERAGE_LOG=1`,
which builds with `RECORD_PSA_STATUS_COVERAGE_LOG`. In this mode, the build
includes wrappers for PSA functions, which conflict with the newly
introduced wrappers that are enabled whenever `MBEDTLS_TEST_HOOKS` is
enabled. In the future, the collect-statuses mechanism should use the new
generic wrapper mechanism. For the time being, keep the old wrappers and
avoid the new wrappers when doing the collect-statuses build.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-04 21:07:35 +01:00
b3d457ce2f PSA wrappers: don't poison buffers when buffer copying is disabled
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-04 20:33:29 +01:00
7c7b7d5db3 Add review exception warning
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-04 17:28:59 +01:00
c8b22d0713 Generated PSA wrappers: poison/unpoison buffer parameters
For now, only instrument the one function for which buffer copying has been
implemented, namely `psa_cipher_encrypt`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-04 16:58:23 +01:00
b7119c527c Declare the outputs from generate_psa_wrappers.py as generated files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-04 16:47:15 +01:00
17a14f1711 Adapt wrapper generators from 3.5 to 2.28
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-04 16:41:30 +01:00
8519dc9c7e PSA wrapper generator
The new script `tests/scripts/generate_psa_wrappers.py` generates the
implementation of wrapper functions for PSA API functions, as well as a
header that defines macros that redirect calls to the wrapper functions. By
default, the wrapper functions just call the underlying library function.
With `--log`, the wrapper functions log the arguments and return values.

This commit only introduces the new script. Subsequent commits will
integrate the wrappers in the build.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-04 16:38:17 +01:00
ffb18d2012 Merge pull request #8670 from daverodgman/default-compiler-all-2.28
Backport CI perf: Use clang by default in all.sh
2024-01-04 12:58:50 +00:00
e42c23569b Don't use full path for setting CC
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:35:35 +00:00
9d2c67f8e2 Use gcc in test_full_deprecated_warning
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:35:16 +00:00
ce04f24737 Add -O2 to some CFLAGS which were not setting it
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:34:31 +00:00
374b188468 Don't specify gcc unless the test requires it
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:30:57 +00:00
b046b9a96b Enable -O2 in depends.py
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:26:22 +00:00
5b00fb111f Use gcc in test_psa_compliance
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:26:17 +00:00
b0660c22d9 Ensure test_psa_compliance uses gcc
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:26:07 +00:00
e0a2f6d08d Ensure clang is present
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:24:34 +00:00
62be456449 Use clang by default
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-04 10:24:30 +00:00
dda52ae1c6 Add all.sh coponent to test with copying disabled
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-12-20 14:49:41 +00:00
cb89fbdc67 Set OpenSSL/GnuTLS variables in release components
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2023-12-15 21:17:56 +01:00
44043ed127 Document release components in all.sh
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2023-12-15 21:17:56 +01:00
2064c9b595 all.sh: Parse arguments before checking if a test is supported
Support for each test was checked before the command line had been
parsed, causing the support_ functions to ignore arguments that set a
tool's location.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2023-12-15 20:40:18 +01:00
e1c6c4c962 Do not run Valgrind tests in PR jobs
Co-authored-by: Dave Rodgman <dave.rodgman@arm.com>
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2023-12-06 16:47:51 +00:00
b9c70581a0 Merge pull request #8222 from tgonzalezorlandoarm/tg/backport-psa-low-hash-mac-size
Backport 2.28: Start testing the PSA built-in drivers: hashes
2023-11-21 15:39:36 +00:00
d4084fd899 Readability improvement
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-16 15:56:52 +01:00
c41133b90d Add documentation
Explain the goals of metatests, how to write them, and how to read their
output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-16 15:56:52 +01:00
e38eb79e89 Add metatests for mutex usage
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-16 15:56:23 +01:00
ee8af06887 Run metatests in selected components
Run metatests in some components, covering both GCC and Clang, with ASan,
MSan or neither.

Note that this commit does not cover constant-flow testing builds or Valgrind.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-16 15:56:23 +01:00
6effdff76b Script to run all the metatests (with platform filtering)
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-16 15:56:23 +01:00
5fae560b4a Update new license headers
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-11-13 11:45:12 +00:00
ac5fcd4540 Update license
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-08 19:19:18 +01:00
bfc1844eb2 Merge pull request #8480 from yuhaoth/backports/7649/add-command-for-server9-bad-saltlen
Backports for #7649 : add command for server9-bad-saltlen
2023-11-08 19:04:27 +01:00
d6d43ec8a5 Merge pull request #8485 from gilles-peskine-arm/check-files-license-2.28
Backport 2.28: Check copyright statements and SPDX license statements
2023-11-06 17:07:48 +00:00
32ffbfd139 Pacify mypy
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-06 13:25:37 +01:00
1b4f036dd4 Also complain if licenses are mentioned
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-06 13:25:37 +01:00
15db6822a3 Check copyright statements and SPDX license identifier
Enforce a specific copyright statement and a specific SPDX license
identifier where they are present.

Binary files, third-party modules and a few other exceptions are not
checked.

There is currently no check that copyright statements and license
identifiers are present.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-06 13:25:37 +01:00
5136156750 Sort imports
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-06 13:25:37 +01:00
8243ebf6b3 Merge pull request #8477 from paul-elliott-arm/full_no_platform_2_28
[Backport 2.28] Add build preset full_no_platform
2023-11-06 11:35:12 +00:00
0c835dbae3 move script to tests/scripts
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-11-06 10:06:03 +08:00
6805037a45 Add build preset full_no_platform
Add build preset as above, and utilise it in
all.sh:component_test_no_platform.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-11-03 19:24:56 +00:00
7ff7965561 Update headers
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-03 12:04:52 +00:00
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
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
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
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
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