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 <christopher.jones@arm.com>
This commit is contained in:
Chris Jones 2020-12-03 14:24:33 +00:00
parent e146bdcff9
commit 4592bd8982

View file

@ -1,6 +1,10 @@
/* BEGIN_HEADER */ /* BEGIN_HEADER */
#include "mbedtls/bignum.h" #include "mbedtls/bignum.h"
#if MBEDTLS_MPI_MAX_BITS > 256
#define MPI_MAX_BITS_LARGER_THAN_256
#endif
typedef struct mbedtls_test_mpi_random typedef struct mbedtls_test_mpi_random
{ {
data_t *data; data_t *data;
@ -1132,7 +1136,7 @@ exit:
} }
/* END_CASE */ /* 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, void mbedtls_mpi_exp_mod( int radix_A, char * input_A, int radix_E,
char * input_E, int radix_N, char * input_N, char * input_E, int radix_N, char * input_N,
int radix_RR, char * input_RR, int radix_X, int radix_RR, char * input_RR, int radix_X,