From fcfef59c434324f8bc6daafa56e34208f82a5bfd Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Mon, 4 Jan 2016 17:04:10 -0700 Subject: [PATCH 1/3] check err after set --- wolfcrypt/src/ecc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 507f212b0..653f16ed4 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -4192,7 +4192,8 @@ static int accel_fp_mul(int idx, mp_int* k, ecc_point *R, mp_int* modulus, } if (err == MP_OKAY) { - z = 0; + z = 0; /* mp_to_unsigned_bin != MP_OKAY z will be declared/not set */ + (void) z; /* Acknowledge the unused assignment */ ForceZero(kb, KB_SIZE); /* map R back from projective space */ if (map) { @@ -4448,6 +4449,9 @@ static int accel_fp_mul2add(int idx1, int idx2, XFREE(kb[1], NULL, DYNAMIC_TYPE_TMP_BUFFER); #endif + if (err != MP_OKAY) + return err; + #undef KB_SIZE return ecc_map(R, modulus, mp); From 699597bb21aaf7e2f9bfc05b78db4dde9bf0285b Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Tue, 5 Jan 2016 07:35:28 -0700 Subject: [PATCH 2/3] execute undef before checking and return --- wolfcrypt/src/ecc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 653f16ed4..175c436bd 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -4449,11 +4449,11 @@ static int accel_fp_mul2add(int idx1, int idx2, XFREE(kb[1], NULL, DYNAMIC_TYPE_TMP_BUFFER); #endif + #undef KB_SIZE + if (err != MP_OKAY) return err; -#undef KB_SIZE - return ecc_map(R, modulus, mp); } From e4c4c5a73a69f016d01c9ae52b82a9790fa8840d Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Tue, 5 Jan 2016 07:37:31 -0700 Subject: [PATCH 3/3] white space change removed --- wolfcrypt/src/ecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 175c436bd..a88d765f4 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -4449,7 +4449,7 @@ static int accel_fp_mul2add(int idx1, int idx2, XFREE(kb[1], NULL, DYNAMIC_TYPE_TMP_BUFFER); #endif - #undef KB_SIZE +#undef KB_SIZE if (err != MP_OKAY) return err;