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
Waleed Elmelegy
d2a03cb6b8 Fix mbedtls_pkcs5_pbes test function failure
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 18:01:42 +01:00
Waleed Elmelegy
dffb1e3d66 Improve mbedtls_pkcs5_pbes2_ext changelog description
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 17:57:23 +01:00
Waleed Elmelegy
dcad168acf Improve mbedtls_pkcs5_pbes2_ext function test data
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 17:56:39 +01:00
Waleed Elmelegy
7aeb6e7610 Add changelog entry for new mbedtls_pkcs5_pbe2_ext function
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 17:52:15 +01:00
Waleed Elmelegy
7d8f95b4e2 Improve mbedtls_pkcs5_pbes2_ext function signature comments
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 17:50:53 +01:00
Waleed Elmelegy
d4e57c3623 Fix unused parameters warnings when MBEDTLS_CIPHER_PADDING_PKCS7 is disabled
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 17:50:18 +01:00
Waleed Elmelegy
23ae41626c Fix heap overflow issue in pkcs5_pbes2 testing functions
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 17:47:09 +01:00
Waleed Elmelegy
b66cb65410 Add new mbedtls_pkcs5_pbe2_ext function
Add new mbedtls_pkcs5_pbe2_ext function to replace old
function with possible security issues.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-04 17:46:26 +01:00
Gilles Peskine
894258f03c ssl-opt.sh doesn't actually use OPENSSL_LEGACY: remove unused function
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-04 15:47:37 +02:00
Gilles Peskine
9bb5d495e8 Detect GnuTLS support for TLS-RSA-WITH-NULL-SHA256
TLS-RSA-WITH-NULL-SHA256, like other SHA256-based cipher suites, was first
introduced in TLS 1.2. Mbed TLS accepts it in earlier protocol versions as
well. This is technically a bug, which older versions of GnuTLS also have.
GnuTLS 3.4.7 fixed this bug. Adapt compat.sh to automatically omit
TLS-RSA-WITH-NULL-SHA256 in invalid protocol versions if GnuTLS doesn't
support it. It's already not included in invalid protocol versions in
OpenSSL interoperability testing.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-04 15:47:17 +02:00
Tom Cosgrove
a240fe3c19 Fix code style
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-04 11:29:39 +01:00
Tom Cosgrove
ba3b14dad9 For tests, rename TEST_BUFFERS_EQUAL() to TEST_MEMORY_COMPARE()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-04 11:23:02 +01:00
Tom Cosgrove
cd5a7c76f2 Rename the length argument to TEST_CALLOC() to be the more accurate item_count
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-04 11:20:39 +01:00
Tom Cosgrove
30ceb23f3e For tests, rename TEST_CALLOC_OR_FAIL() to just TEST_CALLOC()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-04 11:20:19 +01:00
Tom Cosgrove
20e27de0bb For tests, rename ASSERT_ALLOC_WEAK() to TEST_CALLOC_OR_SKIP()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-04 11:09:08 +01:00
Tom Cosgrove
1357502bca For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-04 11:05:59 +01:00
Tom Cosgrove
f88ee8b007 For tests, rename ASSERT_COMPARE() to TEST_BUFFERS_EQUAL()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-04 11:04:40 +01:00
Dave Rodgman
9302684155 Merge pull request #8145 from tom-cosgrove-arm/check-mbedtls_platform_zeroize-calls-2.28
Backport 2.28: Check mbedtls_platform_zeroize() calls
2023-09-03 11:22:03 +00:00
Tom Cosgrove
5ffb19741d config-wrapper-zeroize-memset.h should be user-config-zeroize-memset.h and not include mbedtls_config.h
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 14:44:11 +01:00
Tom Cosgrove
95b5d79cbf Move the description of MBEDTLS_TEST_DEFINES_ZEROIZE to before its use
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 14:44:09 +01:00
Tom Cosgrove
7f18f44053 Move zeroize-as-memset into a config file under tests/
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 14:43:48 +01:00
Tom Cosgrove
73285cc075 Define all PSA_xxx macros to 1 rather than have them empty, for consistency
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 13:07:39 +01:00
Tom Cosgrove
5117062bb6 Add a build to all.sh to check mbedtls_platform_zeroize() calls
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 11:24:27 +01:00
Tom Cosgrove
f7829b099d Fix incorrect use of mbedtls_platform_zeroize() in tests
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 11:24:27 +01:00
Tom Cosgrove
43210b56f3 Add the ability to verify mbedtls_platform_zeroize() calls with -Wsizeof-pointer-memaccess
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 11:24:27 +01:00
Paul Elliott
12a2bfc970 Merge pull request #8096 from davidhorstmann-arm/2.28-initialize-struct-get-other-name
[Backport 2.28] Coverity fix: Set `type_id` in `x509_get_other_name()`
2023-08-31 14:10:06 +00:00
Gilles Peskine
4ee11a074f Merge pull request #8132 from davidhorstmann-arm/2.28-fix-unnecessary-include-prefixes
[Backport 2.28] Fix unnecessary header prefix in tests
2023-08-31 07:32:29 +00:00
Gilles Peskine
e6771ed9de Merge pull request #8128 from yanrayw/2.28-7094-collect-compatsh-test-cases
Backport 2.28: check_test_cases.py: support to collect test cases for compat.sh
2023-08-31 07:30:21 +00:00
David Horstmann
1804a15342 Fix unnecessary header prefix in tests
Remove unnecessary "../library" prefix from test suite include. This
aligns the test suite with the development branch

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-30 15:48:30 +01:00
Yanray Wang
930cbeeb5b check_test_cases: add a comment to explain idx in walk_compat_sh
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 18:33:47 +08:00
Yanray Wang
b2cd07ce09 compat: list all test cases properly
When calling `add_xxx_ciphersuites`, we have to set MODE properly.
This commit adjusts order to address this issue in list_test_case
which matches what we do in a normal execution.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 13:44:54 +08:00
Yanray Wang
8aba83bf22 compat.sh: return $? in option --list-test-case to handle error case
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 11:41:37 +08:00
Yanray Wang
67fe2644ae check_test_cases.py: do not redirect stderr to stdout
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 11:41:28 +08:00
Yanray Wang
8844844582 check_test_cases.py: use check_output to capture error and return
This commit includes:
 - use subprocess.check_output to report error and capture return
   value
 - add comment as a reminder for option --list-test-case

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 11:41:18 +08:00
Yanray Wang
9412a46ab6 check_test_cases.py: simplify how to store test case description
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 11:40:53 +08:00
Yanray Wang
f0dbde1bdc compat.sh: uniform TITLE format for --list-test-case and run_client
uniform_title is used to print identical format of $TITLE between
--list-test-case and run_client. In such way, no matter how $TITLE
is developed, --list-test-case will in the same format of test case
description as stored in OUTCOME.CSV.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 11:40:09 +08:00
Yanray Wang
a81131d358 compat.sh: fix uncompatiable name of peers in --list-test-case
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 11:36:19 +08:00
Yanray Wang
7e1c0c7f79 compat.sh: uniform test description
Test case description is printed by different block of code. This
causes code maintenance harder since we need to maintain two parts
of code with same functionality. print_test_title is used to
control test case description in compat.sh

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 11:35:56 +08:00
Yanray Wang
baced97929 check_test_cases.py: support checking test coverage in compat.sh
Test case description in compat.sh is in format of
    [ogm]->[ogm] TLSmode, VERIFY CIPHERSUITE_NAME

