6354 Commits

Author SHA1 Message Date
Gilles Peskine
366e6859e3 Remove mbedtls_ prefix from bignum test cases
Align 2.28 with development to make backports easier.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 22:51:10 +02:00
Valerio Setti
a4d460c99c test_suite_pkwrite: replace memcpy with memmove
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:47:42 +02:00
Valerio Setti
755582b297 fix typos
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:47:36 +02:00
Valerio Setti
3b608de6f3 fix new line difference in Windows
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:47:31 +02:00
Valerio Setti
f1477da185 test: pkwrite: backport of issue 7446
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-18 16:58:22 +02:00
Gilles Peskine
b76bcfb228
Merge pull request #7332 from yanrayw/2.28_7285-followup-of-PR6500
Backport 2.28: 6500 follow-up: enhancements to the new ssl_helpers test module #7287
2023-04-11 09:31:41 +02:00
Dave Rodgman
2497c6b860 Whitespace fix
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-31 18:05:19 +01:00
Dave Rodgman
3fead76eba Test that setting reset actually does something
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-31 16:43:34 +01:00
Manuel Pégourié-Gonnard
616f23e016
Merge pull request #7338 from yanrayw/2.28-6500-gitignore-fix
Backport 2.28: fix: ignore *.o under tests/src/test_helpers
2023-03-30 23:21:53 +02:00
Yanray Wang
d82879edc6 tests/.gitignore: ignore *.o under tests/src/test_helpers
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-24 18:21:48 +08:00
Dave Rodgman
e4f1aac0fd Bump version to 2.28.3
Command used: ./scripts/bump_version.sh --version 2.28.3

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-23 18:06:54 +00:00
Yanray Wang
74df2012a2 ssl_helpers.c: add mbedtls_test_ssl prefix for *_exchange_data
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 18:02:53 +08:00
Yanray Wang
d02c3175e6 ssl_helpers.c: add mbedtls_test prefix for mbedtls_mock_socket_init
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:58:10 +08:00
Yanray Wang
c4abee2b9c ssl_helpers.c: change prefix and move *queue_peek_info to static
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:57:02 +08:00
Yanray Wang
cd23affffa ssl_helpers.c: change prefix and move *certificate_free to static
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:56:12 +08:00
Yanray Wang
b4ef9a21b5 ssl_helpers.c: move some internal functions to static
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:54:55 +08:00
Yanray Wang
e62e8a1a6f ssl_helpers.c: move #define Directive to header file
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:35:33 +08:00
Paul Elliott
a183e1d53d Merge branch 'mbedtls-2.28-restricted' into mbedtls-2.28.3rc0-pr
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-03-21 15:34:35 +00:00
Paul Elliott
18573354f7
Merge pull request #7276 from yanrayw/2.28-6173-split-TLS-connection-func-into-ssl_helpers
Backport 2.28: Move TLS connection helper code from test_suite_ssl.function to ssl_helpers.c
2023-03-21 10:54:06 +00:00
Tom Cosgrove
b5eb831803 Add tests for unaligned AES contexts
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-20 10:57:42 +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
Yanray Wang
e16808cddc Move #define Directive into ssl_helpers.h
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
d2696f2aa2 Fix issue of conversion from size_t to int
ssl_helpers.c is treated with W3 warning level in MSVC complier.
So that it's reported as error for warning of conversion from
size_t to int. This change fixes all this type of warning seen in
Microsoft Visual Studio 12.0. Besides, some potential problems of
type conversion are also handled.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
89b4d12d4a Fix build error in CI about test_fail_if_psa_leaking
During test of component build_arm_linux_gnueabi_gcc_arm5vte and
build_arm_none_eabi_gcc_m0plus. It fails with
 - error: implicit declaration of function
   ‘test_fail_if_psa_leaking’

It happens because test_fail_if_psa_leaking is defined in
helpers.function. This block of code is not converted into C code
while compiling ssl_helpers.c. The function has been moved to
psa_crypto_helpers.c in order to fix this build error.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
3742b1211d Fix build errors in CMake
tests/src/ssl_helpers.c depends on functions defined
in library/*.c. If it's complied as an OBJECT with other c files,
cmake complains undefined reference in link stage under programs/.
Therefore, tests/src/test_helpers/ is created to hold c files with
dependency of library/*.c. Besides, tests/src/test_helper/*.c is
separated into another OBJECT, mbedtls_test_helpers, as sources
to build all test suite executables.

In addition, everest header directory is included in case
MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED is enabled.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
1ef77c01c4 ssl_helpers.c: remove duplicate comments for some functions
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
4323e459e9 Resolve build errors for ssl_helpers.c and test_suite_ssl.c
Since we move many functions from test_suite_ssl.function to
ssl_helpers.c in commit bd56b03. This causes various of
build errors. This commit fixes all the build errors by
 - including header files
 - providing function definition
 - adding guards for typedef statements and functions

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:15 +08:00
Yanray Wang
bd56b035f1 Move TLS connection related functions to ssl_helpers.c
Some functions are renamed in commit c463849. This change moves all
those functions which are used to set up a TLS connection from
test_suite_ssl.function into ssl_helpers.c.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:12:41 +08:00
Yanray Wang
82b414938e Improve code readability for test_suite_ssl.function
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:12:21 +08:00
Yanray Wang
862ef862fd Rewrap the lines to fit code standard in test_suite_ssl.function
As the typedef statements and functions are renamed in commit
abfdcd8 and commit c463849 respectively. This commit aims
to align code lines to fit code standard and improve code
readability.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:12:12 +08:00
Yanray Wang
c463849598 Rename the functions which are used to set up TLS connection
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:11:41 +08:00
Yanray Wang
59ab276ef1 Move the renamed typedef statements to ssl_helpers.h
With this change, the renamed typedef statements (commit abfdcd8)
are moved from test_suite_ssl.function into ssl_helpers.h

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:11:32 +08:00
Yanray Wang
abfdcd8ee2 Rename the typedef statements which are used for TLS connection
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-14 19:04:42 +08:00
Yanray Wang
5fce145d00 Create ssl_helpers.c to hold functions of TLS connection
test_suite_ssl.function contains many functions that are used to set
up a TLS connection. To reduce its file size, those functions would
be moved to ssl_helpers.c under tests/src. As the start of this
implementation, some necessary header files are moved in advance.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-14 19:04:42 +08: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