Have BignumModRawInvPrime() do Montgomery conversion in arg_a()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
parent
5f09930017
commit
9d8afd1ccf
1 changed files with 3 additions and 5 deletions
|
@ -69,13 +69,11 @@ class BignumModRawInvPrime(bignum_common.ModOperationCommon,
|
||||||
def is_valid(self) -> bool:
|
def is_valid(self) -> bool:
|
||||||
return self.int_a > 0 and self.int_a < self.int_n
|
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
|
# Input has to be given in Montgomery form
|
||||||
mont_a = self.to_montgomery(self.int_a)
|
mont_a = self.to_montgomery(self.int_a)
|
||||||
arg_mont_a = self.format_arg('{:x}'.format(mont_a))
|
return self.format_arg('{:x}'.format(mont_a))
|
||||||
return [bignum_common.quote_str(n) for n in [self.arg_n,
|
|
||||||
arg_mont_a]
|
|
||||||
] + self.result()
|
|
||||||
|
|
||||||
def result(self) -> List[str]:
|
def result(self) -> List[str]:
|
||||||
result = bignum_common.invmod(self.int_a, self.int_n)
|
result = bignum_common.invmod(self.int_a, self.int_n)
|
||||||
|
|
Loading…
Reference in a new issue