Fix use of sizeof without brackets in ecp_curves.c

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
Xiaokang Qian 2023-06-15 07:10:48 +00:00
parent e25597dad7
commit be4d6b62ab

View File

@ -4507,8 +4507,7 @@ static const mbedtls_ecp_point brainpoolP512r1_T[32] = {
#if defined(ECP_LOAD_GROUP) #if defined(ECP_LOAD_GROUP)
/* /*
* Create an MPI from embedded constants * Create an MPI from embedded constants
* (assumes len is an exact multiple of sizeof(mbedtls_mpi_uint) and * (assumes len is an exact multiple of sizeof(mbedtls_mpi_uint))
* len < 1048576)
*/ */
static inline void ecp_mpi_load(mbedtls_mpi *X, const mbedtls_mpi_uint *p, size_t len) static inline void ecp_mpi_load(mbedtls_mpi *X, const mbedtls_mpi_uint *p, size_t len)
{ {
@ -5358,7 +5357,7 @@ static inline int ecp_mod_koblitz(mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p
if (M.n > p_limbs + adjust) { if (M.n > p_limbs + adjust) {
M.n = p_limbs + adjust; M.n = p_limbs + adjust;
} }
memset(Mp, 0, sizeof Mp); memset(Mp, 0, sizeof(Mp));
memcpy(Mp, N->p + p_limbs - adjust, M.n * sizeof(mbedtls_mpi_uint)); memcpy(Mp, N->p + p_limbs - adjust, M.n * sizeof(mbedtls_mpi_uint));
if (shift != 0) { if (shift != 0) {
MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&M, shift)); MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&M, shift));
@ -5384,7 +5383,7 @@ static inline int ecp_mod_koblitz(mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p
if (M.n > p_limbs + adjust) { if (M.n > p_limbs + adjust) {
M.n = p_limbs + adjust; M.n = p_limbs + adjust;
} }
memset(Mp, 0, sizeof Mp); memset(Mp, 0, sizeof(Mp));
memcpy(Mp, N->p + p_limbs - adjust, M.n * sizeof(mbedtls_mpi_uint)); memcpy(Mp, N->p + p_limbs - adjust, M.n * sizeof(mbedtls_mpi_uint));
if (shift != 0) { if (shift != 0) {
MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&M, shift)); MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&M, shift));