Have BignumModRawInvPrime() do Montgomery conversion in arg_a()

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove 2022-12-09 10:58:46 +00:00
parent 5f09930017
commit 9d8afd1ccf

View file

@ -69,13 +69,11 @@ class BignumModRawInvPrime(bignum_common.ModOperationCommon,
def is_valid(self) -> bool:
return self.int_a > 0 and self.int_a < self.int_n
def arguments(self) -> List[str]:
@property
def arg_a(self) -> str:
# Input has to be given in Montgomery form
mont_a = self.to_montgomery(self.int_a)
arg_mont_a = self.format_arg('{:x}'.format(mont_a))
return [bignum_common.quote_str(n) for n in [self.arg_n,
arg_mont_a]
] + self.result()
return self.format_arg('{:x}'.format(mont_a))
def result(self) -> List[str]:
result = bignum_common.invmod(self.int_a, self.int_n)