From b7438d1f6235c0713b364d255657d82ff468f4e7 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Thu, 15 Sep 2022 15:05:59 +0100 Subject: [PATCH] Update name of mbedtls_mpi_montg_init() Signed-off-by: Tom Cosgrove --- library/bignum.c | 2 +- library/bignum_core.c | 2 +- library/bignum_core.h | 4 ++-- tests/suites/test_suite_mpi.function | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/bignum.c b/library/bignum.c index de6195251..19d59be6b 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -1547,7 +1547,7 @@ int mbedtls_mpi_mod_int( mbedtls_mpi_uint *r, const mbedtls_mpi *A, mbedtls_mpi_ static void mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N ) { - *mm = mbedtls_mpi_montg_init( N->p ); + *mm = mbedtls_mpi_core_montmul_init( N->p ); } /** Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36) diff --git a/library/bignum_core.c b/library/bignum_core.c index bb6e7cd3b..fa7fc8508 100644 --- a/library/bignum_core.c +++ b/library/bignum_core.c @@ -377,7 +377,7 @@ mbedtls_mpi_uint mbedtls_mpi_core_mla( mbedtls_mpi_uint *d, size_t d_len, /* * Fast Montgomery initialization (thanks to Tom St Denis). */ -mbedtls_mpi_uint mbedtls_mpi_montg_init( const mbedtls_mpi_uint *N ) +mbedtls_mpi_uint mbedtls_mpi_core_montmul_init( const mbedtls_mpi_uint *N ) { mbedtls_mpi_uint x = N[0]; diff --git a/library/bignum_core.h b/library/bignum_core.h index 49ea48525..746c1d950 100644 --- a/library/bignum_core.h +++ b/library/bignum_core.h @@ -240,7 +240,7 @@ mbedtls_mpi_uint mbedtls_mpi_core_mla( mbedtls_mpi_uint *A, size_t A_limbs, * * \return The initialisation value for fast Montgomery modular multiplication */ -mbedtls_mpi_uint mbedtls_mpi_montg_init( const mbedtls_mpi_uint *N ); +mbedtls_mpi_uint mbedtls_mpi_core_montmul_init( const mbedtls_mpi_uint *N ); /** * \brief Montgomery multiplication: X = A * B * R^-1 mod N (HAC 14.36) @@ -260,7 +260,7 @@ mbedtls_mpi_uint mbedtls_mpi_montg_init( const mbedtls_mpi_uint *N ); * of limbs as \p A. * \param[in] AN_limbs The number of limbs in \p X, \p A and \p N. * \param mm The Montgomery constant for \p N: -N^-1 mod 2^biL. - * This can be calculated by `mbedtls_mpi_montg_init()`. + * This can be calculated by `mbedtls_mpi_core_montmul_init()`. * \param[in,out] T Temporary storage of size at least 2*AN_limbs+1 limbs. * Its initial content is unused and * its final content is indeterminate. diff --git a/tests/suites/test_suite_mpi.function b/tests/suites/test_suite_mpi.function index 71912b176..2a09fe46f 100644 --- a/tests/suites/test_suite_mpi.function +++ b/tests/suites/test_suite_mpi.function @@ -2035,8 +2035,8 @@ void mpi_montg_init( char * input_N, char * input_mm ) TEST_EQUAL( 1, N.s ); TEST_EQUAL( 1, mm.s ); - /* mbedtls_mpi_montg_init() only returns a result, no error possible */ - mbedtls_mpi_uint result = mbedtls_mpi_montg_init( N.p ); + /* mbedtls_mpi_core_montmul_init() only returns a result, no error possible */ + mbedtls_mpi_uint result = mbedtls_mpi_core_montmul_init( N.p ); /* Check we got the correct result */ TEST_EQUAL( result, mm.p[0] ); @@ -2096,7 +2096,7 @@ void mpi_core_montmul( int limbs_AN4, int limbs_B4, TEST_EQUAL( 0, mbedtls_mpi_grow( &T, limbs_AN * 2 + 1 ) ); /* Calculate the Montgomery constant (this is unit tested separately) */ - mbedtls_mpi_uint mm = mbedtls_mpi_montg_init( N.p ); + mbedtls_mpi_uint mm = mbedtls_mpi_core_montmul_init( N.p ); TEST_EQUAL( 0, mbedtls_mpi_grow( &R, limbs_AN ) ); /* ensure it's got the right number of limbs */