31686 Commits

Author SHA1 Message Date
David Horstmann
4c67ae3344 Update framework submodule
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-19 17:08:51 +00:00
Gilles Peskine
67cd8dbbe1 import_not_supported: edge case of unsupported curves
Allow imports of an ECC public key on an unsupported curve to return
INVALID_ARGUMENT rather than NOT_SUPPORTED. This can happen in our library
code in edge cases when only certain curve families are supported, and it's
acceptable.

The new code does not trigger yet, but it will be useful for a future commit
"Do run not-supported test cases on not-implemented mechanisms"
(forward port of 995d7d4c15406b0a115cadf3f5ec69becafdf20f).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-19 17:36:07 +01:00
Gilles Peskine
808b541316 PSA sign/verify: more uniform error on an unsupported hash
Uniformly return PSA_ERROR_NOT_SUPPORTED if given an algorithm that includes
a hash, but that hash algorithm is not supported. This will make it easier
to have a uniform treatment of unsupported hashes in automatically generated
tests.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-19 17:36:07 +01:00
David Horstmann
641f56e92e Update framework to add ported test helper changes
Update the framework pointer to reference new changes to
tests/src/psa_exercise.key.c and tests/include/test/psa_exercise_key.h
that have been ported to the framework from the main repo.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-18 16:43:56 +00:00
David Horstmann
36b68aac82 Update framework submodule
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-18 13:38:54 +00:00
David Horstmann
03a6a59e70 Update framework submodule
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-15 13:57:46 +00:00
David Horstmann
057f10db19 Update framework submodule
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:26:31 +00:00
David Horstmann
b25eaca940 Properly clean instrument_record_status.h
The paths to this header in clean: targets were missed previously when
changing paths to reflect the move of the header to the framework.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:50 +00:00
David Horstmann
bfbe5b4e37 Reverse accidental docs PSA test wrappers path
These were accidentally documented incorrectly in the PSA shared memory
documentation due to a global find and replace.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:50 +00:00
David Horstmann
44a9f2ff5f Add missing dependency to hash testsuite
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:49 +00:00
David Horstmann
cbf530dde7 Disable test hooks when checking missing symbols
The function mbedtls_test_hook_error_add() is declared in the library
but supplied by test helpers in framework/tests/src, so it is undefined
in library-only builds. This messes up our checks for missing symbols,
so disable MBEDTLS_TEST_HOOKS when we are building to check missing
symbols.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:49 +00:00
Harry Ramsey
5b80448105 Move mbedtls_test_hook_error_add from error.c to helpers.c
This commit moves mbedtls_test_hook_error_add from error.c to helpers.c.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-11-14 14:19:49 +00:00
David Horstmann
0f33bfa48a Add missing include path to visual C script
We need to include from both tests/include and framework/tests/include.
Update scripts/generate_visualc_files.pl to re-add tests/include, which
had previously been replaced with framework/tests/include.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
26e1862742 Update test_keys.h path on Windows
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
501e9a9fee Update paths to generated PSA test wrappers
These are not moving to the framework, so their paths are fine to stay
as they are, undo the update done through global search-replace.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
c54f0b3e37 Update generate path to instrument_record_status.h
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
b19374f548 Update path to PSA crypto alt headers
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
2ab59f0450 Add extra paths to generate_visualc_files.pl
Both the main repository and framework test helper paths are needed, so
generate these in the script.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
61b7b1e780 Update make clean target with moved test helpers
Test helpers that are now moved to the framework must be cleaned
properly.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
4d47ee4146 Update test_keys.h generation in Makefile
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
685c19447f Update libtestdriver paths in tests/Makefile
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
45c83caf59 Add tests/Makefile targets for moved test helpers
Everything that has been moved to tests/src needs a Makefile target in
order to be built.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
David Horstmann
fbedae40f1 Update common.mk with test helper object paths
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-14 14:19:42 +00:00
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