Separate out to_montgomery and from_montgomery for bignum tests

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove 2022-12-06 12:20:43 +00:00
parent ecda186893
commit c240600f24
3 changed files with 11 additions and 6 deletions

View file

@ -92,10 +92,9 @@ class BignumModRawConvertToMont(bignum_common.ModOperationCommon,
arity = 1
def result(self) -> List[str]:
result = (self.int_a * self.r) % self.int_n
result = self.to_montgomery(self.int_a)
return [self.format_result(result)]
class BignumModRawConvertFromMont(bignum_common.ModOperationCommon,
BignumModRawTarget):
""" Test cases for mpi_mod_raw_from_mont_rep(). """
@ -106,7 +105,7 @@ class BignumModRawConvertFromMont(bignum_common.ModOperationCommon,
arity = 1
def result(self) -> List[str]:
result = (self.int_a * self.r_inv) % self.int_n
result = self.from_montgomery(self.int_a)
return [self.format_result(result)]