Commit graph

335 commits

Author SHA1 Message Date
Yanray Wang
15b1358f22 logging_util: rename argument
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:48:12 +08:00
Yanray Wang
21127f7095 code_size_compare: add logging module and tweak prompt message
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:12 +08:00
Minos Galanakis
dae4c038f8 ecp.py: Extended EcpP224K1Raw tests for 32/64 bit architectures.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 18:54:53 +01:00
Minos Galanakis
80c4ae893c bignum_common.py: Added bits_to_limbs method.
This patch introduces a rounding-error-resiliant method to
calculate bits_to_limbs, and is updating `SECP224R1` and
`SECP224K1` to use it.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 16:38:22 +01:00
Minos Galanakis
450abfd922 test_suite_ecp: Added MBEDTLS_ECP_NIST_OPTIM define guards.
This patch updates `ecp_mod_p_generic_raw` and corresponding
curve test methods, that depend on the NIST optimisation
parameter to not run when it is not included.

The following curves are affected:
* SECP192R1
* SECP224R1
* SECP256R1
* SECP384R1
* SECP521R1

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Paul Elliott
a2e48f751b Split out mbedtls_ecp_mod_p448_raw()
Switch testing over to using the generic raw functions.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-15 17:16:38 +01:00
Paul Elliott
b4df176610
Merge pull request #7637 from paul-elliott-arm/fixed_ecp_mod_p448
[Bignum] Fixed width for ecp mod p448
2023-06-15 17:12:02 +01:00
Paul Elliott
b727042501 Move corner test case into python framework
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-13 17:42:01 +01:00
Minos Galanakis
2daa374ea8 ecp_curves: Minor refactoring of mbedtls_ecp_mod_p255_raw()
* Fixed whitespace issues.
* Renamed variables to align with bignum conventions.
* Updated alignment on test input data.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
aada68f1be ecp.py: Fixed types for arguments() overrides.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
c2c967b1f0 ecp.py: Added tests for mbedtls_ecp_mod_p255_raw
This patch introduces the `EcpP255Raw` test class for testing
the curve using the preestablished `ecp_mod_p_generic_raw()`
test. The test's logic has been updated accordingly.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Paul Elliott
26070670d6
Merge pull request #7565 from gabor-mezei-arm/7263_split_out_Koblitz_raw_functions
[Bignum] Split out _raw Koblitz reduction functions
2023-05-22 16:03:17 +01:00
Paul Elliott
f0806bee66
Merge pull request #7489 from minosgalanakis/ecp/7246_xtrack_core_shift_l
[Bignum]: Introduce left shift from prototype
2023-05-16 17:13:19 +01:00
Gabor Mezei
03558b847e
Add _raw function to P256K1
Modified the testing to use the generic fast reduction test function.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:30:03 +02:00
Gabor Mezei
e42bb6294e
Add _raw function to P224K1
Modified the testing to use the generic fast reduction test function.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:30:03 +02:00
Gabor Mezei
dacfe56370
Add _raw function to P192K1
Modified the testing to use the generic fast reduction test function.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:29:57 +02:00
Minos Galanakis
99453ad9f0 bignum_core.py: Simplified result calculation for BignumCoreShiftL
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-16 15:28:19 +01:00
Gabor Mezei
23b10109bb
Add test cases to test overflow in the Kobltz reduction
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-12 12:34:12 +02:00
Minos Galanakis
013167ed7f bignum_common.py: Addressed minor typos
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-11 10:54:44 +01:00
Paul Elliott
481a6a8edb
Merge pull request #7482 from gabor-mezei-arm/6029_use_core_api_in_ecp_mod_koblitz
[Bignum] Use core API in ecp_mod_koblitz()
2023-05-10 17:24:46 +01:00
Gabor Mezei
9bf1aaf385
Fix input parameter alignment in P256K1 test cases
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-05 16:32:28 +02:00
Paul Elliott
b8bd47dd68 Remove unrequired limb size calculation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-03 14:16:54 +01:00
Paul Elliott
b7fd1d6044 Correct max canonical multiplication result
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-03 14:16:48 +01:00
Paul Elliott
16648be171 Add Curve 448 tests
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-04-26 22:23:27 +01:00
Minos Galanakis
c787cf73b3 bignum_core.py: Add "BignumCoreShiftL()"
This patch introduces automatic test input generation for
`mpi_core_shift_l()` function.

