Commit graph

7116 commits

Author SHA1 Message Date
Gilles Peskine
cca6ce8829 Fix directory mixup with generated data files
CMakeLists.txt was calling generate_psa_tests.py and siblings to list the
generated test data files with a --directory option, intended the output to
be this argument textually. This used to work, but no longer does, because
the --directory argument is relative to the current directory when the
Python script is invoked, and the script now shows an absolute path.

CMakeLists.txt now completely ignores the directory part of the listed data
file paths and builds its own. The base_xxx_files variables now contain
actual base names, without a "suites/" prefix. This makes it more robust
with respect to the behavior of the Python script, but it will break if
we put data files in multiple different directories one day.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-18 23:08:38 +02:00
Gilles Peskine
e188734f51 Don't use parallel jobs for pylint
When pylint runs in parallel, it loses the ability to detect duplicated code
across modules. Duplicated code is usually a bad thing, so give pylint the
opportunity to let us know.

This makes pylint slightly slower, but going from 2 threads to 1 does not
make it anywhere close to twice as slow. On my machine, with Python 3.5,
pylint -j2 takes about 12s while single-threaded pylint takes about 16s
of wall clock time.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-18 21:27:37 +02:00
Gilles Peskine
d9071e7d96 Unify check_repo_path
We had 4 identical copies of the check_repo_path function. Replace them by a
single copy in the build_tree module where it naturally belongs.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-18 21:17:09 +02:00
Gilles Peskine
4537d6d838 Move implementation detail from docstring to comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-17 10:38:58 +02:00
Gilles Peskine
64f2efdc40 More precise name for test data generation
We have Python code both for test code generation
(tests/scripts/generate_test_code.py) and now for test data generation.
Avoid the ambiguous expression "test generation".

