From 08a94953e1fe7f82050c7a9ddff6939719d7de9a Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Tue, 28 Feb 2023 18:40:57 +0100 Subject: [PATCH] Apply naming convention for p224 Signed-off-by: Gabor Mezei --- library/ecp_curves.c | 30 +++++++++++++++--------------- library/ecp_invasive.h | 22 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 977f140d7b..ee211af2f6 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -4974,32 +4974,32 @@ int mbedtls_ecp_mod_p192_raw(mbedtls_mpi_uint *Np, size_t Nn) #if defined(MBEDTLS_HAVE_INT32) /* 32 bit */ -#define MAX32 Nn -#define A(j) Np[j] -#define STORE32 Np[i] = cur; -#define STORE0 Np[i] = 0; +#define MAX32 X_limbs +#define A(j) X[j] +#define STORE32 X[i] = cur; +#define STORE0 X[i] = 0; #else /* 64 bit */ -#define MAX32 Nn * 2 +#define MAX32 X_limbs * 2 #define A(j) \ (j) % 2 ? \ - (uint32_t) (Np[(j) / 2] >> 32) : \ - (uint32_t) (Np[(j) / 2]) + (uint32_t) (X[(j) / 2] >> 32) : \ + (uint32_t) (X[(j) / 2]) #define STORE32 \ if (i % 2) { \ - Np[i/2] &= 0x00000000FFFFFFFF; \ - Np[i/2] |= (uint64_t) (cur) << 32; \ + X[i/2] &= 0x00000000FFFFFFFF; \ + X[i/2] |= (uint64_t) (cur) << 32; \ } else { \ - Np[i/2] &= 0xFFFFFFFF00000000; \ - Np[i/2] |= (uint32_t) cur; \ + X[i/2] &= 0xFFFFFFFF00000000; \ + X[i/2] |= (uint32_t) cur; \ } #define STORE0 \ if (i % 2) { \ - Np[i/2] &= 0x00000000FFFFFFFF; \ + X[i/2] &= 0x00000000FFFFFFFF; \ } else { \ - Np[i/2] &= 0xFFFFFFFF00000000; \ + X[i/2] &= 0xFFFFFFFF00000000; \ } #endif @@ -5061,9 +5061,9 @@ cleanup: } MBEDTLS_STATIC_TESTABLE -int mbedtls_ecp_mod_p224_raw(mbedtls_mpi_uint *Np, size_t Nn) +int mbedtls_ecp_mod_p224_raw(mbedtls_mpi_uint *X, size_t X_limbs) { - if (Nn != 2 * 224 / biL) { + if (X_limbs != 2 * 224 / biL) { return MBEDTLS_ERR_ECP_BAD_INPUT_DATA; } diff --git a/library/ecp_invasive.h b/library/ecp_invasive.h index 8ea6ece9a0..be9b3994c9 100644 --- a/library/ecp_invasive.h +++ b/library/ecp_invasive.h @@ -98,21 +98,21 @@ int mbedtls_ecp_mod_p192_raw(mbedtls_mpi_uint *Np, size_t Nn); /** Fast quasi-reduction modulo p224 (FIPS 186-3 D.2.2) * - * \param[in,out] Np The address of the MPI to be converted. - * Must have exact limb size that stores a 448-bit MPI - * (double the bitlength of the modulus). - * Upon return holds the reduced value which is - * in range `0 <= X < 2 * N` (where N is the modulus). - * The bitlength of the reduced value is the same as - * that of the modulus (224 bits). - * \param[in] Nn The length of \p Nn in limbs. + * \param[in,out] X The address of the MPI to be converted. + * Must have exact limb size that stores a 448-bit MPI + * (double the bitlength of the modulus). + * Upon return holds the reduced value which is + * in range `0 <= X < 2 * N` (where N is the modulus). + * The bitlength of the reduced value is the same as + * that of the modulus (224 bits). + * \param[in] X_limbs The length of \p X in limbs. * * \return \c 0 on success. - * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if \p Nn is not the limb - * size that sores a 448-bit MPI. + * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if \p X_limbs is not the + * limb size that sores a 448-bit MPI. */ MBEDTLS_STATIC_TESTABLE -int mbedtls_ecp_mod_p224_raw(mbedtls_mpi_uint *Np, size_t Nn); +int mbedtls_ecp_mod_p224_raw(mbedtls_mpi_uint *X, size_t X_limbs); #endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */