1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Implement mbedtls_mpi_mod_sub()

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove
2022-12-01 14:27:37 +00:00
parent c3902ac661
commit 62b20488f1
5 changed files with 218 additions and 1 deletions

View File

@ -34,6 +34,25 @@ class BignumModTarget(test_data_generation.BaseTarget):
# BEGIN MERGE SLOT 3
class BignumModSub(bignum_common.ModOperationCommon, BignumModTarget):
"""Test cases for bignum mpi_mod_sub()."""
symbol = "-"
test_function = "mpi_mod_sub"
test_name = "mbedtls_mpi_mod_sub"
input_style = "fixed"
arity = 2
# To make negative tests easier, append 0 for success to the generated cases
def arguments(self) -> List[str]:
return [bignum_common.quote_str(n) for n in [self.arg_n,
self.arg_a,
self.arg_b]
] + self.result() + ["0"]
def result(self) -> List[str]:
result = (self.int_a - self.int_b) % self.int_n
return [self.format_result(result)]
# END MERGE SLOT 3
# BEGIN MERGE SLOT 4