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

17518 Commits

Author SHA1 Message Date
Gilles Peskine
e6a60db285 Flush log output after each line
Otherwise the output can be out of order when redirected.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-18 06:13:04 -04:00
Gilles Peskine
f5ea1978d4 New script to exercise compilation options
Unify curves.pl, key-exchanges.pl, depends-pkalgs.pl and
depends-hashes.pl into a single, newly-written script.

For curves, key exchanges and hashes, in addition to testing
all-but-one settings in the group like the old scripts, also run the
tests with a single option in the group.

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-18 06:13:04 -04:00
Andrzej Kurek
e8955e1e53 Fix missing padding dependencies
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-18 06:11:21 -04:00
Andrzej Kurek
8ffd8a672f Fix missing cipher mode dependencies
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-18 05:59:43 -04:00
Manuel Pégourié-Gonnard
e5ae132d87 Merge pull request #6420 from mpg/fix-assert-alloc-usage-228
backport 2.28 - Fix usage of ASSERT_ALLOC()
2022-10-17 12:10:55 +02:00
Dave Rodgman
d3a4f2205b Merge pull request #6414 from daverodgman/update_docs_links_2.28
Update documentation links 2.28
2022-10-14 17:42:50 +01:00
Gilles Peskine
377e7e93ba Documentation typo
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:34:06 +02:00
Gilles Peskine
5d01cc04a0 Don't use parallel jobs for pylint
When pylint runs in parallel, it loses the ability to detect duplicated code
across modules. Duplicated code is usually a bad thing, so give pylint the
opportunity to let us know.

This makes pylint slightly slower, but going from 2 threads to 1 does not
make it anywhere close to twice as slow. On my machine, with Python 3.5,
pylint -j2 takes about 12s while single-threaded pylint takes about 16s
of wall clock time.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:34:06 +02:00
Gilles Peskine
7ff4766115 Unify check_repo_path
We had 4 identical copies of the check_repo_path function. Replace them by a
single copy in the build_tree module where it naturally belongs.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:34:06 +02:00
Gilles Peskine
239765ad3e Use relative imports when importing other modules in the same directory
We were using absolute imports under the assumption that the /scripts
directory is in the path. This worked in normal use because every one of our
Python scripts either were in the /scripts directory, or added the /scripts
directory to the module search path in order to reference mbedtls_dev.
However, this broke things like
```
python3 -m unittest scripts/mbedtls_dev/psa_storage.py
```

Fix this by using relative imports.

