11722 Commits

Author SHA1 Message Date
Elena Uziunaite
e26f20e745 Adapt paths for scripts/quiet
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-12-09 15:37:49 +00:00
Elena Uziunaite
58172ae15e Adapt paths for output_env.sh
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-12-09 15:37:49 +00:00
Elena Uziunaite
9837ad316a Move files out of Mbed TLS
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-12-09 15:37:48 +00:00
Harry Ramsey
816c7c27f4 Refactor scripts to use config.py instead of config.pl
This commit refactors scripts to use config.py which replaces config.pl.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-05 10:55:31 +00:00
Harry Ramsey
8fae4b05ef Remove obsolete tcp_client.pl
This commit removes tcp_client.pl and removes it from ssl-opt.sh as it
has been replaced by test_suite_ssl.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-05 10:54:39 +00:00
Harry Ramsey
b5cfc05e89 Remove obsolete Travis CI scripts
This commit removes obsolete Travis CI scripts that are no longer
required due to the transition to a publically available CI image.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-05 10:53:47 +00:00
Harry Ramsey
454cb09a3a Remove obsolete Docker CI scripts
This commit removes Docker CI scripts from the repository as they are no
longer necessary with CI images being publically available.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-05 10:53:37 +00:00
Gilles Peskine
fbc8687033 Fix copypasta
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-12-02 21:46:50 +01:00
Elena Uziunaite
695810a093 Define FRAMEWORK
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-11-27 13:21:53 +00:00
Elena Uziunaite
f1099cb77e Use new functions
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-11-27 13:21:53 +00:00
David Horstmann
e60b395aa5
Merge pull request #9762 from Harry-Ramsey/update-gcm-doc-3.6
[Backport 3.6] Fix doc on GCM API
2024-11-21 17:35:53 +00:00
Gilles Peskine
8a8aa59f52 PSA interruptible sign/verify: detect unsupported mechanism in start
In particular, if interruptible ECDSA is supported but not the deterministic
variant, detect this in psa_sign_hash_start(), whereas before start() would
succeed and psa_sign_hash_complete() would fail. This avoids an
inconsistency between psa_sign_hash() and psa_sign_hash_start() that would
be annoying to handle in test_suite_psa_crypto_op_fail.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-21 09:48:35 +01:00
Gilles Peskine
6bf0b2e678 Add missing resource cleanup on test failure
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-21 09:48:35 +01:00
Gilles Peskine
8729b10f26 Fix edge case with half-supported ECDSA (manual test cases)
ECDSA has two variants: deterministic (PSA_ALG_DETERMINISTIC_ECDSA) and
randomized (PSA_ALG_ECDSA). The two variants are different for signature but
identical for verification. Mbed TLS accepts either variant as the algorithm
parameter for verification even when only the other variant is supported,
so we need to handle this as a special case when generating not-supported
test cases.

In this commit:

* Add manually written not-supported test cases for the signature
  operation when exactly one variant is supported.
* Add manually written positive test cases for the verification
  operation when exactly one variant is supported.
* Register that !ECDSA but DETERMINISTIC_ECDSA is not tested yet
  (https://github.com/Mbed-TLS/mbedtls/issues/9592).

A commit in the framework will take care of automatically generated test cases.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-21 09:48:35 +01:00
Ronald Cron
83d21cc8f4 Move back *config_test_driver* headers from the framework
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-11-20 13:22:54 +01:00
Gilles Peskine
85bc82c280 Add some missing test case dependencies
Following "PSA sign/verify: more uniform error on an unsupported hash", some
error cases are detected earlier, so there is some sloppiness in test case
dependencies that is not longer acceptable.

* In test_suite_psa_crypto, one test case for a hash+sign algorithm now
  returns NOT_SUPPORTED rather than INVALID_ARGUMENT when the hash is not
  supported and the key is invalid.
* In test_suite_psa_crypto_se_driver_hal_mocks, some test cases now error
  out before reaching the mocks rather than after when they attempt to
  use an unsupported hash.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-19 22:11:42 +01: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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