mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
test_suite_ecp: Introduced ecp_mod_p_generic_raw
This patch replaces similiarly structured test functions for: * MBEDTLS_ECP_DP_SECP192R1 * MBEDTLS_ECP_DP_SECP224R1 * MBEDTLS_ECP_DP_SECP256R1 * MBEDTLS_ECP_DP_SECP384R1 * MBEDTLS_ECP_DP_BP512R1R1 with a more generic version, which adjusts the parameters, based on the `curve_id` field, provided by the testing data. The python test framework has been updated to provide that extra field. Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
@ -30,7 +30,7 @@ class EcpP192R1Raw(bignum_common.ModOperationCommon,
|
||||
EcpTarget):
|
||||
"""Test cases for ECP P192 fast reduction."""
|
||||
symbol = "-"
|
||||
test_function = "ecp_mod_p192_raw"
|
||||
test_function = "ecp_mod_p_generic_raw"
|
||||
test_name = "ecp_mod_p192_raw"
|
||||
input_style = "fixed"
|
||||
arity = 1
|
||||
@ -96,12 +96,16 @@ class EcpP192R1Raw(bignum_common.ModOperationCommon,
|
||||
def is_valid(self) -> bool:
|
||||
return True
|
||||
|
||||
def arguments(self):
|
||||
args = super().arguments()
|
||||
return ["MBEDTLS_ECP_DP_SECP192R1"] + args
|
||||
|
||||
|
||||
class EcpP224R1Raw(bignum_common.ModOperationCommon,
|
||||
EcpTarget):
|
||||
"""Test cases for ECP P224 fast reduction."""
|
||||
symbol = "-"
|
||||
test_function = "ecp_mod_p224_raw"
|
||||
test_function = "ecp_mod_p_generic_raw"
|
||||
test_name = "ecp_mod_p224_raw"
|
||||
input_style = "arch_split"
|
||||
arity = 1
|
||||
@ -168,12 +172,16 @@ class EcpP224R1Raw(bignum_common.ModOperationCommon,
|
||||
def is_valid(self) -> bool:
|
||||
return True
|
||||
|
||||
def arguments(self):
|
||||
args = super().arguments()
|
||||
return ["MBEDTLS_ECP_DP_SECP224R1"] + args
|
||||
|
||||
|
||||
class EcpP256R1Raw(bignum_common.ModOperationCommon,
|
||||
EcpTarget):
|
||||
"""Test cases for ECP P256 fast reduction."""
|
||||
symbol = "-"
|
||||
test_function = "ecp_mod_p256_raw"
|
||||
test_function = "ecp_mod_p_generic_raw"
|
||||
test_name = "ecp_mod_p256_raw"
|
||||
input_style = "fixed"
|
||||
arity = 1
|
||||
@ -247,11 +255,15 @@ class EcpP256R1Raw(bignum_common.ModOperationCommon,
|
||||
def is_valid(self) -> bool:
|
||||
return True
|
||||
|
||||
def arguments(self):
|
||||
args = super().arguments()
|
||||
return ["MBEDTLS_ECP_DP_SECP256R1"] + args
|
||||
|
||||
|
||||
class EcpP384R1Raw(bignum_common.ModOperationCommon,
|
||||
EcpTarget):
|
||||
"""Test cases for ECP P384 fast reduction."""
|
||||
test_function = "ecp_mod_p384_raw"
|
||||
test_function = "ecp_mod_p_generic_raw"
|
||||
test_name = "ecp_mod_p384_raw"
|
||||
input_style = "fixed"
|
||||
arity = 1
|
||||
@ -364,10 +376,15 @@ class EcpP384R1Raw(bignum_common.ModOperationCommon,
|
||||
def is_valid(self) -> bool:
|
||||
return True
|
||||
|
||||
def arguments(self):
|
||||
args = super().arguments()
|
||||
return ["MBEDTLS_ECP_DP_SECP384R1"] + args
|
||||
|
||||
|
||||
class EcpP521R1Raw(bignum_common.ModOperationCommon,
|
||||
EcpTarget):
|
||||
"""Test cases for ECP P521 fast reduction."""
|
||||
test_function = "ecp_mod_p521_raw"
|
||||
test_function = "ecp_mod_p_generic_raw"
|
||||
test_name = "ecp_mod_p521_raw"
|
||||
input_style = "arch_split"
|
||||
arity = 1
|
||||
@ -462,3 +479,7 @@ class EcpP521R1Raw(bignum_common.ModOperationCommon,
|
||||
@property
|
||||
def is_valid(self) -> bool:
|
||||
return True
|
||||
|
||||
def arguments(self):
|
||||
args = super().arguments()
|
||||
return ["MBEDTLS_ECP_DP_SECP521R1"] + args
|
||||
|
Reference in New Issue
Block a user