From 9d8afd1ccfe378316dcd8629d7f29abf24f4e06c Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Fri, 9 Dec 2022 10:58:46 +0000 Subject: [PATCH] Have BignumModRawInvPrime() do Montgomery conversion in arg_a() Signed-off-by: Tom Cosgrove --- scripts/mbedtls_dev/bignum_mod_raw.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/mbedtls_dev/bignum_mod_raw.py b/scripts/mbedtls_dev/bignum_mod_raw.py index 1a23a60ea..048642667 100644 --- a/scripts/mbedtls_dev/bignum_mod_raw.py +++ b/scripts/mbedtls_dev/bignum_mod_raw.py @@ -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)