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

5973 Commits

Author SHA1 Message Date
David Horstmann
66ef2a06d5 Revert "Add exemption for make.bat in checks for tabs"
This is no longer needed as make.bat has been removed. We do not support
building the documentation on Windows.

This reverts commit d50daedcca.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:39:13 +01:00
David Horstmann
89bf31d361 Add exemption for make.bat in checks for tabs
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-17 13:59:10 +00:00
Demi Marie Obenour
6b8e8ff079 Fix segfault in mbedtls_oid_get_numeric_string
When passed an empty OID, mbedtls_oid_get_numeric_string would read one
byte from the zero-sized buffer and return an error code that depends on
its value.  This is demonstrated by the test suite changes, which
check that an OID with length zero and an invalid buffer pointer does
not cause Mbed TLS to segfault.

Also check that second and subsequent subidentifiers are terminated, and
add a test case for that.  Furthermore, stop relying on integer division
by 40, use the same loop for both the first and subsequent
subidentifiers, and add additional tests.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-03-16 01:07:35 -04:00
Gilles Peskine
a93b06dd5b Merge pull request #7204 from lpy4105/issue/backport-all_sh-do-not-list-unsupported-cases
Backport 2.28: all.sh: Do not list unsupported cases
2023-03-14 10:34:12 +01:00
Dave Rodgman
39987ebde7 Merge pull request #7172 from daverodgman/fix_UB_in_ssl_read-2.28
Backport 2.28: Fix undefined behavior in ssl_read if buf parameter is NULL
2023-03-13 10:46:24 +00:00
Pengyu Lv
d216c0411d all.sh: add support function for build_armcc
With this change, "--list-components" will not list
"build_armcc" on the system which is not installed
with Arm Compilers.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-03-03 18:23:35 +08:00
Pengyu Lv
a19ce12e47 all.sh: Skip build_mingw correctly
If i686-w64-mingw32-gcc is not installed, then
build_mingw should be unsupported.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-03-03 18:21:14 +08:00
Dave Rodgman
40d79cef35 Merge pull request #7199 from daverodgman/armclang-sha-warning-2.28
Backport 2.28: enable -Werror for armclang
2023-03-03 09:01:50 +00:00
Dave Rodgman
6cda3d3b5b Enable -Werror for armclang
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-02 15:34:42 +00:00
Gilles Peskine
2b810e3a74 Merge pull request #7104 from AndrzejKurek/pymod-2-28
[Backport 2.28] Use config.py as a module in depends.py
2023-03-02 15:38:45 +01:00
Gilles Peskine
440535e694 Merge pull request #7153 from lpy4105/issue/1785/backport-ssl-test-script-fail
Backport 2.28: compat.sh: Skip static ECDH cases if unsupported in openssl
2023-02-28 18:11:42 +01:00
Stephan Koch
6ed143635d Feedback from Arm: guarantee that output_length <= output_size even on error, to reduce the risk that a missing error check
escalates into a buffer overflow in the application code

Signed-off-by: Stephan Koch <koch@oberon.ch>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-28 15:13:35 +00:00
oberon-sk
8a23f49ebc asymmetric_encrypt: check output length only if return code is PSA_SUCCESS.
Signed-off-by: Stephan Koch <koch@oberon.ch>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-28 15:13:35 +00:00
Dave Rodgman
cd09d68eb1 Add tests
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-24 16:02:26 +00:00
Pengyu Lv
ab1fb39d7a Fix typo
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-23 18:27:33 +08:00
Pengyu Lv
fef3ad0a14 Update incorrect comment
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-23 16:41:35 +08:00
Pengyu Lv
02a76a507b compat.sh: skip static ECDH cases if unsupported in openssl
This commit add support to detect if openssl used for testing
supports static ECDH key exchange. Skip the ciphersutes if
openssl doesn't support them.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-23 16:35:33 +08:00
David Horstmann
e8ef6adde0 Correct error code in test_suite_x509parse.data
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 15:01:01 +00:00
David Horstmann
0518d53ba7 Change error codes to more appropriate codes
The more precise error codes are borrowed from the ASN1 module.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 14:44:18 +00:00
David Horstmann
071dd3579c Add testcases for overlong encoding of OIDs
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 14:44:18 +00:00
David Horstmann
c714416d16 Add tests for mbedtls_oid_get_numeric_string()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 14:44:18 +00:00
Andrzej Kurek
b790c935e6 depends.py: remove symbols that are not present in 2.28
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-15 15:19:37 -05:00
Andrzej Kurek
3e7666b95d Improve tests/scripts/depends.py code
As suggested by gilles-peskine-arm.

Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-15 05:43:54 -05:00
Andrzej Kurek
3ebe7d6260 Improve tests/scripts/depends.py code
As suggested by gilles-peskine-arm.

Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-15 05:43:47 -05:00
Andrzej Kurek
2432dc212e depends.py: improve expected argument type
Requested config option can be either boolean or a string.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-15 05:43:34 -05:00
Andrzej Kurek
2e1aeb129d depends.py: merge set/unset config option into one function
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-15 05:43:27 -05:00
Andrzej Kurek
cf39406196 Use config.py as a module in depends.py
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-15 05:42:02 -05:00
Manuel Pégourié-Gonnard
79e0433bf8 Merge pull request #7072 from mpg/cleanup-md-tests-2.28
[Backport] Clean up MD tests
2023-02-13 09:51:33 +01:00
Gilles Peskine
a15b405a46 Merge pull request #7070 from yanrayw/2.28-7008-compatsh-disable-VERIFY-for-PSK
Backport 2.28: compat.sh: remove VERIFY and duplicate test cases for PSK
2023-02-10 15:07:31 +01:00
Gilles Peskine
da829035a2 Merge pull request #7053 from KloolK/typos-backport
[Backport 2.28] Fix typos
2023-02-10 15:07:03 +01:00
Manuel Pégourié-Gonnard
2122f44d9b Use TEST_EQUAL in one more place in test_suite_md
The only remaining occurrences of TEST_ASSERT are now pointer comparison,
to NULL or to a reference md_info. That is, the output of the following
command is empty:

    grep TEST_ASSERT tests/suites/test_suite_md.function |
        egrep -v '= NULL|== md_info|md_info =='

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-09 09:26:23 +01:00
Manuel Pégourié-Gonnard
3c30191c28 Use ASSERT_COMPARE in test_suite_md
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-09 09:26:22 +01:00
Yanray Wang
21daf2930a compat.sh: simplify code of iterating on VERIFY for PSK tests
Since PSK cipher suites do not allow client certificate verification,
PSK test cases should be executed under VERIFY=NO. SUB_VERIFIES is
used to constrain verification option for PSK tests.

