mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-05-11 01:11:42 +08:00
Typo: reorder testing classes
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
parent
a8d0da3880
commit
c33a36b5df
@ -169,6 +169,85 @@ class EcpP224R1Raw(bignum_common.ModOperationCommon,
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class EcpP256R1Raw(bignum_common.ModOperationCommon,
|
||||||
|
EcpTarget):
|
||||||
|
"""Test cases for ECP P256 fast reduction."""
|
||||||
|
symbol = "-"
|
||||||
|
test_function = "ecp_mod_p256_raw"
|
||||||
|
test_name = "ecp_mod_p256_raw"
|
||||||
|
input_style = "fixed"
|
||||||
|
arity = 1
|
||||||
|
|
||||||
|
moduli = ["ffffffff00000001000000000000000000000000ffffffffffffffffffffffff"] # type: List[str]
|
||||||
|
|
||||||
|
input_values = [
|
||||||
|
"0", "1",
|
||||||
|
|
||||||
|
# Modulus - 1
|
||||||
|
"ffffffff00000001000000000000000000000000fffffffffffffffffffffffe",
|
||||||
|
|
||||||
|
# Modulus + 1
|
||||||
|
"ffffffff00000001000000000000000000000001000000000000000000000000",
|
||||||
|
|
||||||
|
# 2^256 - 1
|
||||||
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
|
|
||||||
|
# Maximum canonical P256 multiplication result
|
||||||
|
("fffffffe00000002fffffffe0000000100000001fffffffe00000001fffffffc"
|
||||||
|
"00000003fffffffcfffffffffffffffffffffffc000000000000000000000004"),
|
||||||
|
|
||||||
|
# Generate an overflow during reduction
|
||||||
|
("0000000000000000000000010000000000000000000000000000000000000000"
|
||||||
|
"00000000000000000000000000000000000000000000000000000000ffffffff"),
|
||||||
|
|
||||||
|
# Generate an underflow during reduction
|
||||||
|
("0000000000000000000000000000000000000000000000000000000000000010"
|
||||||
|
"ffffffff00000000000000000000000000000000000000000000000000000000"),
|
||||||
|
|
||||||
|
# Generate an overflow during carry reduction
|
||||||
|
("aaaaaaaa00000000000000000000000000000000000000000000000000000000"
|
||||||
|
"00000000000000000000000000000000aaaaaaacaaaaaaaaaaaaaaaa00000000"),
|
||||||
|
|
||||||
|
# Generate an underflow during carry reduction
|
||||||
|
("000000000000000000000001ffffffff00000000000000000000000000000000"
|
||||||
|
"0000000000000000000000000000000000000002000000020000000100000002"),
|
||||||
|
|
||||||
|
# First 8 number generated by random.getrandbits(512) - seed(2,2)
|
||||||
|
("4067c3584ee207f8da94e3e8ab73738fcf1822ffbc6887782b491044d5e34124"
|
||||||
|
"5c6e433715ba2bdd177219d30e7a269fd95bafc8f2a4d27bdcf4bb99f4bea973"),
|
||||||
|
("82523e86feac7eb7dc38f519b91751dacdbd47d364be8049a372db8f6e405d93"
|
||||||
|
"ffed9235288bc781ae66267594c9c9500925e4749b575bd13653f8dd9b1f282e"),
|
||||||
|
("e8624fab5186ee32ee8d7ee9770348a05d300cb90706a045defc044a09325626"
|
||||||
|
"e6b58de744ab6cce80877b6f71e1f6d2ef8acd128b4f2fc15f3f57ebf30b94fa"),
|
||||||
|
("829a48d422fe99a22c70501e533c91352d3d854e061b90303b08c6e33c729578"
|
||||||
|
"2d6c797f8f7d9b782a1be9cd8697bbd0e2520e33e44c50556c71c4a66148a86f"),
|
||||||
|
("e89204e2e8168561867e5e15bc01bfce6a27e0dfcbf8754472154e76e4c11ab2"
|
||||||
|
"fec3f6b32e8d4b8a8f54f8ceacaab39e83844b40ffa9b9f15c14bc4a829e07b0"),
|
||||||
|
("bd143fa9b714210c665d7435c1066932f4767f26294365b2721dea3bf63f23d0"
|
||||||
|
"dbe53fcafb2147df5ca495fa5a91c89b97eeab64ca2ce6bc5d3fd983c34c769f"),
|
||||||
|
("74667bffe202849da9643a295a9ac6decbd4d3e2d4dec9ef83f0be4e80371eb9"
|
||||||
|
"7f81375eecc1cb6347733e847d718d733ff98ff387c56473a7a83ee0761ebfd2"),
|
||||||
|
("d08f1bb2531d6460f0caeef038c89b38a8acb5137c9260dc74e088a9b9492f25"
|
||||||
|
"8ebdbfe3eb9ac688b9d39cca91551e8259cc60b17604e4b4e73695c3e652c71a"),
|
||||||
|
|
||||||
|
# Next 2 number generated by random.getrandbits(256)
|
||||||
|
"c5e2486c44a4a8f69dc8db48e86ec9c6e06f291b2a838af8d5c44a4eb3172062",
|
||||||
|
"d4c0dca8b4c9e755cc9c3adcf515a8234da4daeb4f3f87777ad1f45ae9500ec9"
|
||||||
|
]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def arg_a(self) -> str:
|
||||||
|
return super().format_arg('{:x}'.format(self.int_a)).zfill(2 * self.hex_digits)
|
||||||
|
|
||||||
|
def result(self) -> List[str]:
|
||||||
|
result = self.int_a % self.int_n
|
||||||
|
return [self.format_result(result)]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_valid(self) -> bool:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class EcpP384R1Raw(bignum_common.ModOperationCommon,
|
class EcpP384R1Raw(bignum_common.ModOperationCommon,
|
||||||
EcpTarget):
|
EcpTarget):
|
||||||
"""Test cases for ecp quasi_reduction modulo p384."""
|
"""Test cases for ecp quasi_reduction modulo p384."""
|
||||||
@ -285,85 +364,6 @@ class EcpP384R1Raw(bignum_common.ModOperationCommon,
|
|||||||
def is_valid(self) -> bool:
|
def is_valid(self) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class EcpP256R1Raw(bignum_common.ModOperationCommon,
|
|
||||||
EcpTarget):
|
|
||||||
"""Test cases for ECP P256 fast reduction."""
|
|
||||||
symbol = "-"
|
|
||||||
test_function = "ecp_mod_p256_raw"
|
|
||||||
test_name = "ecp_mod_p256_raw"
|
|
||||||
input_style = "fixed"
|
|
||||||
arity = 1
|
|
||||||
|
|
||||||
moduli = ["ffffffff00000001000000000000000000000000ffffffffffffffffffffffff"] # type: List[str]
|
|
||||||
|
|
||||||
input_values = [
|
|
||||||
"0", "1",
|
|
||||||
|
|
||||||
# Modulus - 1
|
|
||||||
"ffffffff00000001000000000000000000000000fffffffffffffffffffffffe",
|
|
||||||
|
|
||||||
# Modulus + 1
|
|
||||||
"ffffffff00000001000000000000000000000001000000000000000000000000",
|
|
||||||
|
|
||||||
# 2^256 - 1
|
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
|
||||||
|
|
||||||
# Maximum canonical P256 multiplication result
|
|
||||||
("fffffffe00000002fffffffe0000000100000001fffffffe00000001fffffffc"
|
|
||||||
"00000003fffffffcfffffffffffffffffffffffc000000000000000000000004"),
|
|
||||||
|
|
||||||
# Generate an overflow during reduction
|
|
||||||
("0000000000000000000000010000000000000000000000000000000000000000"
|
|
||||||
"00000000000000000000000000000000000000000000000000000000ffffffff"),
|
|
||||||
|
|
||||||
# Generate an underflow during reduction
|
|
||||||
("0000000000000000000000000000000000000000000000000000000000000010"
|
|
||||||
"ffffffff00000000000000000000000000000000000000000000000000000000"),
|
|
||||||
|
|
||||||
# Generate an overflow during carry reduction
|
|
||||||
("aaaaaaaa00000000000000000000000000000000000000000000000000000000"
|
|
||||||
"00000000000000000000000000000000aaaaaaacaaaaaaaaaaaaaaaa00000000"),
|
|
||||||
|
|
||||||
# Generate an underflow during carry reduction
|
|
||||||
("000000000000000000000001ffffffff00000000000000000000000000000000"
|
|
||||||
"0000000000000000000000000000000000000002000000020000000100000002"),
|
|
||||||
|
|
||||||
# First 8 number generated by random.getrandbits(512) - seed(2,2)
|
|
||||||
("4067c3584ee207f8da94e3e8ab73738fcf1822ffbc6887782b491044d5e34124"
|
|
||||||
"5c6e433715ba2bdd177219d30e7a269fd95bafc8f2a4d27bdcf4bb99f4bea973"),
|
|
||||||
("82523e86feac7eb7dc38f519b91751dacdbd47d364be8049a372db8f6e405d93"
|
|
||||||
"ffed9235288bc781ae66267594c9c9500925e4749b575bd13653f8dd9b1f282e"),
|
|
||||||
("e8624fab5186ee32ee8d7ee9770348a05d300cb90706a045defc044a09325626"
|
|
||||||
"e6b58de744ab6cce80877b6f71e1f6d2ef8acd128b4f2fc15f3f57ebf30b94fa"),
|
|
||||||
("829a48d422fe99a22c70501e533c91352d3d854e061b90303b08c6e33c729578"
|
|
||||||
"2d6c797f8f7d9b782a1be9cd8697bbd0e2520e33e44c50556c71c4a66148a86f"),
|
|
||||||
("e89204e2e8168561867e5e15bc01bfce6a27e0dfcbf8754472154e76e4c11ab2"
|
|
||||||
"fec3f6b32e8d4b8a8f54f8ceacaab39e83844b40ffa9b9f15c14bc4a829e07b0"),
|
|
||||||
("bd143fa9b714210c665d7435c1066932f4767f26294365b2721dea3bf63f23d0"
|
|
||||||
"dbe53fcafb2147df5ca495fa5a91c89b97eeab64ca2ce6bc5d3fd983c34c769f"),
|
|
||||||
("74667bffe202849da9643a295a9ac6decbd4d3e2d4dec9ef83f0be4e80371eb9"
|
|
||||||
"7f81375eecc1cb6347733e847d718d733ff98ff387c56473a7a83ee0761ebfd2"),
|
|
||||||
("d08f1bb2531d6460f0caeef038c89b38a8acb5137c9260dc74e088a9b9492f25"
|
|
||||||
"8ebdbfe3eb9ac688b9d39cca91551e8259cc60b17604e4b4e73695c3e652c71a"),
|
|
||||||
|
|
||||||
# Next 2 number generated by random.getrandbits(256)
|
|
||||||
"c5e2486c44a4a8f69dc8db48e86ec9c6e06f291b2a838af8d5c44a4eb3172062",
|
|
||||||
"d4c0dca8b4c9e755cc9c3adcf515a8234da4daeb4f3f87777ad1f45ae9500ec9"
|
|
||||||
]
|
|
||||||
|
|
||||||
@property
|
|
||||||
def arg_a(self) -> str:
|
|
||||||
return super().format_arg('{:x}'.format(self.int_a)).zfill(2 * self.hex_digits)
|
|
||||||
|
|
||||||
def result(self) -> List[str]:
|
|
||||||
result = self.int_a % self.int_n
|
|
||||||
return [self.format_result(result)]
|
|
||||||
|
|
||||||
@property
|
|
||||||
def is_valid(self) -> bool:
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class EcpP521R1Raw(bignum_common.ModOperationCommon,
|
class EcpP521R1Raw(bignum_common.ModOperationCommon,
|
||||||
EcpTarget):
|
EcpTarget):
|
||||||
"""Test cases for ecp quasi_reduction()."""
|
"""Test cases for ecp quasi_reduction()."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user