Commit graph

219 commits

Author SHA1 Message Date
Paul Elliott
b5d97156e4
Merge pull request #7857 from minosgalanakis/bugifx/address_curve_bits
[BigNum] test_suite_ecp: Fixed curve bit-length.
2023-08-31 13:14:11 +00:00
Minos Galanakis
2cae936107 test_suite_ecp: Moved curve bitlenth check after quasi reduction.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-08-07 16:49:22 +01:00
Minos Galanakis
831a2e6369 test_suite_ecp: Fixed curve bit-length.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-08-07 16:45:54 +01:00
Dave Rodgman
c98f8d996a
Merge branch 'development' into safer-ct5
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-07 11:47:35 +01:00
Dave Rodgman
2ec9892f24
Merge pull request #6253 from tom-cosgrove-arm/rename-assert_compare-to-test_assert_compare
Rename test macros `ASSERT_COMPARE()`, `ASSERT_ALLOC()` and `ASSERT_ALLOC_WEAK()`
2023-08-04 13:45:10 +00:00
Xiaokang Qian
d0657b0015 ecp_mod_p448 has been moved to ecp_mod_p_generic_raw, remove here
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
e25597dad7 Make ecp_mode_xxx functions depend on the new macro
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Tom Cosgrove
0540fe74e3 Fix code style
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-27 14:17:27 +01:00
Tom Cosgrove
e4e9e7da58 For tests, rename TEST_BUFFERS_EQUAL() to TEST_MEMORY_COMPARE()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:45:25 +01:00
Tom Cosgrove
05b2a87ea0 For tests, rename TEST_CALLOC_OR_FAIL() to just TEST_CALLOC()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:32:25 +01:00
Tom Cosgrove
f9ffd11e7a For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-20 16:51:21 +01:00
Tom Cosgrove
65cd8519f7 For tests, rename ASSERT_COMPARE() to TEST_BUFFERS_EQUAL()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-20 16:51:15 +01:00
Gabor Mezei
f0021d495a
Update test function dependencies
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-14 14:43:27 +02:00
Gabor Mezei
92ce4c2cbf
Fix ecp variant check
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-14 14:43:22 +02:00
Gabor Mezei
2a7bcaf8af
Use only MBEDTLS_ECP_WITH_MPI_UINT to switch between the ecp variants
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-06 10:37:51 +02:00
Gabor Mezei
c810707980
Add check for the ecp module variants
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-06-30 11:39:21 +02:00
Dave Rodgman
9fbb0cf08e Merge remote-tracking branch 'origin/development' into safer-ct5 2023-06-28 18:52:02 +01:00
Minos Galanakis
163d346355 test_suite_ecp: Changed to BITS_TO_LIMBS(224) * 2 in ecp_mod_p_generic_raw.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 21:34:47 +01:00
Minos Galanakis
23394b17bc test_suite_ecp: Updated ecp_mod_p_generic_raw to use the BITS_TO_LIMBS macro.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 16:31:59 +01:00
Dave Rodgman
b70ea9fb64 Merge remote-tracking branch 'origin/development' into safer-ct5 2023-06-20 16:12:00 +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
Minos Galanakis
effff764e1 test_suite_ecp: Updated ecp_mod_p_generic_raw for optimised reduction.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
88e16dfa2a bignum_mod: Refactored mbedtls_mpi_mod_modulus_setup()
This patch removes the `int_rep` input parameter for modular
setup, aiming to align it with the optred variant.

Test and test-suite helper functions have been updated
accordingly.

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
Dave Rodgman
855f72bb4c Fix ecp test
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-13 10:36:56 +01:00
Paul Elliott
805a0a2d06
Merge pull request #7591 from minosgalanakis/ecp/6028_xtract_fast_reduction_curve25519
[Bignum] Implement fast reduction curve25519
2023-06-01 17:43:35 +01:00
Gilles Peskine
6a88d05f96
Merge pull request #7629 from xkqian/bignum/test_read_write_named_modulu
[Bignum] Bignum/test read write named modulu
2023-06-01 10:11:10 +02:00
Manuel Pégourié-Gonnard
7b1136836c
Merge pull request #7438 from valeriosetti/issue7074
Avoid parse/unparse private ECC keys in PK with USE_PSA when !ECP_C
2023-06-01 10:06:45 +02:00
Xiaokang Qian
6824bad4fc Change coding style to fix multi lines into one line
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-31 02:19:47 +00:00
Xiaokang Qian
254f94bb43 Add test code for big endian write/read
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-29 07:46:40 +00:00
Xiaokang Qian
da5cf4896e Add intermediate variable to represent the bytes of big num
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-29 07:13:50 +00:00
Paul Elliott
981d8b6fc7
Merge pull request #7566 from paul-elliott-arm/core_ecp_mod_p448
[Bignum] Convert ecp_mod_p448 over to using core functions
2023-05-25 17:11:57 +01:00
Xiaokang Qian
ebc2478e06 Move const result to the first parameter
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-25 06:22:29 +00:00
Xiaokang Qian
b8cf6226f2 Add test function ecp_mod_random
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-25 03:14:40 +00:00
Xiaokang Qian
16a36e64d9 Add mod test functions for unit read write
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-25 03:14:40 +00:00
Janos Follath
a0aa5d8f7e
Merge pull request #7582 from xkqian/bignum/test_add_sub_named_moduli
[Bignum] Add add_sub test cases for named moduli curves
2023-05-24 14:42:24 +01:00
Xiaokang Qian
b5844e47c0 Change assert to equal base one comments
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-24 02:11:06 +00:00
Valerio Setti
e50a75f6ff test: add exception in analyze_outcomes.py and fix test for montgomery curves
The exception in analyze_outcomes.py follows previous commit in which
a test in test_suite_pkparse was set with the ECP_C guard for a different
parsing of the private key between the legacy and PSA implementations.

The wrong guard in test_suite_ecp.function instead was erroneously
added in a past commit and it was setting a non-existing symbol of
mbedTLS so those tests were basically never executed.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-23 15:12:07 +02: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
Xiaokang Qian
10b6daf755 Fix the comments of sum in ecp function
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-22 02:28:06 +00:00
Xiaokang Qian
6d02c2fefc Compare the libs of two input value and add comments
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-19 07:39:48 +00:00
Xiaokang Qian
c304e53209 Remove useless parameters for ecp_mod_add_sub
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-19 07:39:48 +00:00
Xiaokang Qian
61b0c1c3dd Refine code to align with the styles of ecp_mod_mul_inv
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-19 07:39:48 +00:00
Xiaokang Qian
5fc7846507 Add add_sub test cases for named moduli curves
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-19 07:39:48 +00:00
Xiaokang Qian
c8f677d33e Both compare the least significant limb 1 and the left limbs 0
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-18 03:41:31 +00:00
Xiaokang Qian
c1f5e54d2d Remove useless parameter iret for ecp mul_inv cases
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-18 02:02:48 +00:00
Xiaokang Qian
11dd5c0b36 Compare final result with ASSERT_COMPARE
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
c81272461e Check all of the limbs of result
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
1ae7ca435b Re-order the variable orders and rename them
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00