1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-06-25 12:41:56 +03:00

For binary operations, test both x op y and y op x

This exposes a bug in mbedtls_mpi_add_mpi() and mbedtls_mpi_sub_mpi() which
will be fixed in a subsequent commit.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2022-11-09 21:57:52 +01:00
parent cae0c745fc
commit ee78b6e642
2 changed files with 374 additions and 111 deletions

View File

@ -54,7 +54,6 @@ of BaseTarget in test_data_generation.py.
# See the License for the specific language governing permissions and
# limitations under the License.
import itertools
import sys
import typing
@ -75,13 +74,7 @@ def quote_str(val) -> str:
def combination_pairs(values: List[T]) -> List[Tuple[T, T]]:
"""Return all pair combinations from input values."""
# The return value is cast, as older versions of mypy are unable to derive
# the specific type returned by itertools.combinations_with_replacement.
return typing.cast(
List[Tuple[T, T]],
list(itertools.combinations_with_replacement(values, 2))
)
return [(x, y) for x in values for y in values]
class BignumTarget(test_data_generation.BaseTarget, metaclass=ABCMeta):
#pylint: disable=abstract-method