From effff764e131e407808d9a975f86fd4aa9039a7a Mon Sep 17 00:00:00 2001 From: Minos Galanakis Date: Fri, 9 Jun 2023 15:11:41 +0100 Subject: [PATCH] test_suite_ecp: Updated `ecp_mod_p_generic_raw` for optimised reduction. Signed-off-by: Minos Galanakis --- tests/suites/test_suite_ecp.function | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function index cf316d066..1df0624f6 100644 --- a/tests/suites/test_suite_ecp.function +++ b/tests/suites/test_suite_ecp.function @@ -1406,16 +1406,18 @@ void ecp_mod_setup(char *input_A, int id, int ctype, int iret) TEST_EQUAL(ret, iret); if (ret == 0) { - + TEST_ASSERT(m.int_rep != MBEDTLS_MPI_MOD_REP_INVALID); /* Test for limb sizes */ TEST_EQUAL(m.limbs, p_limbs); bytes = p_limbs * sizeof(mbedtls_mpi_uint); - /* Test for validity of moduli by the presence of Montgomery consts */ - - TEST_ASSERT(m.rep.mont.mm != 0); - TEST_ASSERT(m.rep.mont.rr != NULL); - + if (m.int_rep == MBEDTLS_MPI_MOD_REP_MONTGOMERY) { + /* Test for validity of moduli by the presence of Montgomery consts */ + TEST_ASSERT(m.rep.mont.mm != 0); + TEST_ASSERT(m.rep.mont.rr != NULL); + } else { + TEST_ASSERT(m.rep.ored.modp != NULL); + } /* Compare output byte-by-byte */ ASSERT_COMPARE(p, bytes, m.p, bytes);