It also adds two utility functions in bignum_common.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-26 17:04:20 +01:00
Minos Galanakis
d6751dcd8b ecp_curves: Added unit-tests for secp256k1
This patch introduces basic unit-testing for the `ecp_mod_p256k1()`.

The method is exposed through the ecp_invasive interface, and
the standard testing data is being provided by the python framework.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-25 13:30:59 +01:00
Minos Galanakis
e5dab975c6 ecp_curves: Added unit-tests for secp224k1
This patch introduces basic unit-testing for the `ecp_mod_p224k1()`.

The method is exposed through the ecp_invasive interface, and
the standard testing data is being provided by the python framework.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-18 14:13:20 +01:00
Gabor Mezei
cec506083b
Fix test case dependency
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-17 14:56:03 +02:00
Gabor Mezei
bda7f87e2a
Add dependency for P192K1 tests
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-13 13:11:05 +02:00
Gabor Mezei
b86ead3cb2
Add generated tests for ecp_mod_p192k1
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-13 12:47:59 +02:00
Minos Galanakis
0a325b6767 ecp.py: Set test-dependencies as attributes.
This patch enables declaring dependencie as test-class
members. ECP curve functions have been updated
to use the new capability.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-06 16:33:10 +01:00
Minos Galanakis
1358648f77 test_suite_ecp: Introduced ecp_mod_p_generic_raw
This patch replaces similiarly structured test functions
for:

* MBEDTLS_ECP_DP_SECP192R1
* MBEDTLS_ECP_DP_SECP224R1
* MBEDTLS_ECP_DP_SECP256R1
* MBEDTLS_ECP_DP_SECP384R1
* MBEDTLS_ECP_DP_BP512R1R1

with a more generic version, which adjusts the parameters, based on the `curve_id` field,
provided by the testing data.

The python test framework has been updated to provide that extra field.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-06 16:27:12 +01:00
Janos Follath
44c6694be7
Merge pull request #7351 from gabor-mezei-arm/7109_ecp_fast_reduction_testing
Test unlikely cases of ECC modular reduction
2023-04-06 15:55:19 +01:00
Minos Galanakis
00bd8925a7 bignum: Removed merge scaffolding.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-05 16:13:11 +01:00
Gabor Mezei
b0f013784f
Multplication is simmetric so only generate unique combinations
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-03 17:26:44 +02:00
Gabor Mezei
87223ab1ce
Add generated test for core_mul
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-31 16:17:06 +02:00
Gabor Mezei
5ded38e0e1
Fix 0 limb size for value 0
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-31 16:17:06 +02:00
Gabor Mezei
d8c0e1aa8d
Fix comments
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:34:49 +02:00
Gabor Mezei
c33a36b5df
Typo: reorder testing classes
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:32:47 +02:00
Gabor Mezei
a8d0da3880
Add test cases for P256 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:31:05 +02:00
Gabor Mezei
54ad647e8d
Add test cases for P384 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:30:32 +02:00
Gabor Mezei
fede276392
Typo: reformat numbers
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:29:40 +02:00
Gabor Mezei
a9a68728b3
Add test cases for P521 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:09:35 +02:00
Gabor Mezei
64a229f6ac
Add test cases for P224 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:09:35 +02:00
Gabor Mezei
62adc726d0
Add test cases for P192 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:09:35 +02:00
Minos Galanakis
4af90bbcda EcpP384R1Raw: Added test case for 2nd round of carry reduction.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-21 15:46:51 +00:00
Minos Galanakis
37f4cb6d0e ecp_curves: Minor rework for p384
This patch adjusts formatting, documentation and testing.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-21 15:46:50 +00:00
Minos Galanakis
f359c91f9b ecp test generator: Added EcpPp384R1Raw().
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-21 15:45:18 +00:00
Gabor Mezei
fffd6d9ded
Fix maximum cannonical value
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-09 13:43:15 +01:00
Gabor Mezei
e4710ae9ed
Add and fix comments
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-09 13:43:02 +01:00