ecp_curves: Renamed ecp_mod_p256k1 -> mbedtls_ecp_mod_p256k1

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis 2023-04-12 11:10:03 +01:00
parent d6751dcd8b
commit 9c2c81f996
3 changed files with 11 additions and 4 deletions

View file

@ -4617,8 +4617,9 @@ 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 *);
int mbedtls_ecp_mod_p256k1(mbedtls_mpi *);
#endif
#if defined(ECP_LOAD_GROUP)
@ -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,

View file

@ -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 */

View file

@ -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);