ecp.py: Set test-dependencies as attributes.
This patch enables declaring dependencie as test-class
members. ECP curve functions have been updated
to use the new capability.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
diff --git a/scripts/mbedtls_dev/bignum_common.py b/scripts/mbedtls_dev/bignum_common.py
index b942070..d8ef4a8 100644
--- a/scripts/mbedtls_dev/bignum_common.py
+++ b/scripts/mbedtls_dev/bignum_common.py
@@ -17,6 +17,7 @@
from abc import abstractmethod
import enum
from typing import Iterator, List, Tuple, TypeVar, Any
+from copy import deepcopy
from itertools import chain
from . import test_case
@@ -104,6 +105,7 @@
symbol = ""
input_values = INPUTS_DEFAULT # type: List[str]
input_cases = [] # type: List[Any]
+ dependencies = [] # type: List[Any]
unique_combinations_only = False
input_styles = ["variable", "fixed", "arch_split"] # type: List[str]
input_style = "variable" # type: str
@@ -119,10 +121,11 @@
# provides earlier/more robust input validation.
self.int_a = hex_to_int(val_a)
self.int_b = hex_to_int(val_b)
+ self.dependencies = deepcopy(self.dependencies)
if bits_in_limb not in self.limb_sizes:
raise ValueError("Invalid number of bits in limb!")
if self.input_style == "arch_split":
- self.dependencies = ["MBEDTLS_HAVE_INT{:d}".format(bits_in_limb)]
+ self.dependencies.append("MBEDTLS_HAVE_INT{:d}".format(bits_in_limb))
self.bits_in_limb = bits_in_limb
@property
diff --git a/scripts/mbedtls_dev/ecp.py b/scripts/mbedtls_dev/ecp.py
index 0f46511..d1d23c1 100644
--- a/scripts/mbedtls_dev/ecp.py
+++ b/scripts/mbedtls_dev/ecp.py
@@ -34,6 +34,7 @@
test_name = "ecp_mod_p192_raw"
input_style = "fixed"
arity = 1
+ dependencies = ["MBEDTLS_ECP_DP_SECP192R1_ENABLED"]
moduli = ["fffffffffffffffffffffffffffffffeffffffffffffffff"] # type: List[str]
@@ -109,6 +110,7 @@
test_name = "ecp_mod_p224_raw"
input_style = "arch_split"
arity = 1
+ dependencies = ["MBEDTLS_ECP_DP_SECP224R1_ENABLED"]
moduli = ["ffffffffffffffffffffffffffffffff000000000000000000000001"] # type: List[str]
@@ -185,6 +187,7 @@
test_name = "ecp_mod_p256_raw"
input_style = "fixed"
arity = 1
+ dependencies = ["MBEDTLS_ECP_DP_SECP256R1_ENABLED"]
moduli = ["ffffffff00000001000000000000000000000000ffffffffffffffffffffffff"] # type: List[str]
@@ -267,6 +270,7 @@
test_name = "ecp_mod_p384_raw"
input_style = "fixed"
arity = 1
+ dependencies = ["MBEDTLS_ECP_DP_SECP384R1_ENABLED"]
moduli = [("ffffffffffffffffffffffffffffffffffffffffffffffff"
"fffffffffffffffeffffffff0000000000000000ffffffff")
@@ -388,6 +392,7 @@
test_name = "ecp_mod_p521_raw"
input_style = "arch_split"
arity = 1
+ dependencies = ["MBEDTLS_ECP_DP_SECP521R1_ENABLED"]
moduli = [("01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")