31713 Commits

Author SHA1 Message Date
David Horstmann
c2d7f5fc2e Add framework test include path to common.mk
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
1d9b033067 Add SSL-related test includes to ssl programs
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
4c4e0864f2 Add the framework/tests/include path to testsuites
These need to include from the framework path as this is where most test
helpers have been moved to.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
0e8cc1182c Re-add tests/include and tests/src paths to tests
Some tests need the SSL-related parts of tests/include and tests/src
which stayed in Mbed TLS. Add these parts to the mbedtls_test target

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
7d81e8a243 Add missing extra include path to fuzzer programs
The fuzzer needs both kinds of test helper so needs to include things
from both new and old locations.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
16b1c7b86c Re-add tests/include path for test helpers
These must include from both the framework and the main repository since
the test helpers straddle the two locations.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
dcf42a0b53 Update references to test helpers
Replace:
* tests/src -> framework/tests/src
* tests/include -> framework/tests/include

Except for occurrences of:
* tests/src/test_helpers (since this only contains ssl_helpers.c)
* tests/src/test_certs.h
* tests/include/alt_dummy

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:40 +00:00
David Horstmann
eae12b1a01 Move some test helpers out of Mbed TLS
Everything not TLS-related and not ALT-interface-related has been moved
out of tests/src and tests/include and into the framework.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:17:28 +00:00
Manuel Pégourié-Gonnard
e3ea31da68
Merge pull request #9770 from mpg/move-all-core-3.6
[3.6] Move all-core and all-helpers to the framework
2024-11-14 09:51:32 +00:00
Manuel Pégourié-Gonnard
d3997d09a5 Update framework pointer
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-11-14 09:15:49 +01:00
Harry Ramsey
9892d14607 Fix documentation for GCM decryption functions
This commit fixes documentation specifying buffer overlap on GCM
decryption functions.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-13 19:27:31 +00:00
Harry Ramsey
d77207efdd Fix issue where input data could be length 0
This commit fixes an issue in the GCM shared buffer test case where
input data could be of length 0 and an adequate buffer was not
allocated.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-13 09:42:59 +00:00
Harry Ramsey
01d32e76dd Fix check_names errorr for MBEDTLS_GCM_ALT comment
This commit fixes an issue with check_names failing due to not being
defined as a macro in Mbed TLS. This is instead defined by alternative
implementations of MBEDTLS_GCM.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-12 20:02:43 +00:00
Manuel Pégourié-Gonnard
38b9f724a8 Update path to all-core.sh
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-11-12 12:11:07 +01:00
Manuel Pégourié-Gonnard
0460518a6d Update framework pointer
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-11-12 12:10:17 +01:00
Manuel Pégourié-Gonnard
598cc22f9e Move all-{core,helpers}.sh out of Mbed TLS
Signed-off-by: Manuel Pégourié-Gonnard <mpg@elzevir.fr>
2024-11-12 11:40:11 +01:00
Harry Ramsey
e320b899f5 Fix TEST_CALLOC issues with GCM buffer overlap tests
This commit fixes issues with TEST_CALLOC in GCM buffer overlap tests
cases.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-11 15:02:26 +00:00
Harry Ramsey
187fcce476 Add test cases for AES GCM input and output buffer overlap
This commit adds test cases for input and output buffer overlap. The
data for the test cases is a duplicate of existing encrypt/decrypt test
cases.

The two test functions gcm_<encrypt/decrypt>_input_output_buffer_overlap
are modified to use a single malloc buffer rounded to the nearest
128-bits/16-bytes for input and output.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-07 09:26:43 +00:00
Harry Ramsey
c7b1a9099a Update GCM buffer overlap documentation
This commit updates GCM buffer overlap documentation to explicitly
support overlapping encryption/decryption buffers for GCM.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-07 09:20:38 +00:00
Manuel Pégourié-Gonnard
429fcdad85
Merge pull request #9754 from mpg/all.sh-tf-psa-crypto-3.6
[Backport 3.6] All.sh changes to support tf-psa-crypto components
2024-11-07 08:49:38 +00:00
Paul Elliott
346d2f4e58
Merge pull request #9731 from gilles-peskine-arm/coverity-20241004-3.6
Backport 3.6: Fix edge cases of mbedtls_psa_raw_to_der and mbedtls_psa_der_to_raw
2024-11-06 19:02:54 +00:00
Janos Follath
5caee9d9d6
Merge pull request #9757 from gilles-peskine-arm/psa_init-20241104-3.6
Backport 3.6: Fix MD_PSA_INIT called before initializing some data structures
2024-11-06 09:15:28 +00:00
Bence Szépkúti
15262e0472
Merge pull request #9725 from eleuzi01/issue-51-backport
[Backport 3.6] Add a Python utility function to get the 3.6 feature macro
2024-11-05 17:27:06 +00:00
Gilles Peskine
8369b4acb5 Fix MD_PSA_INIT called before initializing some data structures
This fixes accesses to uninitialized memory in test code if
`psa_crypto_init()` fails.

A lot of those were pointed out by Coverity. I quickly reviewed all calls to
`MD_PSA_INIT()` manually, rather than follow any particular list.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-05 17:04:30 +01:00
Manuel Pégourié-Gonnard
07a9c676b2
Merge pull request #9750 from Harry-Ramsey/improve-submodule-error-messages-3.6
[Backport 3.6] Improve submodule error messages for Github archives
2024-11-05 10:26:46 +00:00
Elena Uziunaite
518320cb27 Update submodule with the merge
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-11-05 09:58:09 +00:00
Manuel Pégourié-Gonnard
69fe0e8bf4 all.sh: improve check for clean config files
The existing check only took care of CONFIG_H. This was both not enough
and too much:
- not enough because config.py can also modify CRYPTO_CONFIG_H and we
want to know about it just as much as CONFIG_H;
- too much because CONFIG_H does not exist in tf-psa-crypto.

