From ae4d2cf3e3879be0fee1d3027826129776d99373 Mon Sep 17 00:00:00 2001 From: Minos Galanakis Date: Wed, 21 Dec 2022 17:34:15 +0000 Subject: [PATCH] bignum_common.py: Introduce the set_representation setter. This patch adds the default representation attribute through a setter() method in `BignumModRawConvertRep()` It also adds standard common template properties: symbol = "" input_style = "arch_split" arity = 1 Signed-off-by: Minos Galanakis --- scripts/mbedtls_dev/bignum_mod_raw.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/mbedtls_dev/bignum_mod_raw.py b/scripts/mbedtls_dev/bignum_mod_raw.py index a2336f95a6..b244e09732 100644 --- a/scripts/mbedtls_dev/bignum_mod_raw.py +++ b/scripts/mbedtls_dev/bignum_mod_raw.py @@ -113,16 +113,13 @@ class BignumModRawConvertRep(bignum_common.ModOperationCommon, # This is an abstract class, it's ok to have unimplemented methods. #pylint: disable=abstract-method """Test cases for representation conversion.""" + symbol = "" + input_style = "arch_split" arity = 1 + rep = bignum_common.ModulusRepresentation.INVALID - def __init__(self, val_n: str, val_a: str, bits_in_limb: Optional[int], - rep: bignum_common.ModulusRepresentation) -> None: - if bits_in_limb is None: - super().__init__(val_n=val_n, val_a=val_a) - else: - self.input_style = "arch_split" - super().__init__(val_n=val_n, val_a=val_a, bits_in_limb=bits_in_limb) - self.rep = rep + def set_representation(self, r: bignum_common.ModulusRepresentation) -> bool: + self.rep = r def arguments(self) -> List[str]: return ([bignum_common.quote_str(self.arg_n), self.rep.symbol(),