Use designated initializers for mbedtls_mpi

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-07-11 09:52:31 +01:00
parent 053022fe24
commit 84eaefa43e
3 changed files with 4 additions and 4 deletions

View file

@ -2930,7 +2930,7 @@ int mbedtls_ecp_muladd(mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
#if defined(MBEDTLS_ECP_MONTGOMERY_ENABLED)
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
#define ECP_MPI_INIT(s, n, p) { s, (n), (mbedtls_mpi_uint *) (p) }
#define ECP_MPI_INIT(_s, _n, _p) { .s = (_s), .n = (_n), .p = (mbedtls_mpi_uint *) (_p) }
#define ECP_MPI_INIT_ARRAY(x) \
ECP_MPI_INIT(1, sizeof(x) / sizeof(mbedtls_mpi_uint), x)
/*

View file

@ -44,7 +44,7 @@
#define ECP_VALIDATE(cond) \
MBEDTLS_INTERNAL_VALIDATE(cond)
#define ECP_MPI_INIT(s, n, p) { s, (n), (mbedtls_mpi_uint *) (p) }
#define ECP_MPI_INIT(_s, _n, _p) { .s = (_s), .n = (_n), .p = (mbedtls_mpi_uint *) (_p) }
#define ECP_MPI_INIT_ARRAY(x) \
ECP_MPI_INIT(1, sizeof(x) / sizeof(mbedtls_mpi_uint), x)

View file

@ -312,8 +312,8 @@ void mpi_random_many(int min, char *bound_hex, int iterations)
/* Temporarily use a legacy MPI for analysis, because the
* necessary auxiliary functions don't exist yet in core. */
mbedtls_mpi B = { 1, limbs, upper_bound };
mbedtls_mpi R = { 1, limbs, result };
mbedtls_mpi B = { .s = 1, .n = limbs, .p = upper_bound };
mbedtls_mpi R = { .s = 1, .n = limbs, .p = result };
TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R, &B) < 0);
TEST_ASSERT(mbedtls_mpi_cmp_int(&R, min) >= 0);