From ce6fa8f4119df6f4b3a0379f422251fc8620d407 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 3 Dec 2020 14:24:33 +0000 Subject: [PATCH] Fix broken testing on numbers that may be greater than MPI_MAX_SIZE Previously `mbedtls_mpi_exp_mod` was tested with values that were over `MBEDTLS_MPI_MAX_SIZE` in size. This is useful to do as some paths are only taken when the exponent is large enough however, on builds where `MBEDTLS_MPI_MAX_SIZE` is under the size of these test values. This fix turns off these tests when `MBEDTLS_MPI_MAX_SIZE` is too small to safely test (notably this is the case in config-thread.h). Signed-off-by: Chris Jones --- tests/suites/test_suite_mpi.function | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/suites/test_suite_mpi.function b/tests/suites/test_suite_mpi.function index 848a8de53..5d8cfc4c2 100644 --- a/tests/suites/test_suite_mpi.function +++ b/tests/suites/test_suite_mpi.function @@ -1,6 +1,10 @@ /* BEGIN_HEADER */ #include "mbedtls/bignum.h" +#if MBEDTLS_MPI_MAX_BITS > 256 +#define MPI_MAX_BITS_LARGER_THAN_256 +#endif + typedef struct mbedtls_test_mpi_random { data_t *data; @@ -1078,7 +1082,7 @@ exit: } /* END_CASE */ -/* BEGIN_CASE */ +/* BEGIN_CASE depends_on:MPI_MAX_BITS_LARGER_THAN_256 */ void mbedtls_mpi_exp_mod( int radix_A, char * input_A, int radix_E, char * input_E, int radix_N, char * input_N, int radix_RR, char * input_RR, int radix_X,