This program calls compat.sh to list all potential test case
descriptions then checks test case duplication.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 10:28:21 +08:00
Yanray Wang
dd21fc97ba compat.sh: add --list-test-case
The option --list-test-case lists all potential test cases without
executing them. The test case description is identical with $TITLE
during test case execution.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-30 10:25:21 +08:00
Gilles Peskine
3e325aafbd Merge pull request #8115 from tgonzalezorlandoarm/backport-8074
Backport 2.28: Implement allowlist of test cases that are legitimately not executed
2023-08-29 11:19:39 +00:00
Gilles Peskine
67bf9f6359 compat.sh: add --preserve-logs option
Similar to ssl-opt.sh.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-28 17:36:22 +02:00
Gilles Peskine
549a96120e Remove GNUTLS_LEGACY
It isn't used anywhere.

Keep the command line options of all.sh to avoid breaking any wrapper
scripts that people might have.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-27 21:50:06 +02:00
Gilles Peskine
c67c3b3db6 Reduce adherence on "legacy" OpenSSL and GnuTLS
None of the tests actually need GNUTLS_LEGACY (3.3.8): GNUTLS (3.4.10)
works.

Only single-DES actually needs OPENSSL_LEGACY (1.0.1j). For the rest,
OPENSSL (1.0.2g) works.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-27 21:39:10 +02:00
Gilles Peskine
af2ad3dba7 Minor robustness improvement
Let openssl use any experimental or obsolete cipher that's not in ALL.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-27 21:32:36 +02:00
Gilles Peskine
b1bd9be762 ssl-opt.sh doesn't actually use OPENSSL_LEGACY, so remove it
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-27 21:31:47 +02:00
Gilles Peskine
c10520f45f Merge pull request #8102 from AgathiyanB/backport-iar-warnings-changelog
Add changelog entry for 2.28 IAR warning fixes
2023-08-24 18:02:15 +00:00
Tomás González
1cf437bc57 Correct analyze_outcomes identation
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-08-24 09:27:28 +01:00
Manuel Pégourié-Gonnard
fc8ad2788f SSL programs: improve command-line error reporting
Every now and then, I see of these programs failing with a super-long
usage message that gives no clue as to what went wrong. (Recently it
happened with a test case in ssl-opt.sh with a fairly long command line
that was entirely correct, except some options were not valid in this
config - the test should have been skipped but wasn't due to some other
bug. It took me longer to figure out than it should have, and could have
if the program had simply reported which param was not recognized.)

Also, have an explicit "help" command, separate "help_ciphersuites", and
have default usage message that's not multiple screens long.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-08-23 20:34:31 +02:00
Manuel Pégourié-Gonnard
797cfd8f26 SSL programs: allow invoking without arguments
All options have reasonable default so the programs don't need arguments
to do something useful.

It is widely accepted for programs that can work without arguments need
not insist on the user passing arguments, see 'ls', 'wc', 'sort', 'more'
and any number of POSIX utilities that all work without arguments.

It is also the historical behaviour of those programs, and something
relied one by at least a few team members.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-08-23 20:32:14 +02:00