Commit graph

28907 commits

Author SHA1 Message Date
Paul Elliott
40f0ec246e Remove requirement for SHA512 from ctr_drbg test
Set the entropy len prior to doing the test to ensure the outcome is the
same regardless of whether SHA512 or SHA256 is used.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
20a95bc09a Remove explicit linking of PThread in make
This would break platforms that do not have pthread. Put the linking
instead behind a define and add this define where required to all.sh.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
6587959a32 Add ability to pass make variables to psa_collect_statuses.py
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
be978a8c4f Add option to pass make variables to depends.py
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
80fa88e2fa Remove warning with GCC 12 and TSan
Compiler is unhappy that the return from mbedtls_cipher_get_name() could
be NULL as this is used in a printf statement.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
356597f077 Make TSan test run operate on full config
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
bb0e48f94f Make number of threads a test argument
Remove hard coded number of threads.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
fed410f58e Increase entropy buffer sizes
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
811c600d88 Guard tests correctly
All guarded options change output, thus failing the test.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
6a997c9994 Fix code style
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
2667eda785 Explicitly link tests with pthreads
Required to use pthreads within tests.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
8860021abc Fix false claim of variables used unitialised
GCC with TSan + O3 causes an error where it claims key_len and iv_len
may be used uninitialised. This is, as far as I can tell incorrect (the
only way it could not be set is in the error case, and then it is not
used), however the simplest option seemed to be just to fix it.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
bbdfc8ad2c Add TsanDbg, standardise Tsan with other sanitisers
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
bda25dd29c Add re-seeding option to test
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
20b2efa293 Fix missing include
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
178bf3ee8a Fix failing multi-threaded unit test
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
a16ee6b7d4 Add multi-threaded unit test
The unit test we add is designed to fail. The goal is to test the tests
and show that they catch the problem. A later commit will fix the unit
test and will make it pass.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
9338cac050 Add tsan to all.sh
component_test_tsan now builds and tests the library with
clang ThreadSanitizer enabled.

There are no multi-threaded unit tests so far, the goal is that they are
automatically tested with TSan when they are added.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
eb075c5de4 Add cmake build type for tsan
Building with clang ThreadSanitizer can now be done by setting the build
type:

cmake -D CMAKE_BUILD_TYPE:String=TSan .

(ThreadSanitizer is available in clang 3.2 and gcc 4.8, README.md states
that we test with clang 3.8 and gcc 5.4.)

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Dave Rodgman
af616d9123 Merge remote-tracking branch 'origin/development' into iar-fixes 2023-12-18 13:38:22 +00:00
Manuel Pégourié-Gonnard
8f1c36df00
Merge pull request #8607 from valeriosetti/issue8602
Make enrollement "optional" in pk_can_do_ext()
2023-12-18 11:30:04 +00:00
Bence Szépkúti
a085fa8ccf
Merge pull request #8627 from tom-cosgrove-arm/ip_len
Avoid use of `ip_len` as it clashes with a macro in AIX system headers
2023-12-18 02:03:17 +00:00
Bence Szépkúti
71c71eb91c all.sh: Parse arguments before checking if a test is supported
Support for each test was checked before the command line had been
parsed, causing the support_ functions to ignore arguments that set a
tool's location.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2023-12-15 20:27:50 +01:00
Valerio Setti
4ff405cf80 block_cipher: remove psa_key_type from mbedtls_block_cipher_context_t
This information was redundant with the already existing mbedtls_block_cipher_id_t.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-15 16:10:52 +01:00
Dave Rodgman
543d275c68
Merge pull request #8635 from daverodgman/asan-opt
CI perf - prefer clang for Asan
2023-12-15 13:25:02 +00:00
Ryan Everett
abd8977cc1 Make check_files ignore png files in docs
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-15 12:33:38 +00:00
Ryan Everett
c1c6e0d906 Justify linearization points
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-15 12:33:26 +00:00
Dave Rodgman
d5635e95e2 Undo accidental change
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-15 11:04:34 +00:00
Dave Rodgman
a2cf240fff Add explanatory comment
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-15 11:04:13 +00:00
Manuel Pégourié-Gonnard
cddab78612
Merge pull request #8630 from joerchan/mbedtls-tfm-compat
Mbedtls tfm compat
2023-12-15 09:31:27 +00:00
Dave Rodgman
c1f0f5b8af Fix a typo
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 23:34:48 +00:00
Dave Rodgman
b90f87b9a8 Use gcc for -m32 Asan builds
There seem to be known issues with clang for this target.

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 23:27:39 +00:00
Dave Rodgman
815b240d72 Fix unused function/variable warnings from clang
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 23:20:48 +00:00
Dave Rodgman
17127e9f39 Use clang as default compiler for Asan
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 19:34:52 +00:00
Valerio Setti
52ab8fa565 analyze_outcomes/all.sh: add reference component and entry for coverage comparison
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:09:26 +01:00
Valerio Setti
efdb8261b9 all.sh: keep CIPHER_C enabled in test_full_block_cipher_psa_dispatch()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
bd7528a592 ccm/gcm: use BLOCK_CIPHER whenever possible
Prefer BLOCK_CIPHER instead of CIPHER_C whenever it's enabled.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
4a5d57d225 adjust_legacy_crypto: enable BLOCK_CIPHER also when a driver is available
As a consequence BLOCK_CIPHER will be enabled when:
- CIPHER_C is not defined
- a proper driver is present for one of AES, ARIA and/or Camellia key types

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
ac7df142e8 test_suite_block_cipher: fix unused variable when !MBEDTLS_BLOCK_CIPHER_SOME_PSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
2684e3f2e3 config_adjust_legacy_crypto: fix typo
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
785ec17795 block_cipher: use PSA_BITS_TO_BYTES() in mbedtls_block_cipher_setkey()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
291571b447 block_cipher: add MBEDTLS_PRIVATE to new PSA fields in mbedtls_block_cipher_context_t
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
c4831224d5 all.sh: keep PSA_WANT_ALG_[GCM/CCM] enabled in test_full_block_cipher_psa_dispatch()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
849a1abfdd block_cipher: remove useless use of psa_cipher_operation_t
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
1cf81c3c80 test_suite_block_cipher: add new data file for PSA/legacy dispatch test
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
10e9aa26c5 tests: add PSA_INIT/PSA_DONE to CCM and GCM test suites
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
f8e6cbacc0 all.sh: add new component for block_cipher dispatch to PSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
4bc7fac99a crypto_builtin_composites: add missing guards for includes
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
c0f9bbca2c check_config: use new helpers for legacy GCM_C/CCM_C
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
8bba087fe1 adjust_legacy_crypto: add helpers for block ciphers capabilities
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00