From db378dd2e8a399cef006144b548ff77fce4f2255 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Fri, 10 Aug 2018 14:46:03 -0500 Subject: [PATCH] unit: Fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some compilers complained that: ../unit/test-ecc.c: In function ‘run_test’: ../unit/test-ecc.c:295:38: warning: ‘lres’ may be used uninitialized in this function [-Wmaybe-uninitialized] assert(data->lres == lres); ^ --- unit/test-ecc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/unit/test-ecc.c b/unit/test-ecc.c index 6d7e9773..e675d1b2 100644 --- a/unit/test-ecc.c +++ b/unit/test-ecc.c @@ -195,7 +195,6 @@ static void run_test(const void *arg) scalar[NUM_ECC_DIGITS], result[NUM_ECC_DIGITS], check[NUM_ECC_DIGITS]; struct ecc_point point1, point2, point_ret; - int lres; memset(result, 0, sizeof(result)); @@ -256,8 +255,11 @@ static void run_test(const void *arg) vli_mod_exp(result, a, b, mod); break; case TEST_LEGENDRE: - lres = vli_legendre(a, mod); + { + int lres = vli_legendre(a, mod); + assert(data->lres == lres); break; + } case TEST_POINT_ADD: assert(ecc_valid_point(&point1) == true); assert(ecc_valid_point(&point2) == true); @@ -290,9 +292,6 @@ static void run_test(const void *arg) assert(memcmp(checkx, point_ret.x, 32) == 0); assert(memcmp(checky, point_ret.y, 32) == 0); assert(ecc_valid_point(&point_ret) == true); - - } else if (data->type == TEST_LEGENDRE) { - assert(data->lres == lres); } }