f8a4463bd6
Add some missing type annotations
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-12-20 19:52:49 +01:00
8a26164684
Supress pylint's duplicated code warning
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com >
2022-12-20 17:30:19 +01:00
77b877d5a7
Generate operands in Mongomery representation for the test function
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com >
2022-12-20 17:30:19 +01:00
eca74668c7
Add tests for mod_mul
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com >
2022-12-20 17:30:19 +01:00
e162b4725c
Merge pull request #6777 from tom-cosgrove-arm/issue-6292-mod_inv
...
Bignum: Implement high level fixed width modular inversion
2022-12-17 13:26:02 +01:00
f723754f6d
Fix typos
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-16 16:10:36 +00:00
b31b2e62ec
Generate operands in Mongomery representation for the test function
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com >
2022-12-16 14:27:48 +01:00
1133d2325b
Attempt to pacify pylint in bignum tests
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-16 03:53:17 +00:00
dc19759327
Add tests for mbedtls_mpi_mod_inv()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-15 16:59:40 +00:00
dbac60924b
mbedtls_mpi_mod_raw_inv_prime() tests should be arch_split
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-15 16:56:36 +00:00
30f3b4d601
Add mbedtls_mpi_core_check_zero_ct() and tests
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-15 16:56:36 +00:00
80a334ada3
Add generated tests for mod_raw_mul
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com >
2022-12-15 15:04:20 +01:00
9fa4897839
Merge pull request #6772 from wernerlewis/bignum_refactor_sub
...
Bignum: Refactor mpi_core_sub tests to use arch_split
2022-12-15 12:32:44 +01:00
50faa55e4d
Merge pull request #6732 from wernerlewis/bignum_6019_mod_add
...
Bignum: Implement mbedtls_mpi_mod_add()
2022-12-15 11:39:24 +01:00
48232ed2c1
Merge pull request #6743 from minosgalanakis/bignum/implement_modular_negation
...
Bignum: Implement fixed width modular negation
2022-12-13 09:54:38 +01:00
91a2aabb86
Refactor mpi_core_sub tests to use arch_split
...
Tests are refactored to generate separate cases for 32-bit and 64-bit
limbs using arch_split. Duplicate arguments and branching in the test
function is removed.
Signed-off-by: Werner Lewis <werner.lewis@arm.com >
2022-12-12 17:18:43 +00:00
f3abea6641
bignum_mod_raw.py: Changed the symbol for modular negation to "-".
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2022-12-12 11:13:56 +00:00
78665eba8f
bignum_mod_raw.py: Added BignumModRawModNegate.
...
This patch adds autogenerated inputs for the
`mpi_mod_raw_neg()` test in the bignum_mod_raw suite.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2022-12-12 11:13:56 +00:00
9d8afd1ccf
Have BignumModRawInvPrime() do Montgomery conversion in arg_a()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-09 10:58:46 +00:00
6129268fee
Bignum: Implement mbedtls_mpi_mod_raw_inv_prime() and tests
...
Fixes #6023 .
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-08 09:44:10 +00:00
1d26d976e8
Merge pull request #6731 from tom-cosgrove-arm/issue-6293-mod_exp
...
Require input to mbedtls_mpi_core_exp_mod() to already be in Montgomery form
2022-12-07 08:31:49 +00:00
92011eef34
Merge pull request #6717 from tom-cosgrove-arm/fix-typos-2212
...
Fix typos prior to release
2022-12-06 15:00:34 +00:00
21d459d26a
Add type annotations
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-06 12:36:00 +00:00
c240600f24
Separate out to_montgomery and from_montgomery for bignum tests
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-06 12:20:43 +00:00
93a31c9efd
Re-enable pylint unused warnings
...
Signed-off-by: Werner Lewis <werner.lewis@arm.com >
2022-12-06 11:55:32 +00:00
e1b6b7c0ac
Implement mbedtls_mpi_mod_add()
...
Signed-off-by: Werner Lewis <werner.lewis@arm.com >
2022-12-06 11:55:32 +00:00
ecda186893
Require input to mbedtls_mpi_core_exp_mod() to already be in Montgomery form
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-06 10:46:30 +00:00
f51f972d67
Apply review comments
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-05 15:47:40 +00:00
1797b05602
Fix typos prior to release
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-04 17:19:59 +00:00
62b20488f1
Implement mbedtls_mpi_mod_sub()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-12-01 14:27:37 +00:00
cff7578822
Add imports to bignum_mod
...
Signed-off-by: Werner Lewis <werner.lewis@arm.com >
2022-11-30 16:34:07 +00:00
edaa17b350
Merge pull request #6547 from yanesca/extract_mod_exp_from_prototype
...
Bignum: Extract mod exp from prototype
2022-11-29 21:40:07 +01:00
590ae5363d
Merge pull request #6656 from tom-cosgrove-arm/bignum_pr_6225-updated
...
Bignum: add mod_raw_add
2022-11-25 17:53:31 +00:00
50fc127a4e
Change order of test arguments for bignum_mod_raw to simplify Python script
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-11-24 21:29:23 +00:00
1923009cdb
Add test generation for mbedtls_mpi_mod_raw_add()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-11-24 16:22:43 +00:00
6b3c0c5943
Update the test case generator
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com >
2022-11-23 16:45:05 +01:00
c426d9b6cc
Add generated test for low level subtraction with modulus
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com >
2022-11-23 14:44:13 +01:00
43d3de4977
Make pylint happy
...
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-22 21:50:22 +00:00
05867cb036
mpi_core_exp_mod: add generated tests
...
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-22 21:37:10 +00:00
d66d5b2fef
Add unit tests for mbedtls_mpi_core_sub_int(), MPI A - scalar b
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2022-11-22 15:07:31 +00:00
f352c67bc3
Bignum tests: use default dataset in mod_raw
...
While at it, flatten class hierarchy as well.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:15 +00:00
f45797652f
Bignum tests: set unique combinations off by default
...
Normally we need all the combinations, unique combinations make sense
only if the operation is commutative.
No changes to generated tests.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
76c21bd242
Bignum tests: flatten class hierarchy in _core
...
There is no semantic changes to the generated tests, the order of the
test blocks has changed.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
be5e7aea7c
Bignum tests: remove deprecated dataset
...
Remove old dataset that was overriding the defaults in bignum_core. This
will change the datasets for core_sub and core_add to the default
inherited from bignum_common.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
dac44e6021
Bignum tests: add default datasets
...
Add data for small values, 192 bit and 1024 bit values, primes,
non-primes odd, even, and some typical corner cases.
All subclasses override this for the time being so there are no changes
to the test cases.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
b2a850c746
Bignum Tests: add test data
...
The goal of this commit is to add some constants that can be used to
define datasets and add test data in a more readable and reusable
manner.
All platforms using ECC need to support calculations with at least 192
bits, therefore constants for this length are added. We are not using a
curve prime as those will be tested elsewhere and it is better not to
play favourites.
All platforms using RSA or FFDH need to support calculations with at
least 1024 bits, therefore numbers of this size are added too.
A safe prime is added for both sizes as it makes all elements generators
(except 0 and 1 of course), which in turn makes some tests more
effective.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
a36e430251
Bignum tests: add support for fixed width input
...
Only fixed width input_style uses the default value of the bits_in_limb
parameter, so set it to 32 in order to have less leading zeroes.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
8ae7a657ac
Bignum tests: improve mod descriptions
...
There are no semantic changes to the generated tests.
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
284672ccfb
Bignum tests: complete support for unary operators
...
There are no intended changes to generated tests. (The ordering of tests
in the mod_raw module has changed.)
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00
435b305a49
Bignum tests: add special cases to mod
...
Signed-off-by: Janos Follath <janos.follath@arm.com >
2022-11-21 08:56:14 +00:00