From 1748de160acc9046074f9e540854b1165446eef4 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Mon, 13 Feb 2023 15:35:35 +0000 Subject: [PATCH] Fix IAR Warnings IAR was warning that conditional execution could bypass initialisation of variables, although those same variables were not used uninitialised. Signed-off-by: Paul Elliott --- ChangeLog.d/fix-iar-warnings.txt | 2 +- library/bignum.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.d/fix-iar-warnings.txt b/ChangeLog.d/fix-iar-warnings.txt index 244e8630de..8a3013232f 100644 --- a/ChangeLog.d/fix-iar-warnings.txt +++ b/ChangeLog.d/fix-iar-warnings.txt @@ -1,2 +1,2 @@ Bugfix - * Fix IAR compiler warnings. Contributed by Glenn Strauss in #3835. + * Fix IAR compiler warnings. Fixes #6924. diff --git a/library/bignum.c b/library/bignum.c index 41b3a26914..d3a1b00d52 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -1656,6 +1656,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, size_t window_bitsize; size_t i, j, nblimbs; size_t bufsize, nbits; + size_t exponent_bits_in_window = 0; mbedtls_mpi_uint ei, mm, state; mbedtls_mpi RR, T, W[(size_t) 1 << MBEDTLS_MPI_WINDOW_SIZE], WW, Apos; int neg; @@ -1829,7 +1830,6 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, nblimbs = E->n; bufsize = 0; nbits = 0; - size_t exponent_bits_in_window = 0; state = 0; while (1) {