Commit graph

21995 commits

Author SHA1 Message Date
Gilles Peskine
6641420951 Bignum core: Break shift_r function out of the classic shift_r
This commit contains the function prototype for mbedtls_mpi_core_shift_r,
and the implementation minimally modified from mbedtls_mpi_shift_r.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-20 11:40:15 +02:00
Janos Follath
e153a715f0 mpi_core_add_if: simplify tests
Use the new, limb size aware base class to generate tests for
mpi_core_add_if().

Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-10-20 10:40:03 +01:00
Janos Follath
dd2e4683d0 Bignum Core: add limb size specific test generation
In Bignum Core the result also involves a carry and both the result and
the carry depend on the size of the limbs.

Before this change both 32 and 64 bit specific result have been passed
to the test functions.

Moving this decision out of the tests makes the test functions easier to
write and read and the test cases easier to read and debug. The change
doesn't make writing the generator script any harder and might even make
reading it easier.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-10-20 10:38:22 +01:00
David Horstmann
2bb9c8a884 Change brace initialization to memset
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-20 10:18:37 +01:00
Janos Follath
2b751cfa46
Merge pull request #6399 from wernerlewis/bignum_gen_6274
Split bignum tests by module and generate with Python framework
2022-10-20 09:29:56 +01:00
David Horstmann
01dd548025 Minor fixes to x509_get_name() test function
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-19 17:13:57 +01:00
Werner Lewis
f1c24f0fbc Add missing include
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 16:43:22 +01:00
Werner Lewis
bd3ddafee2 Move tests added in #6289
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:36:18 +01:00
Werner Lewis
f86c82e8f3 Pass bits_in_limb parameter to duplicated methods
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
63653b9b0a Remove unnecessary check
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
6baf12b18d Move legacy mod functions back to test_suite_mpi
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
2295eecb12 Add missing space in string
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
ffe4478936 Move mpi_core_bitlen tests to bignum_core files
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
1b20e7e645 Redefine result() method to return List
Many bignum tests have multiple calculated result values, so return
these as a list, rather than formatting as a string.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
7a2731463b Add function to generate random montmul cases
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
a850312e9d Add test generation for mpi_core_montmul
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
0a9c48b68e Add test generation for mpi_core_mla
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
bbf0a32d67 Add flag for unique combinations in operations
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
6351c7f5f3 Add test generation for mpi_core_sub
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
ce769d1fc9 Add test generation for mpi_core_add_if
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
99e8178fa7 Add module for bignum_core test generation
Separate file is added for classes used to generate cases for tests
in bignum_core.function. Common elements of the BignumOperation class
are added to classes in a new common file, for use across files.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
0c6ea12145 Move bignum_mod tests into separate files
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
c9b6a0aef9 Move bignum_mod_raw tests into separate files
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:20:01 +01:00
Werner Lewis
c6004a2ab3 Move bignum_core tests into separate files
Test cases for mpi_core_add_if, mpi_core_mla, mpi_core_sub,
mpi_core_montmul are not copied into new files, these are generated in
subsequent commits.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-10-19 15:19:53 +01:00
Gilles Peskine
149c1516e7
Merge pull request #6435 from mpg/improve-outcome-analysis
Improve outcome analysis for driver-only builds
2022-10-19 15:54:17 +02:00
Gilles Peskine
4281ae0bd2
Merge pull request #6373 from gilles-peskine-arm/bignum-core-conventions
Spell out bignum core conventions
2022-10-19 15:53:33 +02:00
Gilles Peskine
db2996357c
Merge pull request #6289 from gabor-mezei-arm/6237_Add_conditional_assign_and_swap_for_bignum
Bignum: Add safe conditional assign and swap for the new MPI types
2022-10-19 15:51:19 +02:00
Andrzej Kurek
f4b8a4f971 pylint: ignore duplicated imports
It is not uncommon to have the same imports
across different python files. Ignore it when
running pylint.
Starting at pylint 2.14.5 this is the default value.

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 09:13:11 -04:00
Andrzej Kurek
b8a97e7520 depends.py: rename domains argument to tasks
Tasks can consist of domains and/or jobs.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
629c412e81 depends.py documentation fixes
Now that the format of exclusive groups has been changed,
update the documentation using it too.

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
9387b7b34e Add a temporary solution to create a seedfile
This caused problems if a config with SHA512 was
compiled after a config without it and the seedfile
did not contain enough data.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
b489f958b8 depends.py: remove config options that are unset anyway
Over the lifespan of this script these options have been removed
from the "full" configuration.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
a44c5bcdb7 depends.py: rename config_pl usage to config_py
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
22b959d9a5 depends.py - add SHA256 dependency of LMS
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
c610e7402e Formatting & unnecessary (void) fixes
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
65b2ac1f1d Change the way exclusive groups are defined in depends.py
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
f4b18672ff depends.py: fix TLS 1.3 requirements
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
a0cb4fa302 Improve depends.py readability
Switch from SHA224 & SHA384 testing to SHA256 and SHA512.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
b50754ae86 Switch from x509_CRT_PARSE to KEY_EXCHANGE_WITH_CERT_ENABLED
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
e5535e3123 Add MBEDTLS_DES_C exclusive group dependencies
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
d0786f5f26 Revert one of the changes to ssl_server2 dependencies
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
ecb630925f Fix constant name in ssl_tls13_keys
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
a2a9688501 Fix the memory allocation in test_suite_ssl
ASSERT_ALLOC calculates the size itself, and the parameter indicates number of elements.
```
mbedtls_calloc( sizeof( *( pointer ) ),  ( length ) );  
```
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
6454a90c6d Remove pre-1_2 TLS dependencies from depends.py
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
658442fe78 Remove unnecessary ECP_C dependencies
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
e5a5cc1944 Remove the dependency of tls1_3 key evolution tests on curve25519
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
daf43fbe21 Move the location of MBEDTLS_ECP_C dependencies
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
6ee1e20d7f Replace x509_CRT_PARSE_C with KEY_EXCHANGE_WITH_CERT_ENABLED
SSL programs use certificates in an exchange, so it's more natural
to have such dependency instead of just certificate parsing.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
2d637c4cbb Fix unchecked allocation in test_suite_ssl
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00
Andrzej Kurek
01af84a0ca depends.py: Add script documentation
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-19 08:35:09 -04:00