From c881486bb2597aa29a22225beeeec1d65881ff82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 5 Nov 2019 10:32:37 +0100 Subject: [PATCH] Fix off-by-one number of extra operations This caused a performance issue. --- tinycrypt/ecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinycrypt/ecc.c b/tinycrypt/ecc.c index 674037519..d01c67617 100644 --- a/tinycrypt/ecc.c +++ b/tinycrypt/ecc.c @@ -342,7 +342,7 @@ static void uECC_vli_mult_rnd(uECC_word_t *result, const uECC_word_t *left, delays >>= 2; /* k = 0 -> i in [1, 0] -> 0 extra muladd; * k = 3 -> i in [1, 3] -> 3 extra muladd */ - for (i = 0; i <= k; ++i) { + for (i = 1; i <= k; ++i) { muladd(left[i], right[k - i], &rr0, &rr1, &r2); } r = rr0;