Use designated initializers for mbedtls_mpi
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/library/ecp.c b/library/ecp.c
index 086acb3..538d2cf 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -2930,7 +2930,7 @@
#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)
/*
diff --git a/library/ecp_curves.c b/library/ecp_curves.c
index 9acf778..1f9dc71 100644
--- a/library/ecp_curves.c
+++ b/library/ecp_curves.c
@@ -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)
diff --git a/tests/suites/test_suite_bignum_random.function b/tests/suites/test_suite_bignum_random.function
index e4db3d7..34221a7 100644
--- a/tests/suites/test_suite_bignum_random.function
+++ b/tests/suites/test_suite_bignum_random.function
@@ -312,8 +312,8 @@
/* 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);