Fix representation conversion with 32-bit limbs

The Montgomery representation depends on the limb size. So the
representation conversion test cases need separate 64-bit and 32-bit cases
when the representation is Montgomery.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/scripts/mbedtls_dev/bignum_mod_raw.py b/scripts/mbedtls_dev/bignum_mod_raw.py
index 800bcb1..e108fe3 100644
--- a/scripts/mbedtls_dev/bignum_mod_raw.py
+++ b/scripts/mbedtls_dev/bignum_mod_raw.py
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from typing import Dict, Iterator, List
+from typing import Iterator, List, Optional, Union
 
 from . import test_case
 from . import test_data_generation
@@ -115,9 +115,13 @@
     """Test cases for representation conversion."""
     arity = 1
 
-    def __init__(self, val_n: str, val_a: str,
+    def __init__(self, val_n: str, val_a: str, bits_in_limb: Optional[int],
                  rep: bignum_common.ModulusRepresentation) -> None:
-        super().__init__(val_n=val_n, val_a=val_a)
+        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 arguments(self) -> List[str]:
@@ -125,16 +129,26 @@
                  bignum_common.quote_str(self.arg_a)] +
                 self.result())
 
+    def description(self) -> str:
+        base = super().description()
+        mod_with_rep = 'mod({})'.format(self.rep.name)
+        return base.replace('mod', mod_with_rep, 1)
+
     @classmethod
     def generate_function_tests(cls) -> Iterator[test_case.TestCase]:
         representations = \
             bignum_common.ModulusRepresentation.supported_representations()
         for rep in representations:
+            if rep is bignum_common.ModulusRepresentation.MONTGOMERY:
+                limb_sizes = cls.limb_sizes #type: Union[List[int], List[None]]
+            else:
+                limb_sizes = [None] # no dependency on limb size
             for n in cls.moduli:
                 for a in cls.input_values:
-                    test_object = cls(n, a, rep)
-                    if test_object.is_valid:
-                        yield test_object.create_test_case()
+                    for bil in limb_sizes:
+                        test_object = cls(n, a, bil, rep)
+                        if test_object.is_valid:
+                            yield test_object.create_test_case()
 
 class BignumModRawCanonicalToModulusRep(BignumModRawConvertRep):
     """Test cases for mpi_mod_raw_canonical_to_modulus_rep."""