From f883504d2d44d24cae1ca6c9f88ce780ab36f59b Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sat, 20 Jan 2024 08:50:52 +0000 Subject: [PATCH] Fix #2573 - GCC build warning in tls_builtin.c::mul() --- mongoose.c | 4 +++- src/tls_builtin.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 16a6ee38..e3226480 100644 --- a/mongoose.c +++ b/mongoose.c @@ -9208,7 +9208,9 @@ static void sub(fe out, const fe a, const fe b) { propagate(out, (limb_t) (1 + carry)); } -static void mul(fe out, const fe a, const fe b, unsigned nb) { +// `b` can contain less than 8 limbs, thus we use `limb_t *` instead of `fe` +// to avoid build warnings +static void mul(fe out, const fe a, const limb_t *b, unsigned nb) { limb_t accum[2 * NLIMBS] = {0}; unsigned i, j; diff --git a/src/tls_builtin.c b/src/tls_builtin.c index 031679b7..97da2137 100644 --- a/src/tls_builtin.c +++ b/src/tls_builtin.c @@ -116,7 +116,9 @@ static void sub(fe out, const fe a, const fe b) { propagate(out, (limb_t) (1 + carry)); } -static void mul(fe out, const fe a, const fe b, unsigned nb) { +// `b` can contain less than 8 limbs, thus we use `limb_t *` instead of `fe` +// to avoid build warnings +static void mul(fe out, const fe a, const limb_t *b, unsigned nb) { limb_t accum[2 * NLIMBS] = {0}; unsigned i, j;