diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 21142b989687..a0ad3af7c916 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -4617,6 +4617,7 @@ MBEDTLS_STATIC_TESTABLE int mbedtls_ecp_mod_p224k1(mbedtls_mpi *); #endif #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) +static int ecp_mod_p256k1(mbedtls_mpi *); MBEDTLS_STATIC_TESTABLE int ecp_mod_p256k1(mbedtls_mpi *); #endif @@ -5656,12 +5657,18 @@ int mbedtls_ecp_mod_p224k1(mbedtls_mpi *N) #endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */ #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) + +static int ecp_mod_p256k1(mbedtls_mpi *N) +{ + return mbedtls_ecp_mod_p256k1(N); +} + /* * Fast quasi-reduction modulo p256k1 = 2^256 - R, * with R = 2^32 + 2^9 + 2^8 + 2^7 + 2^6 + 2^4 + 1 = 0x01000003D1 */ MBEDTLS_STATIC_TESTABLE -int ecp_mod_p256k1(mbedtls_mpi *N) +int mbedtls_ecp_mod_p256k1(mbedtls_mpi *N) { static mbedtls_mpi_uint Rp[] = { MBEDTLS_BYTES_TO_T_UINT_8(0xD1, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, diff --git a/library/ecp_invasive.h b/library/ecp_invasive.h index bd6d399ad90a..a0d038c619df 100644 --- a/library/ecp_invasive.h +++ b/library/ecp_invasive.h @@ -189,7 +189,7 @@ int mbedtls_ecp_mod_p224k1(mbedtls_mpi *N); #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) MBEDTLS_STATIC_TESTABLE -int ecp_mod_p256k1(mbedtls_mpi *N); +int mbedtls_ecp_mod_p256k1(mbedtls_mpi *N); #endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */ diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function index 1e8f1f6f0e45..f02aca5e7a6b 100644 --- a/tests/suites/test_suite_ecp.function +++ b/tests/suites/test_suite_ecp.function @@ -1463,7 +1463,7 @@ void ecp_mod_p256k1(char *input_N, &m, N, limbs, MBEDTLS_MPI_MOD_REP_MONTGOMERY), 0); - TEST_EQUAL(ecp_mod_p256k1(&X), 0); + TEST_EQUAL(mbedtls_ecp_mod_p256k1(&X), 0); TEST_LE_U(mbedtls_mpi_core_bitlen(X.p, X.n), 256); mbedtls_mpi_mod_raw_fix_quasi_reduction(X.p, &m); ASSERT_COMPARE(X.p, bytes, res, bytes);