Relative imports are only supposed to be used inside a package (Python
doesn't complain, but Pylint does). So make /scripts/mbedtls_dev a proper
package by creating __init__.py.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:34:06 +02:00
Gilles Peskine
ca980c037f Move implementation detail from docstring to comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:34:06 +02:00
Gilles Peskine
f8d031fb18 generate_*_tests.py: chdir to mbedtls root
Do this in 2.28 just like it's done in the development branch, so that
code and command line usage that works on one branch doesn't surprisingly
fail on 2.28.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:33:49 +02:00
Gilles Peskine
4881540b06 generate_*_tests.py: simplify test_suite_directory handling
test_suite_directory can be changed by a command line option in the
development branch but not in 2.28. Align the simplified version here with a
change in the development version
("generate_*_tests.py --directory: fix handling of relative path").

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:33:45 +02:00
Gilles Peskine
bd5147c1c0 Clarify the descriptions of test-case-data-related modules
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:24:30 +02:00
Gilles Peskine
69feebd178 More precise name for test data generation
We have Python code both for test code generation
(tests/scripts/generate_test_code.py) and now for test data generation.
Avoid the ambiguous expression "test generation".

This commit renames the Python module and adjusts all references to it. A
subsequent commit will adjust the documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:24:30 +02:00
Gilles Peskine
40de3d3639 Backport build_tree.py from development
Copy of scripts/mbedtls_dev/build_tree.py from mbedtls-3.2.1,
backported to facilitate future backports of python scripts.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-14 15:24:30 +02:00
Dave Rodgman
4c0a21f6b0 Fix capitalisation
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-14 10:56:18 +01:00
Dave Rodgman
8705290c71 Update SUPPORT.md
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-14 10:56:15 +01:00
Dave Rodgman
ed46f6f06b Update SUPPORT.md
Co-authored-by: Paul Elliott <62069445+paul-elliott-arm@users.noreply.github.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-14 10:56:12 +01:00
Manuel Pégourié-Gonnard
3495ca309b Merge pull request #6415 from mprse/aead_driver_test_2_28_backport
2.28 backport: Enable testing of AEAD drivers with libtestdriver1
2022-10-14 11:11:06 +02:00
Manuel Pégourié-Gonnard
d44d3eaa8d Fix usage of ASSERT_ALLOC()
The second argument is the number of elements of the type the first
argument is pointing to, so we shouldn't be using sizeof there.

This was resulting in overly large allocations.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-10-14 09:39:40 +02:00
Przemek Stekiel
9030a25214 Fix aead driver code (remove redundant brace)
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-13 10:23:58 +02:00
Gilles Peskine
279188f3f3 Merge pull request #6396 from gilles-peskine-arm/platform.h-unconditional-2.28
Backport 2.28: Include platform.h unconditionally
2022-10-13 10:19:25 +02:00
Manuel Pégourié-Gonnard
a129babb83 Merge pull request #6412 from mpg/print-failed-suites-2.28
[backport 2.28] Print the list of failed suites in verbose mode
2022-10-13 09:59:53 +02:00
Przemek Stekiel
65caa16973 Add changelog entry
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-13 08:06:47 +02:00
Przemek Stekiel
0368d36552 Add MBEDTLS_PSA_BUILTIN_AEAD definition
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-13 08:02:53 +02:00
Dave Rodgman
8b53871b47 Improve wording re PSA Crypto API
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-12 17:30:04 +01:00
Dave Rodgman
4e7892e239 Additional updates to docs links
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-12 16:51:38 +01:00
Dave Rodgman
0db0bd135f Update documentation links
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-12 16:29:46 +01:00
Gilles Peskine
207b874b5e Merge pull request #6307 from wernerlewis/bignum_test_script_2.28
[Backport 2.28] Add bignum test case generation script
2022-10-12 17:11:49 +02:00
Przemek Stekiel
9e8556c655 Enable MBEDTLS_POLY1305_C in test drivers build
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-12 13:04:12 +02:00
Przemek Stekiel
b771762102 crypto_config_test_driver_extension.h: add support for ChaCha20 - Poly1305
This is done to have LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 defined in libtestdriver1.

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-12 13:04:12 +02:00
Przemek Stekiel
f886241f86 test_driver_aead.c: add support for LIBTESTDRIVER1 tests
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-12 13:03:55 +02:00
Przemek Stekiel
8b56f23db2 all.sh: add testing of AEAD drivers with libtestdriver1
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-12 13:03:40 +02:00
Gilles Peskine
c2e95fa2b3 Merge pull request #6394 from mprse/enc_types_2_28_backport
Backport 2.28: Test TLS 1.2 builds with each encryption type
2022-10-12 12:45:52 +02:00
Manuel Pégourié-Gonnard
3211bbb428 Print the list of failed suites in verbose mode
In verbose mode, the full output of each failing suite is printed out,
which for some suites runs in the 1000s of lines. If you didn't redirect
output to a file, this is a lot to scroll and can make it hard to
quickly identify which test suites failed.

So, let's print out that information at the end. This is useful
information for starting to figure out what went wrong.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-10-12 11:26:08 +02:00
Manuel Pégourié-Gonnard
8221f84034 Merge pull request #6402 from gilles-peskine-arm/config.py-python-version-2.28
Add a note that config.py must remain compatible with Python 3.4
2022-10-11 12:57:24 +02:00
Gilles Peskine
78c34c2d15 Add a note that config.py must remain compatible with Python 3.4
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-10 22:53:58 +02:00
Janos Follath
f9c91cea19 Merge pull request #6387 from gilles-peskine-arm/bignum-mbedtls_test_read_mpi_core-2.28
Backport 2.28: don't introduce mbedtls_test_read_mpi_core
2022-10-10 15:14:36 +01:00
Przemek Stekiel
0d72141ead Revert "Add MBEDTLS_CIPHER_MODE_AEAD dependency to auth_crypt_tv() test function"
This reverts commit 802353c807.

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-10 15:41:02 +02:00
Przemek Stekiel
fa6094185e Revert: Enable Key Wrapping mode for 128-bit block ciphers
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-10 14:34:09 +02:00
Przemek Stekiel
7aca4e44fe Fix session tickets related build flags in fuzz_server and ssl_server2
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-10 14:14:13 +02:00
Przemek Stekiel
97d5740b7a Fix MBEDTLS_SSL_TICKET_C, MBEDTLS_SSL_SESSION_TICKETS dependencies
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-10 14:08:51 +02:00
Przemek Stekiel
1834a2e985 Reword change log entry
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-10 14:03:16 +02:00
Gilles Peskine
36b33ba42f Restore platform.h inclusion in error.c
This is an automatically generated file. The automatic processing to change
platform.h inclusion made it diverge, so put it back the way it needs to be.
platform.h is getting included once unconditionally from the fixed part of
the template, and once from the automatic enumeration of headers, which is
perfectly fine.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-07 19:49:05 +02:00
Gilles Peskine
9c764bfd72 MBEDTLS_PLATFORM_VSNPRINTF_ALT requires MBEDTLS_PLATFORM_C
mbedtls_vsnprintf replacement works like mbedtls_snprintf replacement, so
copy the requirements for MBEDTLS_PLATFORM_VSNPRINTF_ALT.

(MBEDTLS_PLATFORM_xxx_MACRO shouldn't require MBEDTLS_PLATFORM_C, but that's
a separate preexisting problem which I do not try address at this time.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-07 15:57:59 +02:00
Gilles Peskine
d84ed27935 No need to use MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED in tests
Initializing return status variables to CORRUPTION_DETECTED is a second line
of defense in library code in case there's a code path where we forget to
assign to the variable. This isn't useful in test code. In any case, here,
we might as well define the variable at the point of use.

This fixes a build error in configurations with MBEDTLS_ERROR_C and
MBEDTLS_PSA_CRYPTO_C both disabled, because then mbedtls/error.h isn't
included so MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED isn't defined.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-07 15:53:17 +02:00
Gilles Peskine
0b7229d8c4 Include platform.h unconditionally: fixes undefined mbedtls_setbuf
Now that mbedtls/platform.h is included unconditionally, there are no more
configurations where mbedtls_setbuf was accidentally left out of the manual
definitions when MBEDTLS_PLATFORM_C is disabled. Fixes #6118, #6196.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-07 15:52:58 +02:00
Gilles Peskine
445aa5e1c1 Document the base state of platform abstraction
It's `#define mbedtls_xxx xxx` unless some option to override `mbedtls_xxx`
is enabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-07 15:47:54 +02:00
Gilles Peskine
7705a4614e Include platform.h unconditionally: gcm
gcm.c had a slightly different pattern for the conditional inclusion of
platform.h which didn't fit the general replacement. Simplify it manually.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-07 15:47:39 +02:00