Gilles Peskine
5d867872dd
Improve readability of null-argument tests
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-02 17:57:51 +01:00
Valerio Setti
2c1070b397
test_suite_md: improve md_to_from_psa() test function and related data
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 14:58:22 +01:00
Valerio Setti
384fbde49a
library/tests: replace md_psa.h with psa_util.h as include file for MD conversion
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 13:27:32 +01:00
Dave Rodgman
84125a167e
Merge remote-tracking branch 'origin/development' into default-compiler-all
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-02 11:42:38 +00:00
Valerio Setti
8c8b4da3a3
all.sh: keep PSA_WANT_ALG_[CCM/GCM] enabled in common_block_cipher_dispatch()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 11:44:30 +01:00
Gilles Peskine
ea982e39a1
Merge pull request #8637 from bensze01/fix_supported_components
...
all.sh: Parse arguments before checking if a test is supported
2024-01-02 09:41:02 +00:00
Waleed Elmelegy
3d46b7f81a
Fix Max fragmen length test to use TLS 1.2 maximum output size
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-01-01 20:50:53 +00:00
Waleed Elmelegy
bae705c12b
Fix TLS 1.2 test to use TLS 1.2 maximum output size
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-01-01 14:21:21 +00:00
Valerio Setti
84d19e0836
all.sh: keep DES_C and CTR_DRBG_C enabled in test_full_no_cipher_with_crypto()
...
These were probably leftovers from the development phase of the
associated PR that were not removed in the end.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 16:42:21 +01:00
Waleed Elmelegy
ea03183bd7
Adjust TLS 1.3 tests to new maximum output changes
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-12-29 15:36:51 +00:00
Valerio Setti
e581e140cc
oid/pkparse: add missing guards for PKCS[5/12] functions when !CIPHER_C
...
This commit also updates test_suite_pkparse.data file adding
MBEDTLS_CIPHER_C dependencies whenever PKCS[5/12] is used.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 16:35:58 +01:00
Valerio Setti
562dfe1067
all.sh: keep PKCS[5/12] enabled in full_no_cipher test components
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 16:34:19 +01:00
Valerio Setti
a0c9c6684d
analyze_outcomes: ignore only test concerning AES/ARIA/Camellia in CMAC
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 14:14:11 +01:00
Valerio Setti
160b2bde09
test_suite_cmac: add used key type to all test cases
...
This is useful for grepping and skipping disparities in
analyze_outcomes.py.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 14:07:11 +01:00
Waleed Elmelegy
87a373eea6
Improve Record size limit testing
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-12-28 17:49:36 +00:00
Valerio Setti
0635cca7d1
analyze_outcomes: update skipped tests following latest changes to all.sh
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:17 +01:00
Valerio Setti
cd21d4eb8f
all.sh: keep legacy cipher modes enabled in test_full_block_cipher_legacy_dispatch()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:17 +01:00
Valerio Setti
9a4cc122a7
test_suite_block_cipher.psa: remove misleading initial comment
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:17 +01:00
Valerio Setti
ab0494f193
analyze_outcomes: update comments of skipped tests
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 13:56:52 +01:00
Valerio Setti
b9f4bfc33b
all.sh: fix messages in test_psa_crypto_config_accel_des
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 11:07:48 +01:00
Gilles Peskine
3b17ae78d2
Add ECP-heavy-only test cases to the driver parity analysis ignore list
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 19:51:57 +01:00
Gilles Peskine
62e33bcc64
New function mbedtls_ecp_write_public_key
...
Directly export the public part of a key pair without having to go through
intermediate objects (using mbedtls_ecp_point_write_binary would require a
group object and a point object).
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 15:23:19 +01:00
Gilles Peskine
6dd87384ae
Rename variable that's a C++ keyword
...
It gave uncrustify trouble
(https://github.com/uncrustify/uncrustify/issues/4044 )
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 15:23:19 +01:00
Gilles Peskine
7ea72026cd
New function mbedtls_ecp_keypair_calc_public
...
For when you calculate or import a private key, and then need to calculate
the public key.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00
Gilles Peskine
28240323d3
New function mbedtls_ecp_set_public_key
...
Set the public key in a key pair. This complements mbedtls_ecp_read_key and
the functions can be used in either order.
Document the need to call check functions separately.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00
Gilles Peskine
091a85a762
Promise mbedtls_ecp_read_key doesn't overwrite the public key
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00
Gilles Peskine
ba5b5d67aa
Support partial export from mbedtls_ecp_keypair
...
Sometimes you don't need to have all the parts of a key pair object. Relax
the behavior of mbedtls_ecp_keypair so that you can extract just the parts
that you need.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00
Gilles Peskine
e6886102ef
New function mbedtls_ecp_keypair_get_group_id
...
Add a simple function to get the group id from a key object.
This information is available via mbedtls_ecp_export, but that function
consumes a lot of memory, which is a waste if all you need is to identify
the curve.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00
Gilles Peskine
7602298a16
Allow *.make to contain tabs
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 15:28:07 +01:00
Gilles Peskine
259df98972
Revert "Add option to pass make variables to depends.py"
...
This reverts commit be978a8c4f
.
The feature is no longer needed, and the script is broken if you don't pass
--make-vars.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 13:17:33 +01:00
Gilles Peskine
811daaa48c
Revert "Add ability to pass make variables to psa_collect_statuses.py"
...
This reverts commit 6587959a32
.
The feature is no longer needed, and the script is broken if you don't pass
--make-vars.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 13:16:59 +01:00
Gilles Peskine
21570cf232
Auto-detect the need to link with pthread on Unix-like platforms
...
When building with Make on a Unix-like platform (shell and compiler),
auto-detect configurations that may require linking with pthread.
This removes the need for MAKE_THREADING_FLAGS in all.sh.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:53:42 +01:00
Gilles Peskine
4392fc101f
Unify some common rules of programs/Makefile and tests/Makefile
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:49:35 +01:00
Gilles Peskine
076fd25480
Unify common variables of programs/Makefile and tests/Makefile
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:56 +01:00
Gilles Peskine
f3d1ae1f05
Create common.make with LOCAL_CFLAGS and friends
...
Create a common.make for definitions that are shared between tests/Makefile
and programs/Makefile, to facilitate maintenance. Start populating it with
CFLAGS/LDFLAGS variables. More to follow in subsequent commits.
Keep library/Makefile independent, at least for the time being.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:56 +01:00
Gilles Peskine
f5c5ce7789
Partly unify LOCAL_CFLAGS
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:56 +01:00
Gilles Peskine
4ad5733836
Unify treatment of MBEDTLS_TEST_OBJS
...
Unify the treatment of MBEDTLS_TEST_OBJS between programs/Makefile and
tests/Makefile: include it via LOCAL_LD_FLAGS in both cases. Document why
the definition of MBEDTLS_TEST_OBJS is different.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:56 +01:00
Gilles Peskine
afccc1a6d5
Indent nested conditionals
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:52 +01:00
Dave Rodgman
5c7e94487e
fix line length
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-21 15:42:22 +00:00
Valerio Setti
a72a797ffd
all.sh: keep PKCS[5/12] enabled in accel_cipher_aead tests
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-21 16:40:40 +01:00
Valerio Setti
a69e872001
pkcs[5/12]: add CIPHER_C for [en/de]crypting functions
...
This commit also updates corresponding test suites.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-21 16:39:04 +01:00
Dave Rodgman
3bc249959c
Merge branch 'development' into default-compiler-all
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-21 14:35:14 +00:00
Gilles Peskine
907cb020ef
Merge pull request #8618 from Ryan-Everett-arm/new-state-transition-documentation
...
Update thread safety state transition documentation
2023-12-21 12:09:58 +00:00
Gilles Peskine
0e6fdc4f1d
Merge pull request #8342 from yanesca/threading_test_pc
...
Threading test proof of concept and plan
2023-12-21 12:08:41 +00:00
Waleed Elmelegy
049cd302ed
Refactor record size limit extension handling
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-12-20 17:28:31 +00:00
Tomi Fontanilles
9c69348c24
pk test suite: rename the parameter named parameter
...
Signed-off-by: Tomi Fontanilles <129057597+tomi-font@users.noreply.github.com>
2023-12-20 12:59:57 +02:00
Tomi Fontanilles
8174662b64
pk: implement non-PSA mbedtls_pk_sign_ext()
...
This makes the function always available with its
its implementation depending on MBEDTLS_USE_PSA_CRYPTO.
Related dependencies and tests are updated as well.
Fixes #7583 .
Signed-off-by: Tomi Fontanilles <129057597+tomi-font@users.noreply.github.com>
2023-12-20 12:59:57 +02:00
Valerio Setti
5f665c3a0d
analyze_outcomes: add exceptions to disparities for block_cipher dispatch
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-20 09:56:05 +01:00
Valerio Setti
9afa329b80
analyze_outcomes: allow ignored test suites to have a dot in the name
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-20 09:55:28 +01:00
Valerio Setti
45c84feacc
test_suite_ccm: add missing BLOCK_CIPHER_PSA_[INIT/DONE]()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-20 09:54:39 +01:00
Valerio Setti
689c0f71cb
tests: use new CCM/GCM capability macros in tests
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-20 09:54:18 +01:00
Valerio Setti
4a8ef7cd9b
all.sh: disable legacy AES/ARIA/CAMELLIA in test_full_block_cipher_psa_dispatch
...
This commit also:
- rename the reference component as component_test_full_block_cipher_legacy_dispatch()
- add a common configuration function, named common_block_cipher_dispatch() that
is used from both accelerated and reference components
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-20 07:35:41 +01:00
Dave Rodgman
c393222643
Work around clang 3.8 bug
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-19 18:52:35 +00:00
Dave Rodgman
fc5b9553b2
Don't use full path for setting CC
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-19 16:08:19 +00:00
Dave Rodgman
bc8e61d962
Use gcc in test_full_deprecated_warning
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-19 14:07:15 +00:00
Dave Rodgman
d8d6451a6e
Add -O2 to some CFLAGS which were not setting it
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-19 12:20:21 +00:00
Dave Rodgman
ea03ef9a77
Don't specify gcc unless the test requires it
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-19 12:19:59 +00:00
Dave Rodgman
dfe5ce81ee
Use clang -O2 in common_block_cipher_no_decrypt
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-19 11:47:18 +00:00
Dave Rodgman
590519f535
Enable -O2 in depends.py
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-19 11:33:55 +00:00
Valerio Setti
9da01a7f53
all.sh: rename test_psa_crypto_config_accel_cipher to accel_des
...
Renaming this test component in order to better explain what it
really does.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-19 08:05:40 +01:00
Dave Rodgman
d0a594d444
Use gcc in test_psa_compliance
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-18 22:29:56 +00:00
Dave Rodgman
932ce859d5
Ensure test_psa_compliance uses gcc
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-18 20:35:54 +00:00
Dave Rodgman
0c5bfe816f
Ensure clang is present
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-18 19:53:25 +00:00
Dave Rodgman
66cbc83844
Use clang by default
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-18 18:34:50 +00:00
Paul Elliott
22dbaf05b6
Add AES_PSA_INIT() to thread test case
...
Tests were failing when PSA was being used in ctr_drbg_seed() as PSA was
not initialised.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 18:18:04 +00:00
Paul Elliott
445af3c25a
Move test dependancies to function file
...
Dependancies are determined by code in this case.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
79dc6dad81
Improve make pthread linking mechanism
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
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
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
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
Bence Szépkúti
bbb5af9eae
Set OpenSSL/GnuTLS variables in release components
...
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2023-12-15 21:06:01 +01: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
Bence Szépkúti
89dd5c0654
Document release components in all.sh
...
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2023-12-15 17:05:47 +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
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
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
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
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
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