With aforementioned change, the latter check of
$VERIFY=YES && $TYPE!=PSK is redundant so it's removed.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-02-09 12:30:03 +08:00
Yanray Wang
8332db92bd compat.sh: remove G_CLIENT_PRIO as it's not used
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-02-09 12:15:04 +08:00
Yanray Wang
34ddcc9691 compat.sh: display "no" even if $VERIFY=YES for PSK test cases
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-02-09 12:15:04 +08:00
Yanray Wang
89ac843941 compat.sh: do not filter PSK ciphersuites for GnuTLS if $VERIFY=YES
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-02-09 12:15:04 +08:00
Yanray Wang
b1ae735f09 compat.sh: remove check_openssl_server_bug
As there is no $VERIFY for PSK test cases,
check_openssl_server_bug is not functional in compat.sh.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-02-09 12:15:04 +08:00
Yanray Wang
571e24b6a5 compat.sh: avoid running duplicate test cases for PSK
With the introduction of PSK_TESTS,
 - Either `compat.sh -V NO` or `compat.sh -V YES` runs the PSK tests
 - `compat.sh` or `compat.sh -V "NO YES"` runs PSK tests only once

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-02-09 12:15:04 +08:00
Yanray Wang
eafa355691 compat.sh: ignore $VERIFY in PSK TYPE
There is no need to provide CA file in PSK. Thus VERIFY is
meaningless for PSK. This change omits the arguments passed to
the client and server for $VERIFY=YES.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-02-09 12:15:04 +08:00
hanno-becker
95f316ac38 X.509: Improve negative testing for SubjectAltName parsing
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-08 08:57:49 -05:00
Gilles Peskine
bfe79030a9 Merge pull request #7021 from lpy4105/issue/backport-do-not-run-x86-tests-on-arm64
Backport 2.28: all.sh: test_m32_xx is not supported on arm64 host
2023-02-07 10:26:16 +01:00
Jan Bruckner
6d47550723 Fix typos
Signed-off-by: Jan Bruckner <jan@janbruckner.de>
2023-02-07 07:27:49 +01:00
Manuel Pégourié-Gonnard
54faadce7a Fix style in test_suite_md.function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:15:56 +01:00
Manuel Pégourié-Gonnard
67565d0f22 Use TEST_EQUAL when applicable in test_suite_md
Backporting note: contextual differences because we don't have
info_from_ctx in 2.28.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:15:29 +01:00
Manuel Pégourié-Gonnard
96108b611a Avoid unnecessary copy in test_suite_md
Also avoids buffer with an arbitrary size while at it.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:13:44 +01:00
Manuel Pégourié-Gonnard
2a5e213f2d Use MBEDTLS_MD_MAX_SIZE in test_suite_md
Not only was the size of 100 arbitrary, it's also not great for testing:
using MBEDTLS_MD_MAX_SIZE will get us an ASan error if it ever is too
small.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:13:44 +01:00
Manuel Pégourié-Gonnard
a876bd2a8a Use MD type not string to in MD test data
For all test that want to use a hash, identify it by its numerical type
rather than a string. The motivation is that when we isolate the
MD-light subset from the larger MD, it won't have support for string
identifiers. Do the change for all tests, not just those that will
exercise functions in MD-light, for the sake of uniformity and because
numerical identifiers just feel better.

Note: mbedtls_md_info_from_string is still tested in md_info().

Note: for 2.28 the motivation of upcoming work on MD-light doesn't
apply, but the change is still backported in order keep the two branches
closer to each other (especially the .function file).

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:12:51 +01:00
Dave Rodgman
b028531a3b Merge pull request #7013 from gilles-peskine-arm/build-without-certs-2.28.2
2.28 only: Fix the build without MBEDTLS_CERTS_C
2023-02-06 11:39:01 +00:00
Gilles Peskine
a4f91485a6 Merge pull request #6983 from aditya-deshpande-arm/backport-check-files-characters
[Backport 2.28] check_files.py: Allow specific Box Drawings characters to be used
2023-02-03 11:46:03 +01:00
Dave Rodgman
ecb44208d1 Address missed instances of sizeof
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 15:34:23 +00:00