Paul Elliott
3646dc78bc
Fix coding style issue
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 08:51:08 +01:00
Paul Elliott
436f2ad37c
Three round solution
...
Attempt to fix failing test by dealing with overflow with three rounds,
instead of previous subtract modulus solution. Also optimise out shifts
by using memcpy / memmove instead. Remove final sub to return canonical
result, as this is not required here.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-13 17:39:44 +01:00
Xiaokang Qian
fcdd0477b3
Replace loop zeroise with memset
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-06-08 10:03:53 +00:00
Janos Follath
035e5fc885
Add comments to 448 optimised reduction
...
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-06-08 09:44:30 +00:00
Paul Elliott
edc97680d5
Fix output width of mbedtls_ecp_mod_p448() to 448 bits
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-25 17:37:58 +01: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
Paul Elliott
7050662a48
Correct comment header block
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-24 17:31:57 +01:00
Paul Elliott
3b6bf105d1
Fix missed renames from N to X
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-23 17:51:52 +01:00
Gabor Mezei
d56e6e008b
Add input parameter length check for the Koblitz reduction
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-17 17:51:19 +02:00
Paul Elliott
c05f51ded9
Convert comments over to X rather than N
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-17 14:29:44 +01:00
Paul Elliott
6b1f7f101f
Use const where appropriate
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-16 17:51:48 +01:00
Paul Elliott
235c1947fb
Group memory allocations earlier
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-16 17:51:48 +01:00
Paul Elliott
34b08e5005
Convert over to using X, X_limbs
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-16 17:51:48 +01:00
Paul Elliott
4fa8334bae
Convert curve 448 to use ecp core functions
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-16 17:51:48 +01:00
Gabor Mezei
caac83c517
Fix comment
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:41:26 +02: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
Gabor Mezei
a274041190
Fix comment
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-15 14:50:17 +02:00
Gabor Mezei
b6653f3e27
Update comments
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-12 12:34:12 +02:00
Gabor Mezei
dcaf99ebb8
Add another round in the Koblitz reduction
...
The addition can result in an overflow so another round is needed
in the reduction.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-12 12:34:05 +02: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
908f40014c
Determine special cases in-place in the common Koblitz function
...
Remove parameter used by the special cases and check for special cases in-place.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-05 16:31:19 +02:00
Paul Elliott
47a3c82118
Enable curve 448 to be tested
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-04-26 22:23:13 +01:00
Gabor Mezei
19c6f47dbc
Allocate the right amount of memory
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-26 15:22:11 +02:00
Gabor Mezei
fead53311b
Remove unused macro
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-26 15:20:01 +02:00
Gabor Mezei
03367fe42d
Ignore carry since it can not be generated
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-26 14:08:45 +02:00
Gabor Mezei
d2c0ba172c
Fix value in comment
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-26 14:08:44 +02:00
Gabor Mezei
7097447b84
Ensure input parameter size for Koblitz reduction
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-26 14:08:35 +02:00
Gabor Mezei
8183c5dcc3
Use core API in ecp_mod_koblitz()
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-26 14:03:29 +02:00
Janos Follath
91a618375a
Merge pull request #7427 from minosgalanakis/ecp/7258_ecp_mod_p256K1_add_test_cases
...
ECP: Add Unit Tests for secp256k1
2023-04-26 08:52:24 +01:00
Minos Galanakis
9c2c81f996
ecp_curves: Renamed ecp_mod_p256k1
-> mbedtls_ecp_mod_p256k1
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-25 13:30:59 +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
Gabor Mezei
f921f4d228
Use loop for two passes in the reduction
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-21 14:09:06 +02:00
Minos Galanakis
9d80879f90
ecp_curves: Introduced mbedtls_ecp_mod_p224k1()
...
This patch introduces a `MBEDTLS_STATIC_TESTABLE` helper
method which exposes `ecp_mod_p256k1()` to the test-framework
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-18 14:13:20 +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
Janos Follath
3c3b94a31b
Merge pull request #7424 from gabor-mezei-arm/7256_unit_tests_for_p192k1
...
Add unit tests for ecp_mod_p192k1()
2023-04-18 12:19:40 +01:00
Gabor Mezei
0a11ee6da8
Fix function declaration
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-13 12:48:06 +02:00
Gabor Mezei
83669d910e
Add a testable function for ecp_mod_p192k1
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-13 12:44:37 +02:00
Valerio Setti
d4a5d461de
library: add remaining changes for the new ECP_LIGHT symbol
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-11 11:33:50 +02: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
Gabor Mezei
df9c029dd5
Remove obsolete ecp_fix_negative function
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 18:43:07 +02:00
Gabor Mezei
514806bbe9
Add a second round of carry reduction for P192 fast reduction
...
The first round of carry reduction can generate a carry so a
second round is needed.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:09:34 +02:00
Minos Galanakis
68d64a10b6
ecp_curves: Re-introduced mbedtls_ecp_fix_negative()
...
This patch re-introduces `mbedtls_ecp_fix_negative` and
appropriately adjusts its' define guards.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-22 11:28:15 +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
6fb105fb2e
ecp_curves: Ported prototypes
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-21 15:41:26 +00:00
Janos Follath
c18cd0c8e6
Merge pull request #7230 from gabor-mezei-arm/6850_Secp256r1_fast_reduction
...
Extract Secp256r1 fast reduction from the prototype
2023-03-16 19:43:25 +00: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
Gabor Mezei
716447ff32
Fix limb size calculation
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-08 14:09:51 +01:00
Gabor Mezei
ed1acf642c
Apply naming conventions
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-08 14:09:50 +01:00