This commit renames the Python module and adjusts all references to it. A
subsequent commit will adjust the documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-17 10:38:58 +02:00
Gilles Peskine
1716f06ee3
Merge pull request #6093 from wernerlewis/bignum_test_script
Add bignum test case generation script
2022-09-17 10:37:26 +02:00
Werner Lewis
c2fb540c67 Use a script specific description in CLI help
Previous changes used the docstring of the test_generation module,
which does not inform a user about the script.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-16 17:03:54 +01:00
Manuel Pégourié-Gonnard
409a620dea
Merge pull request #6255 from mprse/md_tls13
Driver-only hashes: TLS 1.3
2022-09-15 10:37:46 +02:00
Manuel Pégourié-Gonnard
18dff1f226
Merge pull request #5871 from superna9999/4153-psa-expose-ec-j-pake
Expose ECJPAKE through the PSA Crypto API
2022-09-15 09:25:55 +02:00
Ronald Cron
62e24ba186
Merge pull request #6260 from yuhaoth/pr/add-multiple-pre-config-psks
TLS 1.3:Add multiple pre-configured psk test for server
2022-09-15 08:58:40 +02:00
Werner Lewis
52ae326ebb Update references to file targets in docstrings
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-14 16:52:45 +01:00
Werner Lewis
ac446c8a04 Add combination_pairs helper function
Wrapper function for itertools.combinations_with_replacement, with
explicit cast due to imprecise typing with older versions of mypy.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-14 16:52:45 +01:00
Werner Lewis
b6e809133d Use typing.cast instead of unqualified cast
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-14 16:52:45 +01:00
Ronald Cron
208257b39f
Merge pull request #6259 from yuhaoth/pr/add-psk_ephemeral-possible-group-tests
TLS 1.3: PSK: Add possible group tests for psk with ECDHE
2022-09-14 14:21:46 +02:00
Jerry Yu
673b0f9ad3 Randomize order of psks
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2022-09-14 18:02:26 +08:00
Manuel Pégourié-Gonnard
b2407f2b91
Merge pull request #6261 from mprse/hash_size_macro
Create MBEDTLS_MAX_HASH_SIZE in hash_info.h
2022-09-14 10:00:06 +02:00
Przemek Stekiel
dcec7ac3e8 test_psa_crypto_config_accel_hash_use_psa: enable tls.1.3 at the end and adapt comment
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-09-13 18:08:54 +02:00
Przemek Stekiel
a4af13a46c test_psa_crypto_config_accel_hash_use_psa: enable TLS 1.3
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-09-13 18:08:54 +02:00
Dave Rodgman
8cc46aa22c
Merge pull request #6275 from daverodgman/fixcopyright
Correct copyright and license in crypto_spe.h
2022-09-13 11:23:52 +01:00
Dave Rodgman
53a18f23ac Correct copyright and license in crypto_spe.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-09-12 17:57:32 +01:00
Werner Lewis
3dc45198e6 Replace L/R inputs with A/B
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-12 17:35:27 +01:00
Werner Lewis
1fade8adb6 Move symbol definition out of __init__
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-12 17:34:15 +01:00
Andrzej Kurek
d681746a51 Split some ssl-opt.sh test cases into two
There's a slightly different behaviour without MBEDTLS_SSL_ASYNC_PRIVATE
that has to be handled.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-12 05:37:46 -04:00
Andrzej Kurek
07e3570f8c Add an ssl-opt.sh run to all.sh for the accel_hash_use_psa config
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-12 05:37:46 -04:00
Andrzej Kurek
934e9cd47f Switch to the new version of hash algorithm checking in ssl-opt.sh
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-12 05:34:23 -04:00
Andrzej Kurek
9c061a2d19 Add a posibility to check for the availability of hash algs to ssl-opt
The new function now dispatches a check for either an MBEDTLS
or PSA define to check for SHA_XXX.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-12 05:34:23 -04:00
Manuel Pégourié-Gonnard
f6a6a2d815
Merge pull request #6216 from AndrzejKurek/tls-tests-no-md-compat
TLS without MD - compat.sh addition to all.sh hash acceleration tests
2022-09-12 10:23:49 +02:00
Przemek Stekiel
40afdd2791 Make use of MBEDTLS_MAX_HASH_SIZE macro
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-09-06 14:18:45 +02:00
Neil Armstrong
2a73f21878 Fixup expected status handling in ecjpake_setup() and add more coverage for psa_pake_set_password_key()
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-09-06 11:34:54 +02:00
Jerry Yu
58af2335d9 Add possible group tests for psk with ECDHE
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2022-09-06 14:49:39 +08:00
Jerry Yu
079472b4c9 Add multiple pre-configured psk test for server
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2022-09-06 11:44:18 +08:00
Neil Armstrong
78c4e8e9cb Make ecjpake_do_round() return void and use TEST_ASSERT with a descriptive text instead of returning a value
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-09-05 18:08:13 +02:00
Neil Armstrong
51009d7297 Add comment in ecjpake_do_round() explaining input errors can be detected any time in the input sequence
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-09-05 17:59:54 +02:00
Andrzej Kurek
5e0654a324 Add a compat.sh run to psa_crypto_config_accel_hash_use_psa
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-04 09:31:17 -04:00
Andrzej Kurek
c502210291 Adjust pkparse test dependencies
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 15:33:20 -04:00
Werner Lewis
855e45c817 Use simpler int to hex string conversion
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-02 17:26:19 +01:00
Werner Lewis
56013081c7 Remove unused imports
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-02 12:57:37 +01:00
Werner Lewis
a4668a6b6c Rework TestGenerator to add file targets
BaseTarget-derived targets are now added to TestGenerator.targets in
initialization. This reduces repeated code in generate_xxx_tests.py
scripts which use this framework.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-02 11:56:34 +01:00
Andrzej Kurek
7a32072038 Setup / deinitialize PSA in pk tests only if no MD is used
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:07:15 -04:00
Andrzej Kurek
26909f348f Add PSA initialization and teardown to tests using pkcs5
If PSA is defined and there is no MD - an initialization
is required.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:05:37 -04:00
Andrzej Kurek
a57267c758 Add a possibility to call PSA_INIT without MBEDTLS_PSA_CRYPTO_C
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:05:37 -04:00
Andrzej Kurek
37a17e890c Enable PKCS5 in no-md builds in all.sh
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:05:33 -04:00
Andrzej Kurek
ed98e95c81 Adjust pkcs5 test dependencies
Hashing via PSA is now supported 
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:03:25 -04:00
Andrzej Kurek
dd36c76f09 Provide a version of pkcs5_pbkdf2_hmac without MD usage
Use the new implementation locally
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:03:25 -04:00
Manuel Pégourié-Gonnard
97fc247d6a
Merge pull request #6232 from AndrzejKurek/pkcs12-no-md
Remove MD dependency from pkcs12 module
2022-09-02 09:43:13 +02:00
Andrzej Kurek
7bd12c5d5e Remove MD dependency from pkcs12 module
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-01 08:57:41 -04:00
Manuel Pégourié-Gonnard
0777ec1625
Merge pull request #6109 from superna9999/6100-crash-in-test-suite-x509write
Crash in test suite x509write config full no seedfile
2022-09-01 11:18:30 +02:00
Werner Lewis
a4b7720cb5 Use combinations_with_replacement for inputs
When generating combinations of values, `itertools.combinations` will
not allow inputs to be repeated. This is replaced so that cases where
input values match are generated, i.e. ("0", "0").

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-08-31 16:55:44 +01:00
Ronald Cron
e00d6d6b55
Merge pull request #6135 from yuhaoth/pr/tls13-finalize-external-psk-negotiation
TLS 1.3: SRV: Finalize external PSK negotiation
2022-08-31 17:21:57 +02:00
Jerry Yu
6688669124 replace psk&dhe with psk_or_ephemeral
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2022-08-31 17:08:34 +08:00