Apply naming convention for p224

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2023-02-28 18:40:57 +01:00
parent 5afb80e00a
commit 08a94953e1
No known key found for this signature in database
GPG Key ID: F072ACA227ACD71D
2 changed files with 26 additions and 26 deletions

View File

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

View File

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