Check a list of files instead of a single one, and adjust that list.

Also update an outdated comment about Makefiles

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-11-05 10:38:02 +01:00
Manuel Pégourié-Gonnard
621c96a71f all.sh: rationalize relative path usage
In preparation for adding tf-psa-crypto/test/scripts/all.sh which will
run from tf-psa-crypto.

Use paths relative to the currently sourced file when including common
files (ie, those that will soon be moved to the framework). Otherwise,
use paths relative to the current directory, aka project's root.

Document that test/script/all.sh must be invoked from the project's root
(that was already the case, but implicit so far).

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-11-05 10:37:36 +01:00
Gilles Peskine
aef3f74e4d
Merge pull request #9739 from gilles-peskine-arm/mbedtls_psa_ecp_generate_key-no_public_key-3.6
Backport 3.6: PSA ECC key generation: don't generate the public key
2024-11-04 16:36:49 +00:00
Harry Ramsey
e3fdd0a9c5 Fix undefined variable in CMakeLists.txt
This commit replaces an undefined variable ${MBEDTLS_FRAMEWORK_DIR} for
${CMAKE_CURRENT_SOURCE_DIR}.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-04 15:14:53 +00:00
Harry Ramsey
0ad7cc2bf9 Fix undefined variable in makefile
This commit replaces an undefined variable ${MBEDTLS_FRAMEWORK_DIR} for
${MBEDTLS_PATH}.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-04 12:18:53 +00:00
Harry Ramsey
bfd83badc8 Improve makefile error message
This commit improves the makefile error message when using make, it no
longer incorrectly reports that CMakeLists.txt cannot be found instead
of exported.make.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-04 11:39:46 +00:00
Harry Ramsey
d532a663d0 Improve submodule error messages for Github archives
This commit improves the error messages informing users that have
downloaded Github archives to instead download a release archive. This
is due to Github not supporting submodules within archives and no
trivial way for users to use git to download them.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-04 10:50:30 +00:00
Manuel Pégourié-Gonnard
3c5b928d42
Merge pull request #9747 from gilles-peskine-arm/ffdh-memsan-skip-3.6
Backport 3.6: Skip slowest FFDH tests against GnuTLS with MSan or Valgrind
2024-11-04 08:10:21 +00:00
Elena Uziunaite
98cf806fab Add a Python utility function to get the 3.6 feature macro
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-11-01 14:50:31 +00:00
Gilles Peskine
6bdebfe464 Skip slowest FFDH tests against GnuTLS with MSan or Valgrind
Skip 6144-bit and 8192-bit FFDH tests in MSan or Valgrind test
configurations. These test cases are slow and sometimes trigger GnuTLS's
built-in timeout (which cannot be configured until more recent versions).

Resolves #9742.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-31 21:40:43 +01:00
Bence Szépkúti
5544b280ed
Merge pull request #9118 from jetm/ssl-client2-get-req-host-3.6
Backport 3.6: ssl_client2: Add Host to HTTP GET request
2024-10-31 11:32:55 +00:00
Gilles Peskine
1f4b63779c Don't use Unicode in .function file
generate_test_code.py doesn't support UTF-8 in .function files (but does
in .data files) when run in a non-UTF-8 locale with Python <=3.6.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 17:14:46 +01:00
Gilles Peskine
db226b4eec More explanation of what we do and do not test
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 13:44:02 +01:00
Paul Elliott
962eb8572b
Merge pull request #9737 from mpg/drop-armcc5-3.6
[3.6] Drop armcc5 support in all.sh
2024-10-30 12:29:55 +00:00
Gilles Peskine
e4546ba988 Add changelog entry
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 12:18:16 +01:00
Gilles Peskine
c8b668deae mbedtls_psa_ecp_generate_key: don't calculate the public key
mbedtls_ecp_gen_key() generates a private key and calculates the public key.
Calculating the public key takes most of the CPU time. But the PSA key store
doesn't store the key, in order to simplify the plumbing when drivers are
involved. So the time spent calculating the public key is a waste.

Instead, call mbedtls_ecp_gen_privkey(), which does not calculate the public
key.

This also saves 8 instructions in a sample arm thumb build.

Resolves #9732.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 12:18:16 +01:00
Gilles Peskine
2576bbc9fa Basic statistical tests for mbedtls_psa_ecp_generate_key()
Run a few iterations and check that there is some diversity in the results.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 12:18:16 +01:00
Gilles Peskine
9a09443973 Unit tests for mbedtls_psa_ecp_generate_key()
Run the function on a few different curves with shorter, just-right and
larger buffer sizes. Perform some basic sanity checks on the output (which
is random).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 12:18:16 +01:00
Manuel Pégourié-Gonnard
6f35a4dbe0
Merge pull request #9547 from davidhorstmann-arm/align-development-3.6-test-helpers-3.6
Align 3.6 test helpers with development
2024-10-30 09:09:36 +00:00
Bence Szépkúti
9ab41af5e6
Merge pull request #9733 from bensze01/graviton-testing-3.6
[Backport 3.6] Add default config tests for the A64, A32, Thumb 1 and Thumb 2 instruction sets
2024-10-29 12:24:52 +00:00
Manuel Pégourié-Gonnard
62a57e68a5 Rm forgotten armc5
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-29 12:42:43 +01:00
Manuel Pégourié-Gonnard
95395738b4 Drop building with armcc5 in all.sh
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-29 11:39:41 +01:00
Bence Szépkúti
2a45f0b952 Add override arguments for new gcc targets
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 12:16:14 +01:00
Bence Szépkúti
827c89ba07 Clarify GCC version requirement
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 12:16:13 +01:00