ad335b55ff
Fix representation conversion with 32-bit limbs
...
The Montgomery representation depends on the limb size. So the
representation conversion test cases need separate 64-bit and 32-bit cases
when the representation is Montgomery.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-12-20 22:39:15 +01:00
be69c7d559
Generate test cases for mpi_mod_raw_modulus_to_canonical_rep as well
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-12-20 20:28:02 +01:00
23636aca98
Generate test cases for mpi_mod_raw_canonical_to_modulus_rep
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-12-20 19:55:51 +01:00
7a708fd49f
Helpers for generating representation-aware test cases
...
Add a class for modulus representations (mbedtls_mpi_mod_rep_selector).
Add a method to convert a number to any representation.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-12-20 19:52:49 +01:00
5623ecc2d6
Mod operations: fill arguments to the width of the modulus
...
With the default input style (which is "variable"), fill all bignum test
case arguments to the same width as the modulus.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-12-20 19:52:49 +01:00
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